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

Video is not recorded #25964

Closed
Tatev777 opened this issue Feb 27, 2023 · 3 comments
Closed

Video is not recorded #25964

Tatev777 opened this issue Feb 27, 2023 · 3 comments
Assignees

Comments

@Tatev777
Copy link

Tatev777 commented Feb 27, 2023

Current behavior

Previously, when my tests fell, immediately after the fall, Cyprus tried to re -run the current case. And after a second fall, Cyprus checked the next case. It took a lot of time, so I decide to stop the current test after the second fall.
I have added code below to e2e.js file, but after that if test fails then it's not visible in allure report. But in console I see that video is captured

  -  Started processing:  Compressing to 32 CRF                                                     
  -  Finished processing: 12 seconds                                                 

  -  Video output: /var/lib/jenkins/workspace/Autotests_monitoring/autotests/cypress/videos/TestLogin.cy.js.mp4

    Compression progress:  100%

Also while running locally I didn't get video of failure. It seems that there is not enough time(before cypress runner stop) for compressing video.

Desired behavior

How can I stop test after video is captured and compressed?

Test code to reproduce

 afterEach(function onAfterEach() {
    const attempt = Cypress.currentRetry;
    cy.log(attempt)
    if(attempt == 1){
    	if (this.currentTest.state === 'failed') {
    		Cypress.runner.stop();
    	}
    }
 });

Cypress Version

12.7.0

Node version

16.11.0

Operating System

MACOS 12.6

Debug Logs

No response

Other

No response

@marktnoonan
Copy link
Contributor

Hi @Tatev777, I think you may have better luck if you modify the retries config value itself, rather than calling Cypress.runner.stop() in the afterEach hook. I haven't looked in detail but I suspect that would cut off any process like video compression that might still be in progress at the time it is called, as you mentioned.

It is possible to configure at the test level like this:

it('retries', { retries: 1 }, () => {
  // your test code
})

Or you could do this in your Cypress config file where retries are configured.

Let me know if this addresses your problem, I might be missing something.

@marktnoonan marktnoonan self-assigned this Feb 27, 2023
@Tatev777
Copy link
Author

Tatev777 commented Feb 27, 2023

Hi @marktnoonan
I have already modified cypress.config.js. I have several tests(describe), each test has several cases(it). Now if one test case fail, cypress try to re -run the current test case. After the second fail cypress run remaining test cases in current test. The remaining cases also fall because our tests mainly e2e. So it takes too much time to run/rerun remaining test cases, to capture/compress video.
Is there a way to skip remaining test cases after the second fail/video capture and save time?

  retries: {
    runMode: 1,
    openMode: 1,
  },

@mike-plummer
Copy link
Contributor

Hi @Tatev777 . It sounds like you're describing our Auto Cancellation feature which is available on Business and Enterprise plans when running in CI. There is not currently an official way to perform your exact use case locally. Video post-processing occurs outside the spec execution events flow, so you would need to either put in hardcoded waits or use cross-test state to short-circuit the remaining tests in your suite after the first failure.

The ability to cancel/skip the rest of a run on first failure has been discussed in-depth in a previous issue - the discussion in that issue may provide some guidance or insight to help find a solution for your specific use case.

@mike-plummer mike-plummer closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants