From f9be7539f8b107aaa436de2506f4ef775ed700e1 Mon Sep 17 00:00:00 2001 From: maesi Date: Sat, 3 Jan 2026 22:21:01 +0100 Subject: [PATCH 01/78] add e2e tests to publishing website --- .github/actions/publish-website/action.yml | 4 ++++ webui/e2e/header.website.spec.ts | 23 ++++++++++------------ webui/playwright.config.ts | 2 +- webui/src/components/Header.vue | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/actions/publish-website/action.yml b/.github/actions/publish-website/action.yml index 23670c658..ad7a66ab1 100644 --- a/.github/actions/publish-website/action.yml +++ b/.github/actions/publish-website/action.yml @@ -55,6 +55,10 @@ runs: working-directory: ./webui run: npx playwright install --with-deps shell: bash + - name: test website + working-directory: ./webui + run: npx playwright test --project=website + shell: bash - name: prerender working-directory: ./webui/ssg run: node index.js diff --git a/webui/e2e/header.website.spec.ts b/webui/e2e/header.website.spec.ts index 5c47b8107..9115af3c4 100644 --- a/webui/e2e/header.website.spec.ts +++ b/webui/e2e/header.website.spec.ts @@ -1,19 +1,16 @@ import { test, expect } from './models/fixture-dashboard' -test('header in dashboard', async ({ dashboard }) => { - await dashboard.open() +test('header in dashboard', async ({ page }) => { + await page.goto('/home') await test.step("navigation links", async () => { - const links = dashboard.header.getNavLinks() - await expect(links.nth(0)).toHaveText('Dashboard') - await expect(links.nth(1)).toHaveText('Guides') - await expect(links.nth(2)).toHaveText('Configuration') - await expect(links.nth(3)).toHaveText('JavaScript API') - await expect(links.nth(4)).toHaveText('Resources') - await expect(links.nth(5)).toHaveText('References') - }) - - await test.step('version number', async() => { - await expect(dashboard.header.version).not.toBeVisible(); + const links = page.getByRole('banner').getByRole('navigation').getByRole('link'); + await expect(links.nth(0)).toHaveAccessibleDescription('Mokapi home') + await expect(links.nth(1)).toHaveText('Dashboard') + await expect(links.nth(2)).toHaveText('Guides') + await expect(links.nth(3)).toHaveText('Configuration') + await expect(links.nth(4)).toHaveText('JavaScript API') + await expect(links.nth(5)).toHaveText('Resources') + await expect(links.nth(6)).toHaveText('References') }) }) \ No newline at end of file diff --git a/webui/playwright.config.ts b/webui/playwright.config.ts index cef9e554e..6158261f9 100644 --- a/webui/playwright.config.ts +++ b/webui/playwright.config.ts @@ -155,7 +155,7 @@ const config: PlaywrightTestConfig = { * Use the preview server on CI for more realistic testing. Playwright will re-use the local server if there is already a dev-server running. */ - command: process.env.CI ? 'vite preview --mode dashboard --port 5173' : 'vite dev', + command: process.env.CI ? 'vite preview --port 5173' : 'vite dev', port: 5173, reuseExistingServer: !process.env.CI } diff --git a/webui/src/components/Header.vue b/webui/src/components/Header.vue index 4d6efb0cf..bd5e5b029 100644 --- a/webui/src/components/Header.vue +++ b/webui/src/components/Header.vue @@ -214,7 +214,7 @@ function navigateAndClose(params: Record) {