com um clique
writing-e2e-tests
// Patterns and guidelines for writing Playwright E2E tests in this project — page object rules, assertion placement, and locator conventions. Use when writing new tests or reviewing existing ones.
// Patterns and guidelines for writing Playwright E2E tests in this project — page object rules, assertion placement, and locator conventions. Use when writing new tests or reviewing existing ones.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Run, write, and debug Playwright E2E tests for this project. Use when running a single test file or a single named test, writing new E2E tests, working with Page Objects, or mocking songs. Covers test setup, page object initialization, and song fixture mocking.
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when executing implementation plans with independent tasks in the current session
Guidelines for styling UI in this project — when to use TWC (react-twc) vs inline Tailwind classes, and which AKUI primitives to reach for. Use when building or reviewing UI components.
Use when you have a spec or requirements for a multi-step task, before touching code
| name | writing-e2e-tests |
| description | Patterns and guidelines for writing Playwright E2E tests in this project — page object rules, assertion placement, and locator conventions. Use when writing new tests or reviewing existing ones. |
.spec.ts files must never locate elements directly — all locators must be exposed via a page object:
// ✅ Locator defined on the page object, used in spec
await expect(pages.historyPage.container).toBeVisible();
// ❌ Locating elements directly in a spec file
await expect(page.getByTestId('history-page')).toBeVisible();
await expect(page.locator('.some-class')).toBeVisible();
.spec.ts test directly.// ✅ Simple visibility check — in spec
await expect(pages.historyPage.emptyState).toBeVisible();
// ✅ Complex / implementation-detail assertion — on page object
// PageObject:
public async expectEntryCount(count: number) {
await expect(this.entries).toHaveCount(count);
}
// Spec:
await pages.historyPage.expectEntryCount(3);
Use expect(locator).toBeVisible() instead of locator.waitFor():
// ✅
await expect(pages.historyPage.container).toBeVisible();
await expect(this.entries).toHaveCount(count);
// ❌
await pages.historyPage.container.waitFor();
await this.entries.nth(count - 1).waitFor();
Import expect from @playwright/test in page objects that use it.