1---2name: skill-qa-playwright-add-new-test3description: Add new test (API or UI)4---56# Add new test (API or UI)78When adding a new test to the QA Playwright project, follow these conventions.910## Imports1112- **Always** import `test` and `expect` from the fixtures path (three levels up from the spec): `import { test, expect } from '../../../fixtures';`13- **Never** import from `@playwright/test` in any file under `tests/`.1415## API test1617- Use the fixture `request` in the test argument.18- Use data from `test-data/api/<fluxo>/inputs.json` when applicable; import: `import inputs from '../../../test-data/api/<fluxo>/inputs.json';`19- Arrange-Act-Assert; descriptive test name (scenario + expected result).20- baseURL comes from the project config (lib/env); no need to set in the spec.2122**Example:** See [tests/api/hello/hello-api.spec.ts](../../../tests/api/hello/hello-api.spec.ts).2324## UI test2526- Use the fixture `page` (and optionally `context`).27- Use data from `test-data/ui/<fluxo>/inputs.json` or a builder when applicable; use [lib/data-factory.ts](../../../lib/data-factory.ts) (randomEmail, randomString) for varying data.28- Prefer resilient locators: `getByRole`, `getByText`, `getByLabel`; use web-first assertions: `await expect(locator).toBeVisible()`.29- Arrange-Act-Assert; descriptive test name.3031**Example:** See [tests/ui/whitebeard/whitebeard-forms.spec.ts](../../../tests/ui/whitebeard/whitebeard-forms.spec.ts).3233## Checklist3435- [ ] File under `tests/api/<fluxo>/` or `tests/ui/<fluxo>/` with suffix `.spec.ts`36- [ ] Import from `../../../fixtures`37- [ ] Use test-data when there are reusable inputs; use builder or data-factory when varying data38- [ ] Test name describes scenario and expected result3940## Full reference4142[docs/06-como-adicionar-novo-teste.md](../../../docs/06-como-adicionar-novo-teste.md)
Run npx skillmds@latest add whitebeardit/skill-qa-playwright-add-new-test in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Add new test (API or UI) It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
whitebeardit (@whitebeardit) published this skill. Their other Agent Skills are listed on their SkillMD profile.