test: Update delete button wait conditions in tests
All checks were successful
Playwright Tests / test (pull_request) Successful in 2m20s
All checks were successful
Playwright Tests / test (pull_request) Successful in 2m20s
This commit is contained in:
parent
d3b9362023
commit
d6f68afd64
1 changed files with 7 additions and 5 deletions
|
@ -69,18 +69,20 @@ test.describe('mitarbeiter', () => {
|
|||
await page.getByText('Save').click();
|
||||
expect(page.url().includes('erstellen')).toBeFalsy();
|
||||
|
||||
// Wait for the "Delete" button to be attached to the DOM
|
||||
await page.locator('text=Delete').nth(2).waitFor({ state: 'attached', timeout: 10000 });
|
||||
// Wait for all "Delete" buttons to be attached to the DOM
|
||||
// await page.locator('text=Delete').waitFor({ state: 'attached', timeout: 10000 });
|
||||
|
||||
// Wait for the third "Delete" button to be visible
|
||||
// Ensure there are at least 3 "Delete" buttons
|
||||
const deleteButtons = page.locator('text=Delete');
|
||||
const deleteButtonCount = await deleteButtons.count();
|
||||
if (deleteButtonCount > 2) {
|
||||
|
||||
if (deleteButtonCount >= 3) {
|
||||
// Wait for the third "Delete" button to be visible
|
||||
const deleteButton = deleteButtons.nth(2);
|
||||
await deleteButton.waitFor({ state: 'visible', timeout: 5000 });
|
||||
await deleteButton.click();
|
||||
} else {
|
||||
throw new Error('The expected "Delete" button was not found.');
|
||||
throw new Error('Less than 3 "Delete" buttons found.');
|
||||
}
|
||||
|
||||
const deletedEmployee = page.getByText('12345');
|
||||
|
|
Loading…
Add table
Reference in a new issue