From 769c775be4fbfafca298b6cf766b3141beb4a775 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 16 Jan 2025 17:42:00 +0100 Subject: [PATCH] test: Add login redirection test for employees page --- tests/login.spec.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/login.spec.ts b/tests/login.spec.ts index cc6e4ce..06a5865 100644 --- a/tests/login.spec.ts +++ b/tests/login.spec.ts @@ -31,12 +31,16 @@ test('LoginPageButtonShouldRedirectToKeycloak', async ({ page }) => { expect(page.url()).toContain("keycloak.szut.dev"); }); -// test('get started link', async ({ page }) => { -// await page.goto('https://playwright.dev/'); +test('AfterLoginUserShouldBeRedirectedToEmployees', async ({ page }) => { + await page.goto('http://localhost:4200'); -// // Click the get started link. -// await page.getByRole('link', { name: 'Get started' }).click(); + 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'); + + expect(page.url()).toContain('localhost'); + expect(page.url()).toContain('mitarbeiter'); +}); -// // Expects page to have a heading with the name of Installation. -// await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); -// });