mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-14 17:42:17 +00:00
de39dc78ea
Splits testing into five layers so a failure points at the responsible one: - tests/unit isolated utility, repository and service tests - tests/data validates the tracked Pokémon, game, region and dex files - tests/integration schema, views, constraints, RLS and repositories - tests/bdd executable Gherkin for user-visible behaviour - tests/build service worker and manifest artifacts per build variant Replaces the two Playwright specs in client-test/ and the two Vitest files in test/. Adds a GitHub Actions workflow running the layers as separate jobs, a mock OAuth provider server so the Drive and Dropbox scenarios never touch real accounts, and a wrapper that reads the local Supabase keys from `supabase status` rather than hard-coding them. Extracts the pure formatting helpers out of PokedexExportService so they can be unit tested, and makes the provider endpoints configurable so the mock server can stand in for Google and Dropbox.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { test as base } from 'playwright-bdd';
|
|
|
|
export type ScenarioState = {
|
|
email: string;
|
|
password: string;
|
|
replacementPassword: string;
|
|
userId: string | null;
|
|
pokedexId: string | null;
|
|
pokedexName: string | null;
|
|
entries: Array<{ pokemon: string; form: string | null; num: number; id: string }>;
|
|
lastResponseStatus: number | null;
|
|
lastMessage: string | null;
|
|
};
|
|
|
|
type Fixtures = { state: ScenarioState };
|
|
|
|
export const test = base.extend<Fixtures>({
|
|
// Playwright fixture callbacks require the dependency object even when this fixture has none.
|
|
// eslint-disable-next-line no-empty-pattern
|
|
state: async ({}, use, testInfo) => {
|
|
const slug = testInfo.testId
|
|
.replace(/[^a-z0-9]/gi, '')
|
|
.slice(-18)
|
|
.toLowerCase();
|
|
await use({
|
|
email: `bdd-${slug}-${Date.now()}@example.test`,
|
|
password: 'BddPassword123!',
|
|
replacementPassword: 'BddReplacement456!',
|
|
userId: null,
|
|
pokedexId: null,
|
|
pokedexName: null,
|
|
entries: [],
|
|
lastResponseStatus: null,
|
|
lastMessage: null
|
|
});
|
|
}
|
|
});
|
|
|
|
export { expect } from '@playwright/test';
|