All checks were successful
Playwright Tests / test (pull_request) Successful in 1m58s
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
test.describe('mitarbeiter', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('http://localhost:4200');
|
|
|
|
await page.getByRole('button').click();
|
|
await page.waitForFunction(() => window.location.href.includes('keycloak'));
|
|
await page.getByLabel('Username or email').fill('user');
|
|
await page.getByLabel('Password').fill('test');
|
|
await page.click('#kc-login');
|
|
|
|
await page.goto('http://localhost:4200/mitarbeiter');
|
|
});
|
|
|
|
test('ShouldLoad', async ({ page }) => {
|
|
await expect(page.getByRole('heading')).toHaveText("Employees");
|
|
});
|
|
|
|
test('ShouldLoadEmployees', async ({ page }) => {
|
|
expect(page.getByText('Max')).toBeTruthy();
|
|
});
|
|
|
|
test('AddEmployeeShouldRedirect', async ({ page }) => {
|
|
await page.getByText('Add employee').click();
|
|
|
|
expect(page.url()).toContain('mitarbeitererstellen');
|
|
});
|
|
|
|
test('EditShouldRedirectToCorrespondingPage', async ({ page }) => {
|
|
const button = page.getByText('Edit').first();
|
|
await button.click();
|
|
|
|
expect(page.url()).toContain('mitarbeiterbearbeiten');
|
|
expect(page.url()).toContain('1');
|
|
});
|
|
|
|
test('DeleteShouldBeThere', 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);
|
|
expect(button).toBeTruthy();
|
|
});
|
|
|
|
test('SearchShouldWork', async ({ page }) => {
|
|
const searchField = page.getByRole('textbox');
|
|
const searchButton = page.getByText('Search').first();
|
|
|
|
await searchField.fill('Max');
|
|
await searchButton.click();
|
|
|
|
const hiddenItem = page.getByText('MusterFrau');
|
|
await expect(hiddenItem).toHaveCount(0);
|
|
});
|
|
});
|
|
|