Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Testing state of a button

When I click a button via cy.get(‘#numberOfFetusOne’).click() its class changes to selected
How can I validate this change of the class. If I try to get a class with cy.get I get an error: Expected to find element: gpx-16 i1-regular gpu-selected, but never found it.

<gpu-button-option _ngcontent-udx-c111="" id="numberOfFetusOne" value="Singleton" class="gpx-16 i1-regular" _nghost-udx-c95=""> 1 </gpu-button-option>

1

Thanks in advance,
Robert

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can add a should assertion for this.

cy.get('#numberOfFetusOne').should('have.class', 'gpu-selected')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading