Instruction file imported from wlsf82/cy-buddy (
.github/instructions/cypress.instructions.md). Copyright stays with the author.
Cypress Testing Instructions
This documentation provides comprehensive guidance for writing Cypress tests in this project. All examples use TypeScript. The instructions are organized into focused topic areas.
Quick Reference: For a concise summary of core principles and rules, see the cypress-automation skill.
Topic Files — When to Read Each
Only read the topic files relevant to your current task:
01. Project Structure
Read when setting up a new Cypress project, modifying config files, or configuring environment variables. Covers folder structure, baseUrl, apiUrl, fixtures, and support files.
02. Test Organization
Read when creating new test files, structuring test suites, or deciding on hooks. Covers beforeEach, testIsolation, context() blocks, and the AAA (Arrange-Act-Assert) pattern.
03. Authentication
Read when implementing login flows or test authentication. Covers the API-based cy.login() custom command used in this project, cy.session patterns, and session caching.
04. Selectors
Read when choosing selectors or reducing selector duplication. Covers selector priority (data-testid > aria-label > descriptive > id), cy.contains, and .as() aliases.
05. Commands
Read when using cy.request(), cy.wait('@alias'), cy.intercept(), or .last(). Covers destructuring patterns and the prohibition of cy.wait(Number).
06. Assertions
Read when writing or debugging assertions. Covers be.visible vs exist, avoiding redundant chains, negative assertion safety, and .its() usage.
07. Code Quality
Read when handling sensitive data, organizing imports, or reviewing formatting. Covers { log: false }, conditional testing rules, indentation, and npm scripts.
08. Component Testing
Read when writing or refactoring component tests with cy.mount(). Covers spec file placement, mounting with providers/routers, and intercepting API calls in component tests.