create-e2e-test
Create end-to-end tests using Playwright with page objects and fixtures following project conventions. Use when the user asks to add e2e tests for a feature…
от incubateur-ademe★ 45 звёзд на GitHub
Установить create-e2e-test в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Create E2E Test
Create end-to-end tests for the user flow described below.
Instructions
1. Understand the User Flow
First, analyze the User Flow to identify:
- Entry point: Which page/route does the flow start from?
- Steps: What user actions are involved (clicks, form fills, navigation)?
- Assertions: What should be verified at each step or at the end?
- Prerequisites: Does the user need to be authenticated? Any setup data needed?
2. Explore Existing Patterns
Before writing code, explore relevant existing files:
apps/e2e-tests/
├── pages/ # Page Objects - check for reusable pages
├── fixtures/ # Base fixtures (auth.fixtures.ts)
└── tests/
└── [feature]/ # Existing test patterns
├── [feature].fixtures.ts
└── [feature].spec.ts
Key files to reference:
apps/e2e-tests/fixtures/auth.fixtures.ts- Authentication fixturesapps/e2e-tests/pages/SiteCreationPage.ts- Page object pattern exampleapps/e2e-tests/tests/site-creation/site-creation.fixtures.ts- Fixture composition example
3. Create/Update Page Objects
For each page/screen in the flow, create or update a page object in apps/e2e-tests/pages/:
Page Object Pattern:
import { expect, type Page } from "@playwright/test";
export class FeaturePage {
readonly page: Page;
constructor(page: Page) {
this.page = page;
}
// Navigation
async goto(): Promise<void> {
await this.page.goto("/route-path");
}
// Assertions (prefix with expect*)
async expectStepVisible(): Promise<void> {
await expect(this.page.getByRole("heading", { name: "Step Title" })).toBeVisible();
}
// User Actions (verb-based names)
async clickButton(): Promise<void> {
await this.page.getByRole("button", { name: "Button Text" }).click();
}
async fillInput(value: string): Promise<void> {
await this.page.getByLabel("Input Label").fill(value);
}
async selectOption(value: string): Promise<void> {
await this.page.getByRole("radio", { name: value }).check({ force: true });
await this.submit();
}
// Private helpers
private async submit(): Promise<void> {
await this.page.getByRole("button", { name: /Valider|Suivant/ }).click();
}
}
Multi-step wizards: assert each step's title as you walk through it (expectStepTitle(title) — see apps/e2e-tests/pages/PhotovoltaicProjectCreationPage.ts for the pattern). Find each title's exact text with grep -rn "WizardFormLayout title" apps/web/src rather than guessing — many step components (e.g. create-mode selection, reinstatement question) are shared across wizards, so the same title string applies in multiple flows.
Selector Priority (accessibility-first):
getByRole()- buttons, links, headings, textboxesgetByLabel()- form inputs with labelsgetByText()- visible text contentlocator()- CSS selectors (last resort)
4. Create Feature Fixtures
Create apps/e2e-tests/tests/[feature]/[feature].fixtures.ts:
import { test as authTest } from "../../fixtures/auth.fixtures";
import { FeaturePage } from "../../pages/FeaturePage";
type FeatureFixtures = {
featurePage: FeaturePage;
};
export const test = authTest.extend<FeatureFixtures>({
featurePage: async ({ authenticatedPage }, use) => {
const featurePage = new FeaturePage(authenticatedPage);
await use(featurePage);
},
});
export { expect } from "@playwright/test";
If authentication is NOT needed, extend from base Playwright test instead:
import { test as base, expect } from "@playwright/test";
5. Write Test File
Create apps/e2e-tests/tests/[feature]/[feature].spec.ts:
import { test } from "./[feature].fixtures";
test.describe("feature name", () => {
test("describes what the user can do", async ({ featurePage }) => {
// Navigate to starting point
await featurePage.goto();
// Step 1: Action + optional assertion
await featurePage.expectStepVisible();
await featurePage.clickStart();
// Step 2: Another action
await featurePage.fillInput("value");
await featurePage.submit();
// Final assertions
await featurePage.expectSuccessMessage();
});
});
Test Naming: Use descriptive names that explain what the user can do:
"allows authenticated user to create a new project""shows error when required field is empty""redirects to login when not authenticated"
6. Run and Verify
Run pnpm --filter e2e-tests typecheck, then run the new spec with the run-e2e-tests skill (/run-e2e-tests tests/[feature]/). It reuses the stack described by .e2e-stack at the repository root when one is up, otherwise brings one up for a port slot with node scripts/e2e-stack.ts up <slot>, runs the tests and tears it down. Never hard-code a host or port in a test: Playwright's baseURL and MAIL_CATCHER_URL come from .e2e-stack.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash - 02
Read - 03
Write - 04
Glob - 05
Grep
FAQ
Что делает скилл create-e2e-test?
Create end-to-end tests using Playwright with page objects and fixtures following project conventions. Use when the user asks to add e2e tests for a feature or user flow.
Как установить скилл create-e2e-test?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл create-e2e-test запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…