
Angular Cookbook
By :

Testing user interface (UI) transitions is the essence of E2E testing. While it is important to test the predicted outcome of an action right away, there might be cases where the outcome actually has a dependency. For instance, if a user fills out the Login form, we can't show the success toast until we have a successful response from the backend server, hence we can't test whether the success toast is shown right away. In this recipe, you're going to learn how to wait for a specific XHR call to be completed before performing an assertion.
The project for this recipe resides in chapter11/start_here/waiting-for-xhr
.
npm install
to install the dependencies of the project. npm run cypress:test
. This should open a new Cypress window. Tap the user.spec.ts
file and you should see the tests, as follows:
Figure 11.10...