Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda