From ccfe56ae494c8ff8cf328932f64ce10829bc23ff Mon Sep 17 00:00:00 2001 From: Zakk Date: Sat, 26 Sep 2026 04:21:17 +1000 Subject: [PATCH] test(e2e): check scroll overflow and capability states on every route Both loops read the route list, so activity, policies and config join the overflow check and a new page is covered without editing the spec. --- e2e/capabilities.spec.ts | 10 ++++------ e2e/routes.spec.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/e2e/capabilities.spec.ts b/e2e/capabilities.spec.ts index a501158b..d6ae6a48 100644 --- a/e2e/capabilities.spec.ts +++ b/e2e/capabilities.spec.ts @@ -122,13 +122,11 @@ test.describe('first-release backend', () => { await expect(page.locator('.rp-strip')).toBeVisible(); await expect(page.locator('.rp-nav')).toHaveCount(routes.length); await expect(page.locator('.rp-nav:not([data-unavailable])')).toHaveText(['Overview', 'Activity', 'Connections', 'Settings']); - for (const route of ['overview', 'connections', 'settings'] as const) { - await page.goto(`/#/${route}`); - await expect(page.locator('.rp-nav[href="#/' + route + '"]')).toHaveAttribute('aria-current', 'page'); - await expect(page.locator('.rp-content')).toBeVisible(); - } - for (const route of routes.filter(r => !['activity', 'overview', 'connections', 'settings'].includes(r))) { + // Every page loads, the offered ones as the current navigation entry and the rest in their unavailable state. + const offeredPages: readonly string[] = ['activity', 'overview', 'connections', 'settings']; + for (const route of routes) { await page.goto(`/#/${route}`); + if (offeredPages.includes(route)) await expect(page.locator('.rp-nav[href="#/' + route + '"]')).toHaveAttribute('aria-current', 'page'); await expect(page.locator('.rp-content')).toBeVisible(); } await page.goto('/#/connections?tab=list'); diff --git a/e2e/routes.spec.ts b/e2e/routes.spec.ts index 6df9b62f..7fbf6614 100644 --- a/e2e/routes.spec.ts +++ b/e2e/routes.spec.ts @@ -1,4 +1,5 @@ -import {expect, isLive, offered, test} from './fixtures'; +import {expect, isLive, offered, routes, test} from './fixtures'; +import type {RoutePath} from '../src/shell/routes'; for (const width of [1024, 1280, 1440]) { test(`desktop tables fit their scrollports at ${width}px`, async ({page}) => { @@ -63,12 +64,14 @@ test('narrow tables retain readable columns and stop scrolling after a desktop r }); // A scroll container that overflows by a pixel grows a scrollbar; every palette family is held to zero overflow. +// Pages whose default tab holds no table are checked on the tab that does. +const tableTab: Partial> = {dns: 'cache', rules: 'list'}; for (const palette of ['glass/glass', 'rose-pine/moon', 'catppuccin/mocha']) { test.describe(`${palette} scroll containers`, () => { test.use({storage: {'doona-palette': palette}}); test('no scroll container overflows sideways without content that needs it', async ({page}) => { - for (const route of ['overview', 'connections', 'dns?tab=cache', 'rules?tab=list', 'nodes', 'events', 'logs', 'settings']) { - await page.goto(`/#/${route}`); + for (const route of routes) { + await page.goto(`/#/${route}${tableTab[route] ? `?tab=${tableTab[route]}` : ''}`); await expect(page.locator('.rp-content').getByRole('heading').first()).toBeVisible(); await page.waitForFunction(() => !document.querySelector('.rp-content .rp-empty[role=status]')); const spurious = await page.evaluate(() =>