Skip to main content

End-to-end and integration tests

We run integration tests for both the Node.js and React Native reference implementation using Cypress. You can find the set up and source code for these tests in ./test/e2e/ In principle, we start Ory Kratos with some configuration and an in-memory database in the background

DSN=memory hydra serve -c ./path/to/config/kratos.yml --dev > "kratos.e2e.log" 2>&1 &

as well as our application in the background as well. Then, we start the Cypress test runner which executes the different e2e tests. This works really well to test compliance and integration of Ory Kratos.

If you run Ory Kratos and your app on separate domains or ports you might want to add

"chromeWebSecurity": false

to your cypress.json config file.

Testing React Native on web with Cypress

If you want to test React Native (rendered as a web application) in Cypress, you need to disable security features preventing browser from executing self-service API flows. To do this, set the environment variable DEV_DISABLE_API_FLOW_ENFORCEMENT=1:

DSN=memory \
hydra serve -c ./path/to/config/kratos.yml --dev > "kratos.e2e.log" 2>&1 &)