Skip to content

Commit f9be753

Browse files
committed
add e2e tests to publishing website
1 parent 980ae35 commit f9be753

4 files changed

Lines changed: 16 additions & 15 deletions

File tree

.github/actions/publish-website/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ runs:
5555
working-directory: ./webui
5656
run: npx playwright install --with-deps
5757
shell: bash
58+
- name: test website
59+
working-directory: ./webui
60+
run: npx playwright test --project=website
61+
shell: bash
5862
- name: prerender
5963
working-directory: ./webui/ssg
6064
run: node index.js

webui/e2e/header.website.spec.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import { test, expect } from './models/fixture-dashboard'
22

3-
test('header in dashboard', async ({ dashboard }) => {
4-
await dashboard.open()
3+
test('header in dashboard', async ({ page }) => {
4+
await page.goto('/home')
55

66
await test.step("navigation links", async () => {
7-
const links = dashboard.header.getNavLinks()
8-
await expect(links.nth(0)).toHaveText('Dashboard')
9-
await expect(links.nth(1)).toHaveText('Guides')
10-
await expect(links.nth(2)).toHaveText('Configuration')
11-
await expect(links.nth(3)).toHaveText('JavaScript API')
12-
await expect(links.nth(4)).toHaveText('Resources')
13-
await expect(links.nth(5)).toHaveText('References')
14-
})
15-
16-
await test.step('version number', async() => {
17-
await expect(dashboard.header.version).not.toBeVisible();
7+
const links = page.getByRole('banner').getByRole('navigation').getByRole('link');
8+
await expect(links.nth(0)).toHaveAccessibleDescription('Mokapi home')
9+
await expect(links.nth(1)).toHaveText('Dashboard')
10+
await expect(links.nth(2)).toHaveText('Guides')
11+
await expect(links.nth(3)).toHaveText('Configuration')
12+
await expect(links.nth(4)).toHaveText('JavaScript API')
13+
await expect(links.nth(5)).toHaveText('Resources')
14+
await expect(links.nth(6)).toHaveText('References')
1815
})
1916
})

webui/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const config: PlaywrightTestConfig = {
155155
* Use the preview server on CI for more realistic testing.
156156
Playwright will re-use the local server if there is already a dev-server running.
157157
*/
158-
command: process.env.CI ? 'vite preview --mode dashboard --port 5173' : 'vite dev',
158+
command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
159159
port: 5173,
160160
reuseExistingServer: !process.env.CI
161161
}

webui/src/components/Header.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function navigateAndClose(params: Record<string, string>) {
214214
</div>
215215
<nav class="navbar navbar-expand-lg">
216216
<div class="container-fluid">
217-
<a class="navbar-brand" href="./"><img src="/logo-header.svg" height="30" alt="Mokapi home"/></a>
217+
<a class="navbar-brand" href="./" title="Mokapi home"><img src="/logo-header.svg" height="30" alt="Mokapi home"/></a>
218218
<div class="d-flex ms-auto align-items-center tools d-none">
219219
<a href="https://github.com/marle3003/mokapi" class="version pe-2" v-if="appInfo?.data">v{{appInfo.data.version}}</a>
220220
<button class="btn icon" aria-label="Search" data-bs-toggle="modal" data-bs-target="#search-docs">

0 commit comments

Comments
 (0)