Suresh Nagar
Suresh Nagar

Reputation: 1199

Organize Cypress tests in categories or environment

How do I organize my Cypress tests based on the environment. I am running my Cypress tests against both a mock server and a real server.

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

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

What's the convention in Cypress to organize tests based on environment?

Upvotes: 1

Views: 778

Answers (1)

jjhelguero
jjhelguero

Reputation: 2571

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.

Upvotes: 2

Related Questions