Reputation: 1211
I am new to cypress and unsure which syntax or parameter to use to assert that the text is displayed when click on NO radio button.
This is the scrip action to NO button.
cy.get('#choose-answer_check-false').click();
the text displayed when click on NO radio button then. how do I assert it only displayed right after the click?
<div class="test-abc"><span>you have clicked NO</span></div>
Upvotes: 0
Views: 366
Reputation: 3226
cy.get('.test-abc').should('not.contain', 'you have clicked NO')
cy.get('#choose-answer_check-false').click();
cy.get('.test-abc').should('contain', 'you have clicked NO')
You simply first assert that the text is not present before clicking the button. This assumes that your div
is still rendered before that click. If it previously contains no text or other text you can change the assertion accordingly.
Upvotes: 1