test: add tests for mitarbeiter functionality
Some checks failed
Playwright Tests / test (pull_request) Failing after 3m8s
Some checks failed
Playwright Tests / test (pull_request) Failing after 3m8s
This commit is contained in:
parent
769c775be4
commit
ae78af5440
2 changed files with 37 additions and 2 deletions
|
@ -6,8 +6,6 @@ services:
|
|||
postgres-employee:
|
||||
container_name: postgres_employee
|
||||
image: postgres:13.3
|
||||
volumes:
|
||||
- employee_postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_DB: employee_db
|
||||
POSTGRES_USER: employee
|
||||
|
|
37
tests/mitarbeiter.spec.ts
Normal file
37
tests/mitarbeiter.spec.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
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');
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue