Skip to content

Commit

Permalink
Add more info to the cy.intercept section
Browse files Browse the repository at this point in the history
  • Loading branch information
wlsf82 committed Jan 18, 2024
1 parent f3ed35d commit 3f75da0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ <h2>
<p>For example: <code>cy.wait('@getTodo').its('response.statusCode').should('be.equal', 500)</code>.</p>
<p>And maybe, even assert that certain fallback element has been displayed.</p>
<p>For example: <code>cy.contains('.error', 'Oops, something went wrong.').should('be.visible')</code>.</p>
<p>Finally, with the <code>cy.intercept()</code>command, you could force a network error, to test how your web app would behave if there were no internet available, for instance.</p>
<p>For example: <code>cy.intercept('GET', 'https://api.example.com/todos/1', { forceNetworkError: true }).as('getTodo')</code>.</p>
<p>Then, you could wait for such a failure.</p>
<p>For example: <code>cy.wait('@getTodo')</code>.</p>
<p>And then, you could even assert that certain fallback element has been displayed.</p>
<p>For example: <code>cy.contains('.error', "Oops, it seems you don't have internet connection.").should('be.visible')</code>.</p>
<button>Get TODO</button>
</div>
<div id="request" class="section">
Expand Down

0 comments on commit 3f75da0

Please sign in to comment.