Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable video recording on cypress run #867

Closed
Tracked by #6
ianwalter opened this issue Nov 2, 2017 · 22 comments
Closed
Tracked by #6

Disable video recording on cypress run #867

ianwalter opened this issue Nov 2, 2017 · 22 comments

Comments

@ianwalter
Copy link
Contributor

ianwalter commented Nov 2, 2017

Current behavior:

Video recorded on every cypress run.

Desired behavior:

CLI and/or config option to disable video recording on cypress run.

How to reproduce:

Run cypress run. See "Started video recording" message and generated video file in cypress/videos.

Additional Info (images, stack traces, etc)

I'm not using the videos while developing and I'd rather save the time/processing and lower my chances of running into associated bugs by disabling this functionality altogether when I need to run all tests.

@MarcLoupias
Copy link

MarcLoupias commented Nov 2, 2017

You can already disable video recording with proper configuration in your cypress.json file (doc) : "video": false.

You can also do it with CLI by overriding your cypress.json.

Edited by @jennifer-shehane to update key videoRecording to new version 3 key video

@ianwalter
Copy link
Contributor Author

@MarcLoupias Thanks! Not sure how I missed that.

@0x-r4bbit
Copy link

Thanks everyone for this issue as I ran into it as well. However, I do have some thoughts here on usability (but maybe my expectations are wrong):

  • I read in the CLI docs that --record specifies "whether to record the test run". With that in mind, I'd expect it to not record the test run with --record is not passed as an option, or, at least let me disable it a la cypress run --record false.

Doing it via config override totally does the trick, it's just less comfortable and to be honest, I didn't run into the overriding docs when searching for such a feature. Frankly I didn't actually search for "overriding config" but rather "how do disable video recording in cypress run".

Again, my expectations may be wrong here. I'm just leaving it here as feedback :)

@brian-mann
Copy link
Member

@PascalPrecht There's another issue open that talks about how "recording" and "video recording" is confusing nomenclature.

What it's really saying is two different things. --record is about recording the run details on our Dashboard Service to which you'd have to setup your project to record and explicitly opt in.

By default Cypress takes a video of the run without any flags -- thats the video recording feature. You can turn that off with configuration or CLI flags. --config videoRecording=false

@bahmutov
Copy link
Contributor

The --record is for recording test results on the dashboard. Which is separate from video recording for example. The way I usually set this up (because I don't want to record video locally when testing)

  • disable video recording in the cypress.json
  • use simple test: cypress run script in the package.json file
  • on CI do npm test -- --record and set CYPRESS_RECORD_KEY=<private record key> environment variable and CYPRESS_VIDEO_RECORDING=1 to enable video recording on CI

@bahmutov
Copy link
Contributor

hahaha @brian-mann we posted together!

@brian-mann
Copy link
Member

@PascalPrecht here's the other issue for reference #562

@0x-r4bbit
Copy link

Thanks for the clarification! This all makes total sense. I assume tho then, that this has potential for improvement. Not sure if I'm the only one who got confused by this.

@johannordin
Copy link

videoRecording is now renamed to video (if someone stumbles upon this issue)

@aries1980
Copy link

For the “record”, it is still videoRecording in 3.0.1 .

@jennifer-shehane
Copy link
Member

Hey @aries1980, what key are you referring to? Where are you using the videoRecording key in 3.0.1?

If you were to use the videoRecording key in your configuration in Cypress version 3.0+, you should see this error:

A configuration option you have supplied has been renamed.

Please rename videoRecording to video

@kud
Copy link

kud commented Oct 8, 2018

It's still videoRecording in the doc: https://docs.cypress.io/guides/core-concepts/screenshots-and-videos.html#Videos

@jennifer-shehane
Copy link
Member

I created a new issue in our docs to document the incorrect key reference here: cypress-io/cypress-documentation#1030. Our documentation is open source and contributions are welcome. 😄

@kud
Copy link

kud commented Oct 9, 2018

Thank you. @jennifer-shehane :)

@johnjensenish
Copy link

cypress run --config video=false

@KhizerRehan
Copy link

KhizerRehan commented Mar 1, 2021

@jennifer-shehane, @MarcLoupias is there any possibilty to record video for only failed specs not for passed test cases and used them in report if any test suite fails due to any test case. Thanks. I hope you got my point.

@jennifer-shehane
Copy link
Member

@KhizerRehan There is no way to only record video for 'failed' specs because we don't know what will fail or pass until the tests are over and the recording is done. You can delete the videos for passed specs though with this code: https://on.cypress.io/after-spec-api#Delete-the-recorded-video-if-the-spec-passed

@jamesopti
Copy link

@KhizerRehan There is no way to only record video for 'failed' specs because we don't know what will fail or pass until the tests are over and the recording is done. You can delete the videos for passed specs though with this code: https://on.cypress.io/after-spec-api#Delete-the-recorded-video-if-the-spec-passed

I believe what others and myself are looking for is a way to opt out of sending anything to the dashboard in the event that all tests pass, as this is what counts against the dashboard usage quotas.

I have absolutely no use case for reviewing passed/successful runs on the dashboard, they just burn through the dashboard allocation/quota.

@rnike
Copy link

rnike commented Mar 1, 2022

@jennifer-shehane Is it possible to rerun a test case with video recording on failure? If the test case is successful we can just pass it without recording, if possible this will definite fast up our CI.

@salazarm
Copy link

@KhizerRehan There is no way to only record video for 'failed' specs because we don't know what will fail or pass until the tests are over and the recording is done. You can delete the videos for passed specs though with this code: https://on.cypress.io/after-spec-api#Delete-the-recorded-video-if-the-spec-passed

If a test fails, you could run the test again and record it that time.

@hilmanski
Copy link

I write a blog post about this https://onebite.dev/disable-video-recording-when-running-cypress/ with other information regarding video recording

TLDR;

import { defineConfig } from 'cypress'

export default defineConfig({
    e2e: {
        setupNodeEvents(on, config) {
            // implement node event listeners here
        },
    },
    video: false,
})

in your cypress setting

@kleinfreund
Copy link

I found that cypress run --config video=true doesn’t turn on the video setting if it’s turned off in the config. What does seem to work is using CYPRESS_video=true:

CYPRESS_video=true cypress run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests