From 14745b347d9bd4c5548cdc8912eaf86525fd1ba3 Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 5 May 2026 23:03:40 +0200 Subject: [PATCH] fix: update test workflow and improve smoke tests - Changed the artifact upload action in the CI workflow from v4 to v3 due to compatibility issues with Gitea. - Enhanced the smoke test for the clubs page to check the URL and visibility of the primary heading, ensuring more robust validation. - Updated session persistence test to verify the visibility of the dashboard heading after a page reload, improving test reliability. --- .gitea/workflows/test.yml | 3 ++- tests/dev-smoke-test.spec.js | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 14f1101..8101e74 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -205,7 +205,8 @@ jobs: - name: Upload test screenshots if: failure() - uses: actions/upload-artifact@v4 + # v4 ist auf Gitea (GHES-kompatibles Actions-Backend) oft nicht verfügbar + uses: actions/upload-artifact@v3 with: name: playwright-screenshots path: screenshots/ diff --git a/tests/dev-smoke-test.spec.js b/tests/dev-smoke-test.spec.js index c7c12e9..8a9eb0d 100644 --- a/tests/dev-smoke-test.spec.js +++ b/tests/dev-smoke-test.spec.js @@ -76,8 +76,12 @@ test('4. Navigation zu Vereine', async ({ page }) => { await page.locator('.bottom-nav a[href="/clubs"]').click(); await page.waitForLoadState('networkidle'); - // Prüfe ob Vereine-Seite geladen - await expect(page.locator('h1, h2, .page-title')).toContainText(/vereine|clubs/i, { timeout: 5000 }); + // ClubsPage:

Vereinsverwaltung

+ Tab

Vereine

→ ein kombinierter + // Selektor löst 2 Treffer aus (Playwright strict mode). URL + primäre Überschrift reichen. + await expect(page).toHaveURL(/\/clubs\/?$/, { timeout: 5000 }); + await expect(page.getByRole('heading', { level: 1, name: /Vereinsverwaltung/i })).toBeVisible({ + timeout: 5000, + }); await page.screenshot({ path: 'screenshots/04-vereine.png' }); console.log('✓ Vereine-Seite erreichbar'); @@ -115,15 +119,20 @@ test('7. Session-Persistenz nach Reload', async ({ page }) => { await login(page); await expect(page.locator('.spinner')).toHaveCount(0, { timeout: 10000 }); + await expect( + page.locator('.app-main').getByRole('heading', { level: 1, name: 'Dashboard' }), + ).toBeVisible({ timeout: 10000 }); await page.reload({ waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle'); // Auth lädt erst nach Spinner – nicht auf /login stranden (stabiler als Button „Login“-Tab auf Login-Screen) await expect(page.locator('.spinner')).toHaveCount(0, { timeout: 20000 }); - await expect(page).not.toHaveURL('**/login', { timeout: 20000 }); - await expect(page.locator('h1').filter({ hasText: /^Dashboard$/ })).toBeVisible({ - timeout: 10000, + await expect(page).not.toHaveURL(/\/login(?:\/|$|\?|#)/, { timeout: 20000 }); + await expect( + page.locator('.app-main').getByRole('heading', { level: 1, name: 'Dashboard' }), + ).toBeVisible({ + timeout: 20000, }); await page.screenshot({ path: 'screenshots/07-nach-reload.png' });