The brief asked for these under Definition of done and they were never written. 610 Go tests, none of which opens a browser. Six flows: create the first account and sign in, quick add and tick a task off, click every link in the sidebar, open a task and edit it, walk every settings tab, and check that the manifest's icons and the service worker can actually be fetched. Every assertion is on rendered content rather than on a URL — the binary serves the SPA shell for anything it does not recognise, so toHaveURL passes on precisely the bug this exists to catch. The suite builds the frontend, copies it into cmd/verdande/webbuild and starts the real binary, every run. Merely starting the server would test whatever frontend was copied there last, which during development is nearly always the wrong one, and a green report on code that is not running is worse than no report. Chromium only. A smoke test catches a build that does not work at all; running it in three engines finds the same breakage three times. They found four bugs the first time they ran, fixed in the commits before this one: concurrent writes returning SQLITE_BUSY, a completed task keeping its row, the same task landing in the list twice, and a database failure presenting as everybody being logged out. Co-Authored-By: Claude Opus 5 <[email protected]>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
import { test as setup, expect } from '@playwright/test';
|
|
|
|
/**
|
|
* Creates the first account and saves the session for every other test.
|
|
*
|
|
* This is also the sign-in smoke test: if the bootstrap form, the session cookie
|
|
* or the app shell is broken, nothing below runs and the failure names this file.
|
|
*/
|
|
|
|
export const USER = {
|
|
name: 'Kristian',
|
|
email: '[email protected]',
|
|
password: 'et langt kodeord til test'
|
|
};
|
|
|
|
const AUTH_FILE = 'e2e/.auth/user.json';
|
|
|
|
setup('opret den første konto og log ind', async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
await expect(page.getByText('Opret den første konto')).toBeVisible();
|
|
|
|
// Regexes, not exact strings: the password label carries a hint beside it, so
|
|
// its accessible name is the label plus that sentence.
|
|
await page.getByLabel(/Navn/).fill(USER.name);
|
|
await page.getByLabel(/E-mail/).fill(USER.email);
|
|
await page.getByLabel(/Adgangskode/).fill(USER.password);
|
|
await page.getByRole('button', { name: 'Opret konto' }).click();
|
|
|
|
// The shell, not just a redirect: a 200 that renders nothing would pass a
|
|
// URL assertion and fail a person.
|
|
await expect(page.getByRole('navigation', { name: 'Hovedmenu' })).toBeVisible();
|
|
await expect(page.getByRole('heading', { name: 'I dag' })).toBeVisible();
|
|
|
|
await page.context().storageState({ path: AUTH_FILE });
|
|
});
|