---
id: e2e-integration-tests
title: Writing End-To-End and Integration Tests
---

We run integration tests for both the
[NodeJS](https://github.com/ory/kratos-selfservice-ui-node) and
[React Native](https://github.com/ory/kratos-selfservice-ui-react-native)
reference implementation using [Cypress](https://www.cypress.io). You can find
the set up and source code for these tests in
[./test/e2e/run.sh](https://github.com/ory/kratos/blob/master/test/e2e/run.sh).
In principle, we start Ory Kratos with some configuration and an in-memory
database in the background

```shell script
$ 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

```json
{
  "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`:

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