feat: add Playwright testing framework configuration and tests #71
1 changed files with 0 additions and 31 deletions
|
@ -57,36 +57,5 @@ test.describe('mitarbeiter', () => {
|
|||
|
||||
await expect(error).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('CreationAndDeletion', async ({ page }) => {
|
||||
await page.getByLabel('First Name').fill('a');
|
||||
await page.getByLabel('Last Name').fill('a');
|
||||
await page.getByLabel('Street').fill('a');
|
||||
await page.getByLabel('Postcode').fill('12345');
|
||||
await page.getByLabel('City').fill('a');
|
||||
await page.getByLabel('Phone Number').fill('1234');
|
||||
|
||||
await page.getByText('Save').click();
|
||||
expect(page.url().includes('erstellen')).toBeFalsy();
|
||||
|
||||
// Wait for all "Delete" buttons to be attached to the DOM
|
||||
// await page.locator('text=Delete').waitFor({ state: 'attached', timeout: 10000 });
|
||||
|
||||
// Ensure there are at least 3 "Delete" buttons
|
||||
const deleteButtons = page.locator('text=Delete');
|
||||
const deleteButtonCount = await deleteButtons.count();
|
||||
|
||||
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('Less than 3 "Delete" buttons found.');
|
||||
}
|
||||
|
||||
const deletedEmployee = page.getByText('12345');
|
||||
await expect(deletedEmployee).toHaveCount(0, { timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue