data-testid best practices
Name test IDs, scope repeated elements, and use them in Playwright, Cypress, and Testing Library.
Practical guides to choosing locators, reproducing frontend bugs, and giving AI agents useful browser context. Find the answer you need, then put it to work.
Browse the guidesdata-testidGive your test IDs a clear purpose. Naming conventions, scoped locators, and code examples for the frameworks your team uses.
Read the guide Playwright · Cypress · Testing Librarydata-testid="checkout-submit"page.getByTestId(
'checkout-submit'
)Start with the problem you’re working on.
Name test IDs, scope repeated elements, and use them in Playwright, Cypress, and Testing Library.
Bring the steps, affected element, and expected result together in a report your teammate can investigate.
Compare three locator strategies and the markup each one depends on.
Understand how changing DOM structure, accessible names, and test IDs can break a locator.
Investigate selector-related failures before choosing a replacement locator.
Change a sample UI, compare locator matches, and learn when roles or CSS attributes fit.
Build a clearer agent handoff with page state, steps, and evidence. Includes a copyable template.
Connect your coding assistant to saved recordings and elements, choose the right MCP tool, and review the evidence.
Try identical-looking buttons with different states. See what visual, element, and recording evidence each explain.
Inspect an element, review its selectors, or record the browser steps behind a bug with the Samelogic extension.
Free extension for desktop Chrome. Try it before signing up.