I am writing functional tests for my JavaScript web application. I don't have much experience writing tests using Cypress to be honest. What I am trying to test now is that if the user can see a particular text message on the page for the X number of times.
This is my assertion in the test at the moment.
cy.contains('Hello World').should('be.visible')
As you can see, I am testing that if the "Hello World" message is visible to the user. What I would like to also test is that I want to test if the message is seen for 3 times. How can I do that?
Following is my dummy HTML.
<form>
<div>
<div>
<input name="email" />
</div>
<ul>
<li>This is required.</li>
</ul>
</div>
<div>
<div>
<input name="password" />
</div>
<ul>
<li>This is required.</li>
</ul>
</div>
</form>