ワンクリックで
create-e2e-test
Guide for writing Playwright E2E tests with the project's auth, helpers, and isolation patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Guide for writing Playwright E2E tests with the project's auth, helpers, and isolation patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
MANDATORY for any git commit, push, save, subir, or enviar request. Executes npm run git:sync as a single atomic command — zero exploration, zero loops. Enforces Conventional Commits format.
End-to-end guide for adding a new feature across all architectural layers (schema → repo → schema → DTO → route → hook → component → tests)
Comprehensive code review framework for pull requests and ad-hoc quality checks. Covers correctness, architecture compliance, security, performance, financial logic, testing, and style. Use when reviewing PRs, auditing changes, or checking code quality before merge.
Creates new Antigravity skills following the correct folder structure, frontmatter conventions, and best practices. Use when the user asks to create a new skill, document a repeating pattern, or extend the agent's capabilities for a specific task.
Diagnostic flowchart for debugging Ready to Assign (RTA) calculation discrepancies
Create distinctive, production-grade frontend interfaces with intentional aesthetics, high craft, and non-generic visual identity. Use when building or styling web UIs, components, pages, dashboards, or frontend applications.
| name | create-e2e-test |
| description | Guide for writing Playwright E2E tests with the project's auth, helpers, and isolation patterns |
Use this skill when adding a new Playwright E2E test spec. See examples/ for annotated reference tests.
| File | Purpose |
|---|---|
playwright.config.ts | Serial execution, 1 worker, port 3001, auth project |
tests/global-setup.ts | Creates fresh ynab_test DB, seeds CSV data, 2 users |
tests/auth.setup.ts | Logs in as TEST_USER, saves session to .auth/user.json |
tests/test-constants.ts | Credentials, URLs, DB names |
tests/e2e-helpers.ts | Navigation helpers |
tests/i18n-helpers.ts | Locale-aware t() translation helper |
tests/<feature-name>.spec.ts
Use the template from examples/example.spec.ts.
All E2E tests MUST use the t() helper for any user-facing text. Never hardcode strings.
import { t, TEST_LOCALE } from "./i18n-helpers";
For specs that manage their own auth (no storageState), pin the test locale cookie:
test.beforeEach(async ({ page }) => {
await page.context().addCookies([
{
name: "NEXT_LOCALE",
value: TEST_LOCALE,
domain: "localhost",
path: "/",
},
]);
});
import {
gotoBudgetPage,
gotoFirstAccount,
getTestBudgetId,
} from "./e2e-helpers";
| Helper | What it does |
|---|---|
gotoBudgetPage(page, request) | Navigate + wait for budget-table, returns budgetId |
gotoFirstAccount(page, request) | Navigate + click first sidebar account |
getTestBudgetId(request) | Fetch budgetId via API (cached) |
budgetUrl(budgetId) | Returns /budgets/{id}/budget |
accountUrl(budgetId, accountId) | Returns /budgets/{id}/accounts/{accountId} |
allAccountsUrl(budgetId) | Returns /budgets/{id}/accounts |
Never hardcode URLs — SaaS routes use /budgets/[id]/budget, not /budget.
data-testid and t() selectors// ✅ CORRECT — locale-independent
page.getByLabel(t("auth.email")).fill("user@test.com");
page.getByRole("button", { name: t("auth.login") }).click();
page.getByTestId("rta-amount");
page.locator('[data-testid^="category-row-"]');
// ❌ WRONG — hardcoded strings break when locale changes
page.getByLabel("Email").fill("user@test.com");
page.getByRole("button", { name: /Iniciar Sesión/i }).click();
await page.getByTestId("save-button").click();
await page.waitForResponse(
(resp) => resp.url().includes("/api/budgets/") && resp.status() === 200,
);
await expect(page.getByTestId("value")).toHaveText("Updated");
npm run test:e2e # full suite
npm run test:e2e -- tests/my-feature.spec.ts # single file
npm run test:e2e -- --ui # debug UI
auth.setup.ts runs first, all specs use TEST_USER sessionTEST_LOCALE=en npx playwright test to run tests in English| Pitfall | Fix |
|---|---|
| Hardcoded UI strings | Use t('key') from i18n-helpers.ts — never hardcode labels or button text |
| Wrong URL | Use helpers, not page.goto('/budget') |
| Intermittent assertion failure | Wait for server roundtrip before asserting |
RTA shows $ 0,00 | Poll for animated value stability |
| Login fails | Ensure locale cookie is set; use t('auth.*') for selectors |
storageState not found | auth-setup project runs as dependency (configured in playwright.config.ts) |
The check-locale-strings.sh CI guard script scans all tests/*.spec.ts files for hardcoded Spanish strings and fails the build if found. Always use t().
| File | Pattern |
|---|---|
| example.spec.ts | Standard test with navigation, mutation, animated values |
| isolation.spec.ts | Tenant isolation with manual login + locale cookie |