Fantasia testing

From vishiri/fantasia-archive · View interactive version

Fantasia testing is an AI agent skill from the GitHub repository vishiri/fantasia-archive. Runs and extends Fantasia Archive tests: Vitest unit tests vs Playwright component and E2E tests, including rebuild-before-Playwright rules and file naming. Use when writing tests, debugging CI, or when the user mentions Vitest, Playwright, component tests, or e2e.

How to use this skill

Skill file

Fantasia Archive — testing

Cursor rules (detailed structure)

Match existing tests when adding or editing:

Connected tests for any feature change

Tests = same deliverable as production edits.

  1. Discover — ripgrep component/dialog folder, helpers, data-test-locator, T_dialogName, COMPONENT_NAME, action/keybind ids, store symbols, i18n keys you changed. Follow imports + menu _data/ entries.
  2. Vitest — yarn vitest run with explicit paths for every matching *.vitest.test.ts (feature _tests/, scripts/_tests/, src/scripts/**/_tests, src/stores/_tests, src-electron/**/_tests, helpers/**/_tests, i18n/_tests when implicated). During edits: fantasia-dev-scoped-verify. Before commit / final cleanup: yarn testbatch:verify.
  3. Playwright (component) — each matching src/**/_tests/*.playwright.test.ts: yarn test:components:single --component=<bucket>/<ComponentFolder> or yarn test:components in own terminal after yarn quasar:build:electron when bundle exercises changed renderer code (testing-terminal-isolation.mdc).
  4. Playwright (E2E) — each matching e2e-tests/*.playwright.spec.ts: yarn test:e2e:single --spec=… or yarn test:e2e with same rebuild rule.

CI scope: default Verify workflow runs yarn testbatch:verify only — not component/E2E Playwright. Run locally (or yarn testbatch:ensure:nochange) when feature touches those flows.

Vitest coverage tiers (CI)

See vitest-tests.mdc Vitest coverage tiers (CI): per instrumented file (thresholds.perFile: true) — 95% statements/lines, 80% branches, 100% functions on src-electron, helpers/**/*.ts (helpers/playwrightHelpers_* excluded), unit-src-renderer src .ts, scoped i18n/ (unit-i18n), and unit-components .ts / .vue under src/components, src/layouts, src/pages (src/components/foundation/** excluded). Configs: **vitest/**.

Unit tests (Vitest)

Playwright (component + E2E)

Critical: Playwright targets built, production Electron app. After any source change affecting exercised code: quasar build -m electron or yarn quasar:build:electron before Playwright. Node.js 22.22.0+ locally.

Stale packaged bundle — Harness starts Fantasia Archive.exe from dist/electron/Packaged, not live Vite dev server. IPC still matching pre-change behavior → rebuild before next Playwright run.

Electron userData isolation: TEST_ENV components / e2e → %APPDATA%/<package.json name>/playwright-user-data (here: fantasia-archive/playwright-user-data, not fantasia-archive-dev). CODE7, CODE8, CODE9. Specs use test.describe.serial; test.beforeAll awaits launchFaPlaywrightComponentHarnessWindow / launchFaPlaywrightE2eAppWindow (owns resetFaPlaywrightIsolatedUserData() ordering — not in test.beforeEach). Helpers: helpers/playwrightHelpers_universal / _e2e / _component. No test.describe.parallel unless user asks.

Playwright `keyboard.press` and app keybinds (cross-OS)

Cross-toolchain (Storybook + Electron)

Config highlights (`playwright.config.ts`)

Videos and HTML report

Component tests

E2E tests

Full project gate

Checklist when changing UI or Electron shell

During edits (fantasia-dev-scoped-verify):

  1. Dev scoped gate — touched eslint, yarn lint:typescript, connected yarn vitest run
  2. 20s dev compile smoke — dev-electron-compile-check.mdc

Ship / commit / final cleanup:

  1. yarn testbatch:verify — one terminal
  2. Connected Playwright after yarn quasar:build:electron — own terminals
  3. Storybook in scope: yarn test:storybook:smoke + yarn test:storybook:visual (or testbatch:ensure:*)

Choosing Vitest vs Playwright

Storybook smoke checks

Types

Shared types → types/ (app/types/...). See types-folder.mdc.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.