e2e-test
Complete guide to writing Playwright e2e tests for finstreet/boilerplate features. Covers form modules, card CRUD modules, inquiry process pages, happy path tests, fixtures, test data, and dataTestIds. Use this skill whenever adding, modifying, or debugging e2e tests, or when the user mentions e2e, end-to-end, playwright tests, or integration tests for features.
What this skill does
# Playwright E2E Test Guide
This project uses a layered Playwright e2e test architecture with reusable page objects, form modules, card CRUD modules, and inquiry process pages. All tests use `data-testid` selectors and follow strict patterns.
## Architecture
```
BaseHelper (clickByTestId, getLocatorByTestId, getTextByTestId, waitForSelectorByTestId)
│
BasePage (composes: form: FormInteractor, errors: ErrorHandler, navigation: NavigationHelper)
│
├── FormModule<T> ── abstract fillAndSubmitForm(data: T)
│ executeValidationAndSubmit(options)
│
├── CardCrudModule<T> ── abstract fillAndSubmitForm(data: T) + verifyCardExists(data: T)
│ executeCrudCycle(options)
│
└── InquiryPage (BasePage) ── composes step modules per product
completeFullInquiryProcess / fillAllStepsWithoutFinalSubmit
```
## Directory Structure
```
e2e/
├── config/ # Step configs for inquiry processes
├── data/
│ ├── dataTestIds.ts # Centralized data-testid constants
│ ├── common/ # Shared test data
│ └── {product}/ # Product-specific test data
│ └── {feature}TestData.ts
├── fixtures/
│ └── fixtures.ts # Playwright fixture registration
├── files/ # File upload resources
├── helpers/
│ ├── core/
│ │ ├── BaseHelper.ts # Base class: data-testid interactions
│ │ ├── FormInteractor.ts # fillField for all 12 field types
│ │ ├── NavigationHelper.ts # goto, waitForUrl, clickBackButton
│ │ └── ErrorHandler.ts # getFieldError, getFormError
│ ├── components/
│ │ ├── CardHelper.ts # Card CRUD: getCard, clickUpdateCard, deleteCard
│ │ └── InteractiveListHelper.ts # List: waitForListToLoad, clickFirstListItem
│ └── utilities/
│ ├── InvitationHelper.ts # Email invitation workflows
│ └── MailtrapHelper.ts # Email testing via Mailtrap API
├── modules/
│ ├── FormModule.ts # Abstract form validation+submit cycle
│ ├── CardCrudModule.ts # Abstract card CRUD cycle
│ ├── LegalRepresentativesModule.ts # Reusable card CRUD (shared across products)
│ ├── common/ # Shared modules (documents, property manager steps)
│ └── {product}/ # Product-specific modules
│ ├── {Feature}Module.ts # FormModule or CardCrudModule subclass
│ └── inquiryProcess/ # Inquiry step modules
│ └── {Step}StepModule.ts
├── pages/
│ ├── BasePage.ts # Composes FormInteractor + ErrorHandler + NavigationHelper
│ ├── InquiryPage.ts # Generic inquiry flow orchestration
│ ├── auth/
│ │ ├── LoginPage.ts # Portal-specific login methods
│ │ └── AcceptInvitationPage.ts
│ └── {product}/
│ ├── {Product}InquiryPage.ts # InquiryPage subclass
│ ├── PM{Product}FinancingCaseOverviewPage.ts # PM overview with modules
│ └── FSP{Product}FinancingCaseOverviewPage.ts # FSP overview with modules
├── tests/
│ └── {product}/
│ ├── {product}HappyPath.spec.ts
│ ├── {product}InquiryProcess.spec.ts
│ ├── {product}InquiryProcessNavigation.spec.ts
│ └── {product}InquiryProcessBanner.spec.ts
└── utils/
├── portalRoutes.ts # Portal-aware route resolvers
└── test-helpers.ts # testCredentials, clearAuthState
```
## File Creation Order
When adding e2e tests for a new feature, follow this order:
1. **dataTestIds** — Add test ID constants to `e2e/data/dataTestIds.ts`
2. **Test data** — Create `e2e/data/{product}/{feature}TestData.ts`
3. **Module** — Create `e2e/modules/{product}/{Feature}Module.ts` (extends `FormModule<T>` or `CardCrudModule<T>`)
4. **Page** — Register module on the parent overview page (e.g., `PM{Product}FinancingCaseOverviewPage`)
5. **Fixtures** — Register any new pages in `e2e/fixtures/fixtures.ts`
6. **Spec** — Create or update `e2e/tests/{product}/*.spec.ts`
For inquiry processes, also create:
- Step modules in `e2e/modules/{product}/inquiryProcess/`
- Inquiry page in `e2e/pages/{product}/{Product}InquiryPage.ts`
- Portal routes in `e2e/utils/portalRoutes.ts`
## Key Imports
```typescript
// Playwright
import { Page, expect, test } from "@playwright/test";
// Base classes
import { FormModule } from "e2e/modules/FormModule";
import { CardCrudModule } from "e2e/modules/CardCrudModule";
import { BasePage } from "e2e/pages/BasePage";
import { InquiryPage, InquiryRoutes } from "e2e/pages/InquiryPage";
// Helpers
import { InteractiveListHelper } from "e2e/helpers/components/InteractiveListHelper";
import { CardHelper } from "e2e/helpers/components/CardHelper";
import { MailtrapHelper } from "e2e/helpers/utilities/MailtrapHelper";
import { InvitationHelper } from "e2e/helpers/utilities/InvitationHelper";
// Data
import { dataTestIds } from "e2e/data/dataTestIds";
import { routes } from "@/routes";
import { BaseField } from "@finstreet/forms";
import { Portal } from "@/shared/types/Portal";
// Fixtures
import { test, expect } from "e2e/fixtures/fixtures";
// Utilities
import { clearAuthState, testCredentials } from "e2e/utils/test-helpers";
```
## Conventions
### data-testid Selectors
All element interactions use `data-testid` attributes. Never use CSS selectors, class names, or text content for element selection. The `dataTestIds` object in `e2e/data/dataTestIds.ts` centralizes all test ID constants.
### Field Interaction via data-testid
The `FormInteractor.fillField()` method appends field-type suffixes to the `fieldName`:
| BaseField Type | data-testid Pattern |
|---|---|
| `INPUT` | `${fieldName}-input` |
| `PASSWORD` | `${fieldName}-password` |
| `NUMBER` | `${fieldName}-number` |
| `TEXTAREA` | `${fieldName}-textarea` |
| `CHECKBOX` | `${fieldName}-checkbox` |
| `YES_NO_RADIO_GROUP` | `${fieldName}-yes-no-radio-group__item-yes/no` |
| `RADIO_GROUP` | `${fieldName}-radio-group__item-${value}` |
| `SELECT` | `${fieldName}-select__trigger` / `__content` / `__item-${value}` |
| `COMBOBOX` | `${fieldName}-combobox__input` (5s wait, then click `__item-0` or `__item-1`) |
| `DATEPICKER` | `${fieldName}-datepicker` |
| `SELECTABLE_CARDS` | `${fieldName}-selectable-cards__card-${value}` |
| `FILE_UPLOAD` | `${fieldName}-file-upload` |
### test.step() Nesting
Always wrap logical sections in `test.step()` for clear HTML report output:
```typescript
await test.step("Fill in and confirm financing details", async () => {
// ...
});
```
### clearAuthState
Always call `clearAuthState(page)` in `beforeEach` to clear cookies:
```typescript
test.beforeEach(async ({ page }) => {
await clearAuthState(page);
});
```
### Timeout Configuration
- Default: use `test.describe.configure({ timeout: 60000 })` for inquiry processes
- Happy paths: use `test.setTimeout(360000)` inside the test for long flows
### Fixture Imports
Always import `test` and `expect` from `e2e/fixtures/fixtures` (not from `@playwright/test`) in spec files:
```typescript
import { test, expect } from "e2e/fixtures/fixtures";
```
### Source Type Imports
Import schema types from `@/features/...` and option enums from their source files:
```typescript
import { FinancingDetailsType } from "@/features/propertyManagement/forms/financingDetails/financingDetailsFormSchema";
import { UsagePurposes } from "@/features/propertyManagement/forms/financingDetails/usagePurposeOptions";
import { YesNoOptions } from "@/shared/components/form/YesNoRadioGroup/options";
```
### Portal-Aware Routing
Routes differ by portal. Use portal route resolvers:
```typescript
// e2e/utils/portalRoutes.ts
export function getHoaLoanInquiryRoutes(portal: Portal) {
return portal === "propertyManager"
? routes.pm.hoaLoan.inquiry
: routes.fsp.hoaLoan.inquiry;
}
```
## Decision Tree: What Type of Test Do I NeRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.