Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions tests/e2e/app-chrome.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,39 @@
* The config supplies `use.storageState`, so specs start signed in.
*/

import type { Page } from '@playwright/test'

import { expect, test } from '@playwright/test'

const APP_BASE = '/index.php/apps/hermiq'

/**
* Dismiss the first-run setup wizard if it is open.
*
* ⚠️ On a FRESH instance CnSetupWizard opens over the app and its modal
* intercepts pointer events, so every nav click resolves its locator and then
* times out after 30s — a failure that reads like the navigation is broken.
* Tests that navigate by URL pass, which is what makes this so easy to miss:
* only the click-through tests fail, and only on a clean install.
*
* @param page The page.
*/
async function dismissSetupWizard(page: Page): Promise<void> {
const modal = page.locator('[data-testid="cn-modal"]')
if ((await modal.count()) === 0) {
return
}
await modal.first().getByRole('button', { name: 'Close' }).click()
await expect(modal).toHaveCount(0, { timeout: 15_000 })
}

test.describe('app chrome (ADR-114)', () => {
test.beforeEach(async ({ page }) => {
await page.goto(`${APP_BASE}/`, { waitUntil: 'domcontentloaded' })
await expect(page.locator('[data-testid="cn-nav"]')).toBeVisible({
timeout: 30_000,
})
await dismissSetupWizard(page)
})

test('the footer reads Documentation, Store, Reports, Features & roadmap, each with a glyph', async ({
Expand Down Expand Up @@ -80,7 +103,10 @@ test.describe('app chrome (ADR-114)', () => {
nav.locator('[data-testid="cn-nav-entry-AiOversightMenu"]'),
).toHaveCount(0)

await nav.locator('[data-testid="cn-nav-entry-ReportsMenu"]').click()
await nav
.locator('[data-testid="cn-nav-entry-ReportsMenu"] a')
.first()
.click()
await expect(page).toHaveURL(/\/apps\/hermiq\/reports(\?|$)/, {
timeout: 15_000,
})
Expand Down Expand Up @@ -131,6 +157,9 @@ test.describe('app chrome (ADR-114)', () => {

const admin = nav.locator('[data-testid="cn-nav-admin-settings"]')
await expect(admin).toBeAttached()
await expect(admin).toHaveAttribute('href', /\/settings\/admin\/hermiq$/)
await expect(admin.locator('a').first()).toHaveAttribute(
'href',
/\/settings\/admin\/hermiq$/,
)
})
})
Loading