Tricks of Cypress: Default Configuration Values

There are some configuration possibilities that I like, and there are some that raises question in me.

video: true,

Yes. By default when you run Cypress headlessly, videos are recorded automatically during each test run.

I found it crazy.

Why I think it’s definitely something that should be adjusted is because:

a) screenshots are also taken for failed tests by default

b) videos are recorded and uploaded for passing tests too by default

When the feedback time is crucial – and let’s face with the fact; getting test execution result as soon as possible is important – you definitely don’t want to spend time on waiting for video compression and upload.

So this is something that you definitely want to adjust in your config file.

Adjustment possibilities:

If you only want to generate a video when a test has failed, on your cypress.config.ts, set videoUploadOnPasses to false.

If you want to turn off the video feature completely, set video to false.

retries: {

It’s pretty good that Cypress gives the opportunity to execute a failing tests more times, to make sure that the failure was not caused by an intermittent issue.

Do we need this? I definitely do! So the questions comes up: how flaky are my tests? Well, apparently… despite that fact that I’m using intercept, they are.

By default retries option comes with 0 value. If we modify this value like this:

  "retries": 1

we modify the value for both runMode and for openMode.

What is runMode and openMode, right?

runMode allows us to define the number of retries when we are using cypress run command. openMode allows us to define the retries when we are using cypress open. I find this feature thoughtful, though… anyways. The point is, we can set a value for runMode and one for openMode. Use it wisely.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s