Organize Cypress Tests in categories or environment

Viewed 202

How to organize the cypress tests based on the environment. I am running my cypress tests again mock server and a real setup both.

While running against mock server i can assume that data is always there and can run the full set, but i can only run a subset of the tests when pointing to a real server.

One option ofcourse is to move them to different folder/spec files, is there any other better way e.g. like barrelling files through index.ts?

Whats the convention in cypress to organize tests based on environment?

1 Answers

Depending on how you set up your dummy data for tests with the mock server you may might it useful to add @tags to your tests using cypress-grep plugin.

This will allow you to run certain tests with tags and place a @realServer tag for your test only to be ran against your real server.

You may need to alter however you set up the baseUrl for each subset of tests.

Related