Choose direct logic or mounted component scope
A pure formatter can be imported and checked directly in a test, without mounting an interface. A quantity picker needs a component test when the risk concerns input wiring and displayed totals. Keep the full arithmetic matrix in direct checks and use rendered examples for the behavior that depends on the component boundary.
Cypress component testing uses a development server and framework-specific mounting setup. Follow the documentation for the framework and build configuration in the repository. The mount helper and provider wrappers may be project-specific, so copying a React example into another component framework will not establish a valid test environment automatically.
Work with the Cypress command model
Use Cypress commands and assertions according to their queued execution model. Do not treat a command result as an immediate synchronous value. Retryable queries and assertions can observe changing state, while arbitrary sleeps only postpone the same uncertainty. Assert the visible result after an interaction instead of using elapsed time as evidence.
Mount the component with the providers and properties needed for the scenario. Keep repeated wrappers in a clear custom mount helper, but leave decisive input near the test. A helper that silently supplies permissions or data can hide the reason a component renders successfully and weaken the meaning of the test's result.
Control requests without overstating integration
Use controlled request responses when testing loading, success, and failure states. Verify the interface's reaction to each response and document that the real service is outside this check. A stub can make component behavior deterministic but cannot prove that the backend still satisfies the response shape the component expects in production.
Keep broader browser journeys for navigation and assembled application behavior. Component tests can establish real-browser rendering within their mounted boundary, but they do not automatically include routing, authentication, and all deployed services. Name that boundary and use targeted integration evidence for missing connections rather than expanding the claim of a green component run.
Working sheet
| Task | Approach | What to assert |
|---|---|---|
| Pure formatter | Direct imported function | Exact string |
| Quantity picker | Mounted component | Displayed total |
| Request error | Controlled interception | Error state |
| Application checkout | End-to-end journey | Confirmed order outcome |
Questions about use Cypress for unit logic and browser component checks
Is Cypress component testing the same as pure unit testing?
No. It mounts a component in a browser and includes rendering and interaction within that boundary.
Can I use a command return value synchronously?
Follow Cypress's command queue model and use supported chaining rather than assuming an immediate value.
How should I use the working sheet?
Download the CSV and replace the sample rows with evidence from your repository. Record a clear acceptance check and an owner for each item. Keep unresolved assumptions visible rather than treating the example as a completed assessment.
Sources and further reading
Examples are illustrative. They are not customer results, security guarantees, or a substitute for checking the documentation for your installed version.
