feat: add Playwright testing framework configuration and tests #71
1 changed files with 12 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
import {test, expect} from "@playwright/test";
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test.describe('mitarbeiter', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
|
@ -17,17 +17,17 @@ test.describe('mitarbeiter', () => {
|
|||
await expect(page.getByRole('heading')).toHaveText("Employees");
|
||||
});
|
||||
|
||||
test('ShouldLoadEmployees', async ({page}) => {
|
||||
test('ShouldLoadEmployees', async ({ page }) => {
|
||||
expect(page.getByText('Max')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('AddEmployeeShouldRedirect', async ({page}) => {
|
||||
test('AddEmployeeShouldRedirect', async ({ page }) => {
|
||||
await page.getByText('Add employee').click();
|
||||
|
||||
expect(page.url()).toContain('mitarbeitererstellen');
|
||||
});
|
||||
|
||||
test('EditShouldRedirectToCorrespondingPage', async ({page}) => {
|
||||
test('EditShouldRedirectToCorrespondingPage', async ({ page }) => {
|
||||
const button = page.getByText('Edit').first();
|
||||
await button.click();
|
||||
|
||||
|
@ -35,12 +35,17 @@ test.describe('mitarbeiter', () => {
|
|||
expect(page.url()).toContain('1');
|
||||
});
|
||||
|
||||
test('DeleteShouldRemoveUser', async ({page}) => {
|
||||
test('DeleteShouldRemoveUser', async ({ page }) => {
|
||||
const button = page.getByText('Delete').first();
|
||||
|
||||
const users = page.getByText('Delete');
|
||||
await users.first().waitFor({ state: "visible" });
|
||||
expect(await users.count()).toBe(2);
|
||||
|
||||
await button.click();
|
||||
|
||||
const user = page.getByText('Max');
|
||||
expect(user).toBeFalsy();
|
||||
const user = page.getByText('Delete');
|
||||
expect(await user.count()).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue