---
title: "Tell Copilot Where To Find Test Selectors"
url: https://daily.dev/posts/tell-copilot-where-to-find-test-selectors-baidnymns
source_url: https://glebbahmutov.com/blog/tell-copilot-where-to-find-test-selectors
type: article
source: "Gleb Bahmutov"
published: 2026-05-31T07:53:32.302Z
updated: 2026-05-31T09:02:38.425Z
tags: ["testing", "github", "cypress"]
reading_time: 3
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Tell Copilot Where To Find Test Selectors

**[Gleb Bahmutov](https://daily.dev/sources/glebbahmutov)** · 3 min read · 0 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://glebbahmutov.com/blog/tell-copilot-where-to-find-test-selectors>

## Similar posts on daily.dev

- [Write Cypress tests in plain English: AI-powered test automation is now in beta](https://daily.dev/posts/write-cypress-tests-in-plain-english-ai-powered-test-automation-is-now-in-beta-tcv9jrqtr) · cypress · 1 upvotes · 0 comments
- [Leveraging Copilot to rapidly refactor test automation](https://daily.dev/posts/leveraging-copilot-to-rapidly-refactor-test-automation-dfiwogvdz) · Scott Logic · 0 upvotes · 0 comments
- [Cypress AI Skills: Get More From Your AI Coding Assistant](https://daily.dev/posts/cypress-ai-skills-get-more-from-your-ai-coding-assistant-cuikhfjxp) · cypress · 2 upvotes · 0 comments
- [What’s new in cy.prompt for AI testing in Cypress](https://daily.dev/posts/what-s-new-in-cy-prompt-for-ai-testing-in-cypress-pyei6inyq) · cypress · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#github](https://daily.dev/tags/github), [#cypress](https://daily.dev/tags/cypress)

[View this post on daily.dev](https://daily.dev/posts/tell-copilot-where-to-find-test-selectors-baidnymns)
