Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Cypress no puede encontrar el selector - React/CSS Modules/Cypress

Estoy escribiendo pruebas e-2-e para nuestra interfaz utilizando Cypress.

Cuando trato de apuntar a un elemento, estoy usando .button-module_btnLabel__30kQb , pero según tengo entendido, esto hace que mi prueba sea frágil ya que el hash del nombre de clase puede cambiar.

Sin embargo, cuando intento agregar un selector, Cypress no puede encontrarlo. Un ejemplo a continuación:

 import { Button } from '...ui'
 <Button.Primary data-cy="submit" onClick={startLogin} > Log In </Button.Primary>
 cy.get('data-cy="submit"') .should('be.visible') .should('contain.text','Log In') .click()
 AssertionError: Timed out retrying after 4000ms: Expected to find element: `[data-cy=submit]`, but never found it.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si está seleccionando un atributo, necesita encerrar corchetes.

 cy.get('[data-cy="submit"]')

Nota React no pasa todos los atributos, pero el prefijo data debería estar bien.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!