|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: 2026 Conduction B.V. |
| 3 | + * SPDX-License-Identifier: EUPL-1.2 |
| 4 | + * |
| 5 | + * The bottom-left app chrome, in a browser (ADR-114). |
| 6 | + * |
| 7 | + * gate-107 reads the manifest and can prove the entries are DECLARED. It |
| 8 | + * cannot prove they RENDER, and this programme has produced three defects of |
| 9 | + * exactly that shape: an unregistered icon name renders NO glyph (no fallback, |
| 10 | + * no console error — ChartBoxOutline had to be added to src/icons.js for this |
| 11 | + * very entry), an entry whose `route` names a page the app does not host |
| 12 | + * renders a row that goes nowhere, and `nav.includePersonalSettings: false` |
| 13 | + * silently removed the entry reaching the user's notification preferences in |
| 14 | + * two apps. |
| 15 | + * |
| 16 | + * ⚠️ SCOPE EVERY SELECTOR TO `[data-testid="cn-nav"]`. An unscoped selector |
| 17 | + * also matches Nextcloud's own user menu, which is attached-but-hidden: |
| 18 | + * `waitFor({state:'attached'})` passes on it and the click never becomes |
| 19 | + * actionable, so the spec fails with "Target page has been closed" — a timeout |
| 20 | + * wearing a crash's clothes. |
| 21 | + * |
| 22 | + * ⚠️ SETTINGS ENTRIES ARE ATTACHED, NOT VISIBLE, inside a collapsed foldout. |
| 23 | + * |
| 24 | + * The config supplies `use.storageState`, so specs start signed in. |
| 25 | + */ |
| 26 | + |
| 27 | +import { expect, test } from '@playwright/test' |
| 28 | + |
| 29 | +const APP_BASE = '/index.php/apps/hermiq' |
| 30 | + |
| 31 | +test.describe('app chrome (ADR-114)', () => { |
| 32 | + test.beforeEach(async ({ page }) => { |
| 33 | + await page.goto(`${APP_BASE}/`, { waitUntil: 'domcontentloaded' }) |
| 34 | + await expect(page.locator('[data-testid="cn-nav"]')).toBeVisible({ |
| 35 | + timeout: 30_000, |
| 36 | + }) |
| 37 | + }) |
| 38 | + |
| 39 | + test('the footer reads Documentation, Store, Reports, Features & roadmap, each with a glyph', async ({ |
| 40 | + page, |
| 41 | + }) => { |
| 42 | + const footer = page.locator( |
| 43 | + '[data-testid="cn-nav"] .cn-app-nav__footer-list', |
| 44 | + ) |
| 45 | + await expect(footer).toBeAttached({ timeout: 15_000 }) |
| 46 | + |
| 47 | + const rows = footer.locator('li') |
| 48 | + const texts = (await rows.allInnerTexts()) |
| 49 | + .map((t) => t.trim()) |
| 50 | + .filter(Boolean) |
| 51 | + |
| 52 | + // Hermiq is one of only four apps that had a Store before this |
| 53 | + // programme, so its footer carries all four declared chrome items. |
| 54 | + // ORDER is the rule, not the numbers. |
| 55 | + const seen = texts.filter((t) => |
| 56 | + /Documentation|Store|Reports|roadmap/i.test(t), |
| 57 | + ) |
| 58 | + expect(seen.length).toBe(4) |
| 59 | + expect(seen[0]).toMatch(/Documentation/i) |
| 60 | + expect(seen[1]).toMatch(/Store/i) |
| 61 | + expect(seen[2]).toMatch(/Reports/i) |
| 62 | + expect(seen[3]).toMatch(/roadmap/i) |
| 63 | + |
| 64 | + for (const row of await rows.all()) { |
| 65 | + await expect( |
| 66 | + row.locator('svg, .material-design-icon').first(), |
| 67 | + ).toBeAttached() |
| 68 | + } |
| 69 | + }) |
| 70 | + |
| 71 | + test('AI oversight is a card on Reports, not a settings entry', async ({ |
| 72 | + page, |
| 73 | + }) => { |
| 74 | + const nav = page.locator('[data-testid="cn-nav"]') |
| 75 | + |
| 76 | + // It sat in the SETTINGS foldout, which is where configuration belongs |
| 77 | + // (ADR-044 Decision 3). Oversight is not configuration — it is a reading |
| 78 | + // of what the agents did. |
| 79 | + await expect( |
| 80 | + nav.locator('[data-testid="cn-nav-entry-AiOversightMenu"]'), |
| 81 | + ).toHaveCount(0) |
| 82 | + |
| 83 | + await nav.locator('[data-testid="cn-nav-entry-ReportsMenu"]').click() |
| 84 | + await expect(page).toHaveURL(/\/apps\/hermiq\/reports(\?|$)/, { |
| 85 | + timeout: 15_000, |
| 86 | + }) |
| 87 | + await expect( |
| 88 | + page.getByText('AI oversight', { exact: false }).first(), |
| 89 | + ).toBeVisible({ timeout: 15_000 }) |
| 90 | + }) |
| 91 | + |
| 92 | + test('the AI oversight page is still routable, because another app deep-links it', async ({ |
| 93 | + page, |
| 94 | + }) => { |
| 95 | + // dossiq declares /apps/hermiq/ai-oversight as an ADR-110 integrations |
| 96 | + // entry. Retiring the menu entry must not take the ROUTE with it, or |
| 97 | + // that link 404s from another app (ADR-044 Decision 5). |
| 98 | + await page.goto(`${APP_BASE}/ai-oversight`) |
| 99 | + await expect(page).toHaveURL(/\/ai-oversight(\?|$)/, { timeout: 15_000 }) |
| 100 | + await expect(page.locator('[data-testid="cn-nav"]')).toBeVisible() |
| 101 | + }) |
| 102 | + |
| 103 | + test('guardrails, the algorithm register and compliance stay in the foldout', async ({ |
| 104 | + page, |
| 105 | + }) => { |
| 106 | + // Deliberate asymmetry with AI oversight: these ARE configuration, so |
| 107 | + // ADR-044 Decision 3 keeps them where they are. A later sweep that cards |
| 108 | + // them fails here rather than passing review. |
| 109 | + const nav = page.locator('[data-testid="cn-nav"]') |
| 110 | + for (const id of ['GuardrailPolicy', 'AlgorithmRegister', 'Compliance']) { |
| 111 | + await expect( |
| 112 | + nav.locator(`[data-testid="cn-nav-entry-${id}"]`), |
| 113 | + ).toBeAttached({ timeout: 15_000 }) |
| 114 | + } |
| 115 | + }) |
| 116 | + |
| 117 | + test('the settings foldout carries Personal settings, Admin settings and Flows', async ({ |
| 118 | + page, |
| 119 | + }) => { |
| 120 | + const nav = page.locator('[data-testid="cn-nav"]') |
| 121 | + |
| 122 | + await expect(nav.locator('[data-testid="cn-nav-settings"]')).toBeAttached({ |
| 123 | + timeout: 15_000, |
| 124 | + }) |
| 125 | + await expect( |
| 126 | + nav.locator('[data-testid="cn-nav-personal-settings"]'), |
| 127 | + ).toBeAttached() |
| 128 | + await expect( |
| 129 | + nav.locator('[data-testid="cn-nav-entry-FlowIndex"]'), |
| 130 | + ).toBeAttached() |
| 131 | + |
| 132 | + const admin = nav.locator('[data-testid="cn-nav-admin-settings"]') |
| 133 | + await expect(admin).toBeAttached() |
| 134 | + await expect(admin).toHaveAttribute('href', /\/settings\/admin\/hermiq$/) |
| 135 | + }) |
| 136 | +}) |
0 commit comments