Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
Test button is disabled

How can i check that this button is disabled:

<button _ngcontent-c8="" class="customButton" testid="save-button" type="submit"><span _ngcontent-c8="" class="textButtonForm"> Sauver </span></button>

I have tested:

cy.getBySel('save-button').should('have.attr', 'disabled')
Even tested:
cy.getBySel('save-button').should('be.disabled')

i have the error:

expected <button.customButton.formNotChanged> to have attribute disabled

Any advice pls?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

If that is how the element looks at runtime, you can just add the square brackets to make it work.

cy.getBySel('save-button').should('have.attr', '[disabled]')

However, I think you are showing the source code not the runtime HTML.

This [disabled]="myFormForm.invalid" says whenever the form is invalid, add the disabled attribute.

So, in your test you need to cause the form to be invalid. Then both test examples you gave will work.

Look at the other fields in the form and see what validations are set up. The simplest would be a required validation - make sure that element is empty.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda