When using GitHub Copilot to write Cypress end-to-end tests, the AI generates generic and often flaky test selectors because it has no knowledge of your app's DOM structure. A practical trick is to add a Copilot instructions file that explicitly points to the relevant source files (e.g., the route component) for each spec file. This allows Copilot to discover stable `data-cy` attributes and generate precise, reliable selectors — benefiting the whole team regardless of their familiarity with the project structure.
9 Impressions