testing-library / cypress-testing-library

🐅 Simple and complete custom Cypress commands and utilities that encourage good testing practices.
http://npm.im/@testing-library/cypress
MIT License
1.8k stars 152 forks source link

Configuring testIdAttribute does not work #266

Closed peterlawless closed 10 months ago

peterlawless commented 10 months ago

Relevant code or config

// cypress/support/index.ts
import { configure } from "@testing-library/cypress";
configure({ testIdAttribute: "data-test-id" });

What you did: Followed the instructions to configure the testIdAttribute.

What happened:

The configuration did not work, even after restarting Cypress multiple times. It is still using "data-testid":

Screenshot 2023-10-19 at 2 08 43 PM
peterlawless commented 10 months ago

Correction: I moved the configuration into cypress/support/e2e.ts in accordance with documented support file structure and it works now.