Skip to content
Branch: master
Find file History
bahmutov add logging in recipe that calls app code (#300)
* add logging in recipe that calls app code

* confirm the user object returned by the application object

* add implicit assertions example

* Minor editing

* Not used in example

* add custom command example
Latest commit f137089 Jun 24, 2019


Example of logging in using application code

Application copied from ../logging-in__jwt example.

This example shows how you can use your own application code to log in. The "normal" application logs in at src/_services/user.service.js given username and password. From our cypress/integration/spec.js file, we can import this service and use cy.wrap() to wait for the returned promise to resolve before continuing with the test.

Passing test

The spec also shows how to wrap application code in a custom command, which is automatically wrapped.

note: in order to import the login service, we need to bundle the spec code using the same webpack bundler configuration as the application code. We do it by using the cypress-webpack-preprocessor, see cypress/plugins/index.js

You can’t perform that action at this time.