Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesInstall @testing-library/cypress, import its command setup from Cypress’s support file, then use retryable cy.findBy… queries such as cy.findByRole() in your tests. Cypress must already be installed in the project. The integration adds Testing Library queries to Cypress; it does not replace Cypress’s normal command chain.
Install and register Cypress Testing Library
Install the package
From the project directory, add the integration as a development dependency:
npm install --save-dev @testing-library/cypress
Use the equivalent command for your package manager if the project uses something other than npm. Cypress itself must also be installed. Because Cypress’s supported Node.js versions, operating systems, browsers, and package managers can change, check its current installation guide for requirements that match your environment.
Import the commands in Cypress support
Add this import to the Cypress support commands file, typically cypress/support/commands.js:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
import '@testing-library/cypress/add-commands'
Make sure the file is part of the support-file configuration for the test type you are running. Once loaded, the integration adds its supported queries to cy.
TypeScript projects
If TypeScript does not recognize the added Cypress commands, follow the integration’s TypeScript setup: add both cypress and @testing-library/cypress to the types array in compilerOptions in tsconfig.json. The exact shape of that file depends on the project’s existing configuration.
Write tests with retryable semantic queries
Use findBy or findAllBy query commands from cy, then continue with Cypress actions and assertions. For example:
cy.findByRole('button', { name: /save/i }).click()
cy.findByRole('dialog').within(() => {
cy.findByRole('button', { name: /confirm/i }).should('exist')
})
Role and accessible name queries can express how a person would identify a control. They also make the test’s intent legible: the first query looks for a button called “Save,” rather than relying on a styling class or a particular DOM structure. Use a query only when its role, name, or other accessible information matches what the application actually renders.
Wait for content that appears asynchronously
The findBy family works with Cypress retryability, so Cypress can retry the query while the page updates instead of requiring a fixed sleep for ordinary asynchronous rendering. For example, after an action that opens a dialog, query for the dialog or its control with findByRole. Cypress’s retry behavior still depends on its command and timeout settings; a query cannot make content appear if the application never renders it.
The integration guide supports querying within Cypress chains and documents handling both jQuery elements and DOM nodes. You can scope a query to a form, for example:
cy.get('form').findByRole('button', { name: /submit/i }).click()
Scoping can be useful when a page has several controls with the same accessible name. For a dialog or other Cypress subject, .within() is another clear way to restrict the commands that follow.
Choose selectors to match the test’s purpose
Cypress’s migration guidance describes semantic locators and application-provided data attributes as options, not as a universal contest with one winner:
| Selector approach | Useful when | Trade-off |
|---|---|---|
Testing Library semantic query, such as findByRole, findByLabelText, or findByText |
The test should identify a control or content as a user would, and its role, label, or text is meaningful. | Queries depend on the rendered accessible role, label, or text; a change to that user-facing content can require a test update. |
Application data attribute, such as data-testid or data-cy |
The project already uses dedicated test attributes, or the interaction has no suitable user-facing identifier. | The attribute may need to be added to application markup; the selector does not itself describe the user-visible meaning of the element. |
Cypress’s migration guidance maps role, label, text, and placeholder locators to the corresponding Testing Library commands, and also describes data attributes as an alternative. Keep to the project’s conventions where they serve the test; prefer a semantic query when it accurately captures the interaction being tested.
Rank #4
Queries to use—and version-sensitive caveats
The Cypress Testing Library guide documents findBy and findAllBy query commands and says that get* queries are not supported. It also says query* queries are no longer needed since version 5 and are slated for removal in version 6. That note is version-sensitive: check the guide and the installed @testing-library/cypress version before relying on it, especially when upgrading.
Testing Library’s general query guide explains that query families differ in whether they throw when there is no match, return no match, or retry for asynchronous content. For Cypress integration, follow its supported command pattern rather than assuming every query family from other Testing Library environments is available.
Configure the integration when necessary
If the defaults do not suit the project, the integration provides cy.configureCypressTestingLibrary(config). Check the official repository documentation for the configuration options supported by the installed release; do not assume an option from another Testing Library integration applies here.
Best Value
Troubleshoot common setup and query failures
findByRoleis not a function: Verify that@testing-library/cypressis installed and thatimport '@testing-library/cypress/add-commands'runs from the support file configured for the tests you are executing. Restart the Cypress process after dependency or support-file changes.- TypeScript reports that a query does not exist on
cy: Addcypressand@testing-library/cypresstocompilerOptions.typesintsconfig.json, as described in the integration guide, and confirm that the project is using the expected TypeScript configuration. - A query times out or finds no element: Check that the element is rendered in the current page state and that the role, accessible name, label, or text matches the UI. If the element appears after an action, query after that action; avoid substituting a fixed delay for a query that can retry.
- A page has several matching controls: Scope the query to a form or use
.within()on a dialog or other container, or make the accessible name specific enough to identify the intended control. - An older example uses
getBy…orqueryBy…: Check the installed integration version and its current guide. Its documented Cypress pattern isfindBy/findAllBy; the guide saysget*is unsupported and notes the version-sensitive status ofquery*. - Cypress itself fails to install or launch: Check the current Cypress installation requirements for your Node.js version, operating system, browser, and package manager. Historical Cypress major-version changes can affect setup, so diagnose against the version in the project rather than an old tutorial.
Or skip the browser setup
If you need screenshots rather than an interactive Cypress test, ScreenshotNeo returns a screenshot or PDF from one GET request. Its clean-shot options can accept consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server exposes screenshot and page-info tools to AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
See the ScreenshotNeo API documentation. Example request:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up free for 1,000 screenshots a month, with no card required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




