name: qa-playwright-maintain-conventions
description: Enforce QA Playwright project conventions when editing tests or project files: import from fixtures only, use test-data for inputs, follow directory structure. Use when editing specs, refactoring, or when the user asks to align code with project standards.
Maintain conventions
When editing specs or other project files, ensure the QA Playwright conventions are followed.
Specs (tests/)
- Imports: Always
import { test, expect } from '../../../fixtures'; (three levels up from tests/<api|ui>/<fluxo>/). Never import from @playwright/test in any file under tests/.
- Data: Prefer test-data (inputs.json, builder.ts) over hardcoding payloads in specs; use lib/data-factory.ts for varying data (randomEmail, randomString, randomNumber).
- Structure: Specs live in
tests/api/<fluxo>/*.spec.ts or tests/ui/<fluxo>/*.spec.ts; data lives in test-data/api/<fluxo>/ or test-data/ui/<fluxo>/.
- baseURL: Use lib/env.ts (getBaseUrl) in config; avoid hardcoding URLs in specs when baseURL can be used.
Checklist when editing
References
AGENTS.md — conventions summary
docs/02-estrutura-de-diretórios.md — role of each directory