user2201789
user2201789

Reputation: 1203

cypress how to assert after page load result same as selected

i have script to select 2 button, 1st Yes, 2nd No. Then click the Save button and reload page. I want to assert after load, the page selection is same as the action done before load.

is there quicker way to assert based on my script input?

so i don't have to script the assertion line by line again.

my action script:

cy.get('#B1_check-true').click();
cy.get('#B2_check-false').click();
cy.get('#save-btn').click();
cy.reload()

Upvotes: 0

Views: 231

Answers (1)

Leonardo Martinez
Leonardo Martinez

Reputation: 633

To assert a radio or checkbox is checked you can use:

cy.get('#B2_check-true').should('be.checked');

Upvotes: 1

Related Questions