Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf686e45

Browse files
committed
test: added cleanup for saved functions
1 parent33645ba commitf686e45

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

‎tests/ui-testing/pages/apiCleanup.js‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,105 @@ class APICleanup {
13661366
}
13671367
}
13681368

1369+
/**
1370+
* Fetch all search jobs
1371+
*@returns {Promise<Array>} Array of search job objects
1372+
*/
1373+
asyncfetchSearchJobs(){
1374+
try{
1375+
constresponse=awaitfetch(`${this.baseUrl}/api/${this.org}/search_jobs?type=logs`,{
1376+
method:'GET',
1377+
headers:{
1378+
'Authorization':this.authHeader,
1379+
'Content-Type':'application/json'
1380+
}
1381+
});
1382+
1383+
if(!response.ok){
1384+
testLogger.error('Failed to fetch search jobs',{status:response.status});
1385+
return[];
1386+
}
1387+
1388+
constsearchJobs=awaitresponse.json();
1389+
returnsearchJobs||[];
1390+
}catch(error){
1391+
testLogger.error('Failed to fetch search jobs',{error:error.message});
1392+
return[];
1393+
}
1394+
}
1395+
1396+
/**
1397+
* Delete a single search job
1398+
*@param {string} jobId - The search job ID
1399+
*@returns {Promise<Object>} Deletion result
1400+
*/
1401+
asyncdeleteSearchJob(jobId){
1402+
try{
1403+
constresponse=awaitfetch(`${this.baseUrl}/api/${this.org}/search_jobs/${jobId}`,{
1404+
method:'DELETE',
1405+
headers:{
1406+
'Authorization':this.authHeader,
1407+
'Content-Type':'application/json'
1408+
}
1409+
});
1410+
1411+
if(!response.ok){
1412+
testLogger.error('Failed to delete search job',{ jobId,status:response.status});
1413+
return{code:response.status,message:'Failed to delete search job'};
1414+
}
1415+
1416+
constresult=awaitresponse.json();
1417+
return{code:200, ...result};
1418+
}catch(error){
1419+
testLogger.error('Failed to delete search job',{ jobId,error:error.message});
1420+
return{code:500,error:error.message};
1421+
}
1422+
}
1423+
1424+
/**
1425+
* Clean up all search jobs
1426+
* Deletes all search jobs for the organization
1427+
*/
1428+
asynccleanupSearchJobs(){
1429+
testLogger.info('Starting search jobs cleanup');
1430+
1431+
try{
1432+
// Fetch all search jobs
1433+
constsearchJobs=awaitthis.fetchSearchJobs();
1434+
testLogger.info('Fetched search jobs',{total:searchJobs.length});
1435+
1436+
if(searchJobs.length===0){
1437+
testLogger.info('No search jobs to clean up');
1438+
return;
1439+
}
1440+
1441+
// Delete each search job
1442+
letdeletedCount=0;
1443+
letfailedCount=0;
1444+
1445+
for(constjobofsearchJobs){
1446+
constresult=awaitthis.deleteSearchJob(job.id);
1447+
1448+
if(result.code===200){
1449+
deletedCount++;
1450+
testLogger.debug('Deleted search job',{jobId:job.id,userId:job.user_id});
1451+
}else{
1452+
failedCount++;
1453+
testLogger.warn('Failed to delete search job',{jobId:job.id,userId:job.user_id, result});
1454+
}
1455+
}
1456+
1457+
testLogger.info('Search jobs cleanup completed',{
1458+
total:searchJobs.length,
1459+
deleted:deletedCount,
1460+
failed:failedCount
1461+
});
1462+
1463+
}catch(error){
1464+
testLogger.error('Search jobs cleanup failed',{error:error.message});
1465+
}
1466+
}
1467+
13691468
/**
13701469
* Fetch all saved views
13711470
*@returns {Promise<Array>} Array of saved view objects

‎tests/ui-testing/playwright-tests/cleanup.spec.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ test.describe("Pre-Test Cleanup", () => {
5757
// Clean up custom logo from _meta organization
5858
awaitpm.apiCleanup.cleanupLogo();
5959

60+
// Clean up all search jobs
61+
awaitpm.apiCleanup.cleanupSearchJobs();
62+
6063
// Clean up saved views matching test patterns
6164
awaitpm.apiCleanup.cleanupSavedViews();
6265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp