✅(app-desk) e2e test app-desk
Tests: - login to keycloak - create new teams - check teams are displayed
This commit is contained in:
28
src/frontend/apps/e2e/__tests__/app-desk/app.spec.ts
Normal file
28
src/frontend/apps/e2e/__tests__/app-desk/app.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
|
import { keyCloakSignIn } from './common';
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('/');
|
||||||
|
await keyCloakSignIn(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('App', () => {
|
||||||
|
test('should display the homepage after keycloak login', async ({ page }) => {
|
||||||
|
await expect(page.locator('h2')).toContainText('Hello world!');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('creates 2 teams and displayed them', async ({ page }) => {
|
||||||
|
await page.getByLabel('Team name').fill('My new team');
|
||||||
|
await page.click('button:has-text("Create Team")');
|
||||||
|
await page.getByLabel('Team name').fill('My second new team');
|
||||||
|
await page.click('button:has-text("Create Team")');
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.locator('li').getByText('My new team').first(),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('li').getByText('My second new team').first(),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
14
src/frontend/apps/e2e/__tests__/app-desk/common.ts
Normal file
14
src/frontend/apps/e2e/__tests__/app-desk/common.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Page } from '@playwright/test';
|
||||||
|
|
||||||
|
export const keyCloakSignIn = async (page: Page) => {
|
||||||
|
const title = await page.locator('h1').first().textContent({
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (title?.includes('Sign in to your account')) {
|
||||||
|
await page.getByRole('textbox', { name: 'username' }).fill('user-e2e');
|
||||||
|
await page.getByRole('textbox', { name: 'password' }).fill('password-e2e');
|
||||||
|
|
||||||
|
await page.click('input[type="submit"]');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user