diff options
| author | Marcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de> | 2025-02-27 19:05:15 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2025-02-27 19:05:15 +0000 |
| commit | e2039929ab5244abc152cbccfc11f4e6747a6929 (patch) | |
| tree | a1ede058bbed766f703caf7f0d9ceefc2a60a1f7 /tests | |
| parent | cf7b69c155bbaa5df93188a453df39e1b6ee96ab (diff) | |
Fix non-a11y playwright tests.
Merge request studip/studip!3925
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/e2e/auth.setup.ts | 2 | ||||
| -rw-r--r-- | tests/e2e/login.spec.ts | 19 | ||||
| -rw-r--r-- | tests/e2e/logout.spec.ts | 6 | ||||
| -rw-r--r-- | tests/e2e/user-courseware.spec.js | 14 |
4 files changed, 14 insertions, 27 deletions
diff --git a/tests/e2e/auth.setup.ts b/tests/e2e/auth.setup.ts index c690f3a..053ae97 100644 --- a/tests/e2e/auth.setup.ts +++ b/tests/e2e/auth.setup.ts @@ -38,5 +38,5 @@ async function login(page, { username, password }) { await page.getByLabel(/Benutzername/i).fill(username); await page.getByLabel(/Passwort/i).fill(password); await page.getByRole('button', { name: 'Anmelden' }).click(); - await expect(page.locator('#avatar-menu-container')).toBeVisible(); + await expect(page.locator('#avatar-menu')).toBeVisible(); } diff --git a/tests/e2e/login.spec.ts b/tests/e2e/login.spec.ts index f646272..e05cb7a 100644 --- a/tests/e2e/login.spec.ts +++ b/tests/e2e/login.spec.ts @@ -2,16 +2,10 @@ import { test, expect } from '@playwright/test'; import { credentials } from './credentials.ts'; test.describe('Loggin In - HTML Web Form @auth', () => { - test.describe('Coming from homepage', () => { + test.describe('Visiting the homepage', () => { test('should take us to the login form @smoke', async ({ page, baseURL }) => { await page.goto(''); - await expect(page.locator('#loginbox')).toBeVisible(); - - const loginLink = page.getByRole('link', { name: 'Login für registrierte Nutzende' }); - await expect(loginLink).toBeVisible(); - await loginLink.click(); - const benutzername = page.getByLabel(/Benutzername/i); await expect(benutzername).toBeVisible(); await expect(benutzername).toBeEditable(); @@ -22,12 +16,12 @@ test.describe('Loggin In - HTML Web Form @auth', () => { }); }); - test.describe('Unauthorized', () => { + test.describe('Unauthorized access', () => { test('redirects to the login form @smoke', async ({ page }) => { await page.goto('dispatch.php/start'); await expect(page.getByLabel(/Passwort/)).toBeVisible(); - await expect(page.locator('#avatar-menu-container')).not.toBeVisible(); + await expect(page.locator('#avatar-menu')).not.toBeVisible(); }); }); @@ -44,7 +38,7 @@ test.describe('Loggin In - HTML Web Form @auth', () => { await benutzername.fill('username'); await passwort.fill('password'); await submit.click(); - await expect(page.locator('css=.messagebox_error')).toBeVisible(); + await expect(page.locator('css=.system-notification-exception')).toBeVisible(); }); test('redirects to start page', async ({ page, baseURL }) => { @@ -55,8 +49,9 @@ test.describe('Loggin In - HTML Web Form @auth', () => { await benutzername.fill(credentials.autor.username); await passwort.fill(credentials.autor.password); await submit.click(); - await expect(page.locator('#notification-wrapper')).toBeVisible(); - await expect(page).toHaveURL(`${baseURL}dispatch.php/start`); + await page.getByLabel('Profilmenü').click(); + await page.getByText('Logout').click(); + await expect(page).toHaveURL(`${baseURL}/dispatch.php/login`); }); }); }); diff --git a/tests/e2e/logout.spec.ts b/tests/e2e/logout.spec.ts index f969df9..12534ff 100644 --- a/tests/e2e/logout.spec.ts +++ b/tests/e2e/logout.spec.ts @@ -8,8 +8,8 @@ test.describe('Logging Out', () => { test('should take us back to the homepage', async ({ page, baseURL }) => { await page.goto(baseURL); await expect(page.locator('#notification-wrapper')).toBeVisible(); - await page.getByTitle('Testaccount Dozent').click(); - await page.getByRole('link', { name: 'Logout' }).click(); - await expect(page).toHaveURL(/index\.php.*logout=true/); + await page.getByLabel('Profilmenü').click(); + await page.getByText('Logout').click(); + await expect(page).toHaveURL(/dispatch\.php\/login/); }); }); diff --git a/tests/e2e/user-courseware.spec.js b/tests/e2e/user-courseware.spec.js index 5fc220d..724b31c 100644 --- a/tests/e2e/user-courseware.spec.js +++ b/tests/e2e/user-courseware.spec.js @@ -6,20 +6,12 @@ test.describe('Visiting my Arbeitsplatz @autor @courseware', () => { test.use({ storageState: autorFile }); test('should let us create a new Lernmaterial', async ({ page }) => { - await page.goto('dispatch.php/start'); - await page.getByRole('link', { name: /Courseware Erstellen/ }).click(); + await page.goto('dispatch.php/contents/courseware/index'); await page.getByRole('button', { name: 'Lernmaterial hinzufügen' }).click(); - await page.getByLabel('Titel des Lernmaterials*').click(); + await page.getByRole('button', { name: 'Neu erstellen' }).click(); await page.getByLabel('Titel des Lernmaterials*').fill('Ein Titel'); - await page.getByLabel('Titel des Lernmaterials*').press('Tab'); await page.getByLabel('Beschreibung*').fill('Eine Beschreibung'); - await page.getByRole('tab', { name: 'Erscheinung' }).click(); - await page - .getByRole('combobox', { name: 'Search for option' }) - .locator('div') - .filter({ hasText: 'Blau' }) - .click(); - await page.getByRole('button', { name: 'Erstellen' }).click(); + await page.getByRole('button', { name: 'Erstellen', exact: true }).click(); const lernmaterial = await page.getByRole('link', { name: 'Ein Titel Eine Beschreibung' }).last(); await expect(lernmaterial).toBeVisible(); }); |
