test(nav): add E2E test for DocumentTopBar back navigation; fix auth.setup login label
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m38s
CI / OCR Service Tests (pull_request) Successful in 30s
CI / Backend Unit Tests (pull_request) Failing after 2m53s
CI / Unit & Component Tests (push) Failing after 2m36s
CI / OCR Service Tests (push) Successful in 34s
CI / Backend Unit Tests (push) Failing after 2m47s
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m38s
CI / OCR Service Tests (pull_request) Successful in 30s
CI / Backend Unit Tests (pull_request) Failing after 2m53s
CI / Unit & Component Tests (push) Failing after 2m36s
CI / OCR Service Tests (push) Successful in 34s
CI / Backend Unit Tests (push) Failing after 2m47s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #303.
This commit is contained in:
@@ -12,12 +12,12 @@ const authFile = path.join(__dirname, '.auth/user.json');
|
||||
* E2E_PASSWORD (default: admin123)
|
||||
*/
|
||||
setup('authenticate', async ({ page }) => {
|
||||
const username = process.env.E2E_USERNAME ?? 'admin';
|
||||
const username = process.env.E2E_USERNAME ?? 'admin@familyarchive.local';
|
||||
const password = process.env.E2E_PASSWORD ?? 'admin123';
|
||||
|
||||
await page.goto('/login');
|
||||
await page.getByLabel('Benutzername').fill(username);
|
||||
await page.getByLabel('Passwort').fill(password);
|
||||
await page.getByLabel(/e-mail/i).fill(username);
|
||||
await page.getByLabel(/passwort/i).fill(password);
|
||||
await page.getByRole('button', { name: 'Anmelden' }).click();
|
||||
await page.waitForURL('/');
|
||||
|
||||
|
||||
38
frontend/e2e/document-topbar-back.spec.ts
Normal file
38
frontend/e2e/document-topbar-back.spec.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('DocumentTopBar — back navigation', () => {
|
||||
test('BackButton returns to /documents after navigating from the documents list', async ({
|
||||
page
|
||||
}) => {
|
||||
// Navigate to home page first (mirrors the real user flow)
|
||||
await page.goto('/');
|
||||
await page.waitForSelector('[data-hydrated]');
|
||||
|
||||
// Click the Dokumente nav link (SPA navigation — pushes to history)
|
||||
await page.click('a[href="/documents"]');
|
||||
await page.waitForURL('/documents');
|
||||
await page.waitForSelector('[data-hydrated]');
|
||||
|
||||
// Click first real document link (skip /documents/new and edit links)
|
||||
const docLink = page.locator('a[href^="/documents/"]:not([href="/documents/new"])').first();
|
||||
const count = await docLink.count();
|
||||
|
||||
if (count === 0) {
|
||||
test.skip(true, 'No documents in test database');
|
||||
}
|
||||
|
||||
const docHref = await docLink.getAttribute('href');
|
||||
await docLink.click();
|
||||
await page.waitForURL(new RegExp(docHref!.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
||||
await page.waitForSelector('[data-hydrated]');
|
||||
|
||||
// Find and click the BackButton in the DocumentTopBar
|
||||
const backBtn = page.locator('[data-topbar]').getByRole('button', { name: /zurück/i });
|
||||
await expect(backBtn).toBeVisible();
|
||||
await backBtn.click();
|
||||
|
||||
// Should be back at the documents list, not at /
|
||||
await page.waitForURL(/\/documents($|\?)/);
|
||||
expect(page.url()).toMatch(/\/documents($|\?)/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user