kammer/e2e/support/fixtures.ts
Christopher Mühl 307ef24b78 test: E2E test suite + handoff documentation
50 Playwright E2E tests across 13 spec files covering all routes and
user flows (items CRUD, check-out/in, locations, labels, scanning,
search/filter). Uses vitest as runner with playwright-core for browser
automation (bun-compatible alternative to @playwright/test).

Includes Gherkin .feature files as living documentation, test support
infrastructure (IDB seeding, item factories, assertion helpers, layout
measurement), and HANDOFF.md covering project state, deployment, and
open design decisions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:53:08 +01:00

31 lines
986 B
TypeScript

import { test as base } from 'playwright-bdd';
import { waitForAppReady, seedItems, seedAndNavigate } from './seed';
import { assertMinTouchTarget, assertGapBetween, assertWithinViewport } from './layout';
import type { Item } from '../../src/lib/types';
export const test = base.extend<{
appReady: void;
seedData: (items: Item[], path?: string) => Promise<void>;
layout: {
assertMinTouchTarget: typeof assertMinTouchTarget;
assertGapBetween: typeof assertGapBetween;
assertWithinViewport: typeof assertWithinViewport;
};
}>({
appReady: [async ({ page }, use) => {
await page.goto('/');
await waitForAppReady(page);
await use();
}, { auto: false }],
seedData: async ({ page }, use) => {
const seed = async (items: Item[], path = '/') => {
await seedAndNavigate(page, items, path);
};
await use(seed);
},
layout: async ({}, use) => {
await use({ assertMinTouchTarget, assertGapBetween, assertWithinViewport });
},
});