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

207
Views
¿Cómo hacer `cy.notContains(text)` en cypress?

Puedo verificar si el texto existe en cypress con cy.contains('hello') , pero ahora borro hola de la página, quiero verificar que no existe, ¿cómo hago algo como cy.notContains('hello') ?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Para el simple problema de verificar que 'hola' no existe, puede usar .contain('hello') seguido de .should() . Entonces se vería algo como esto para toda la página:

 // code to delete hello cy.contains('hello').should('not.exist')

O puede reducirlo aún más a un área particular de la aplicación:

 // code to delete hello cy.get('.element-had-hello').should('not.include.text', 'hello')
about 4 years ago · Juan Pablo Isaza Report

0

cy.contains('hello').should('not.exist) no funcionará si hay más de una aparición de "hello".

Es posible que prefiera verificar que la instancia del elemento real se haya eliminado del DOM

 cy.contains('hello') .then($el => { // delete the element cy.wrap($el) .should($el => { // has this element been removed? expect(Cypress.dom.isAttached($el)).to.eq(false) }) })
about 4 years ago · Juan Pablo Isaza Report

0

Puede usar contains con una combinación de selector y texto. Primero verifique que exista y luego, después de verificar la eliminación, no existe.

 cy.contains('selector', 'hello').should('exist') //Actions to perform Deletion cy.contains('selector', 'hello').should('not.exist')
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!