marcel158's avatar

Cypress E2E Tests to use the test database

I am using cypress.io for e2e testing. In my tests I am creating, updating and deleting data and this does all happen on the same database that I'm working with when I'm developing. And this idea is getting worse when you think about running your tests on a staging or production environment.

For my phpunit backend tests, I have set to use my test database by adding this line in my phpunit.xml: <server name="DB_DATABASE" value="laravel_test"/>. Through the RefreshDatabase trait, I do also get a fresh database on every test run.

How could I run my e2e tests in this "testing mode"? Is there a better way than switching the environment variable, restarting the server and then run my npm run test:e2e command?

0 likes
0 replies

Please or to participate in this conversation.