Skip to content

Commit c53f46e

Browse files
committed
fix(test): handle 200 OK from API deletes and click Confirm button in Shadcn dialog
1 parent 30fbbcd commit c53f46e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

frontend/ui_global_test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ import path from 'path';
178178
method: 'DELETE',
179179
headers: { 'Authorization': `Bearer ${token}` }
180180
});
181-
return delRes.status === 204 ? 'success' : 'failed';
181+
return (delRes.status === 204 || delRes.status === 200) ? 'success' : 'failed';
182182
}, uniqueSerial);
183183
console.log(` Result: ${maintDeleted}`);
184184

@@ -195,7 +195,7 @@ import path from 'path';
195195
method: 'DELETE',
196196
headers: { 'Authorization': `Bearer ${token}` }
197197
});
198-
return delRes.status === 204 ? 'success' : 'failed';
198+
return (delRes.status === 204 || delRes.status === 200) ? 'success' : 'failed';
199199
}, uniqueSerial);
200200
console.log(` Result: ${resDeleted}`);
201201

@@ -214,6 +214,10 @@ import path from 'path';
214214
console.log('15. Deleting the asset...');
215215
await page.click('button:has-text("Delete")');
216216

217+
// Click the Confirm button in the Shadcn dialog
218+
await page.waitForSelector('button:has-text("Confirm")');
219+
await page.click('button:has-text("Confirm")');
220+
217221
// Wait for the asset to be removed from the list
218222
await page.waitForSelector(`text=${uniqueSerial}`, { state: 'detached' });
219223
await page.screenshot({ path: path.join(artifactDir, 'global_17_asset_deleted.png') });

0 commit comments

Comments
 (0)