diff --git a/e2e/app.spec.ts b/e2e/app.spec.ts index 6dcf589..8900083 100644 --- a/e2e/app.spec.ts +++ b/e2e/app.spec.ts @@ -26,6 +26,15 @@ function toolText(payload: unknown): string { test.skip(!url, 'KOZOU_TEST_DATABASE_URL not set'); +/** Read through `getPropertyValue` rather than a camelCase field, and typed as + * the one method that is called. Both because this suite typechecks under the + * node tsconfig, which has no DOM globals - and because a hand-written record of + * camelCase fields makes the type authoritative over the real API: a misspelled + * or renamed field then reads `undefined`, and `undefined !== '0px'` is true, so + * the assertion passes forever. `getPropertyValue` answers '' for a property it + * does not know, which fails these comparisons instead of passing them. */ +type StyleReader = { getPropertyValue: (property: string) => string }; + test('two profiles: map, detail pane, and AI view end-to-end', async () => { const userData = mkdtempSync(join(tmpdir(), 'kozou-desktop-e2e-')); const app = await electron.launch({ @@ -182,12 +191,68 @@ test('two profiles: map, detail pane, and AI view end-to-end', async () => { await expect(page.getByTestId('overview-cards')).toHaveCount(0); await expect(page.getByTestId('rowaccess-badge-beta')).toHaveCount(1); + // The way to grant row access is a control, and on this surface it is a real + // one. Two attempts at the discoverability of this thing changed only the + // wording; it was a bare run of blue words beside a bordered status badge, with + // no border, background or padding of its own. Asserted as the box it now draws + // rather than as a class name, because a class says nothing about what is on + // screen. + const grant = page.getByTestId('rowaccess-enable-beta'); + const box = async (loc: typeof grant): Promise<{ tag: string; h: number; w: number; border: string; bg: string }> => + loc.evaluate((el) => { + const s = (globalThis as unknown as { getComputedStyle: (e: unknown) => StyleReader }) + .getComputedStyle(el); + const r = el.getBoundingClientRect(); + return { + tag: el.tagName, + h: Math.round(r.height), + w: Math.round(r.width), + border: s.getPropertyValue('border-top-color'), + bg: s.getPropertyValue('background-color'), + }; + }); + const barGrant = await box(grant); + // A real + {/if} + {/each} {/if}