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 recorded is incomplete - last frames before tests are complete are not recorded #2370

Closed
PinkyJie opened this issue Aug 19, 2018 · 22 comments · Fixed by #4804
Closed

Comments

@PinkyJie
Copy link

Current behavior:

When running with cypress run --record, the generated mp4 video file is incomplete, it does not wait for testing to be finished.

Desired behavior:

The generated video file should be able to record the whole testing process.

Steps to reproduce:

Check an example here in Cypress Dashboard: (it's a public project so I assume you can all access this)

https://dashboard.cypress.io/#/projects/nf8wkk/runs

There are 2 runs, one is recored from Mac, another one is from Linux on Travis CI, the generated videos files from both of them are incomplete.

Here is my project for reference https://github.com/PinkyJie/cypress-auto-stub-example

Versions

Cypress: 3.1.0
System: Mac 10.12
Browser: Chrome 68

@brian-mann
Copy link
Member

brian-mann commented Aug 19, 2018

This isn't a bug - we're really talking about maybe just a couple frames here. It is in fact recording everything, but the test runner UI uses react, which renders asynchronously (and the browser itself paints asynchronously) and therefore there's no guarantee that those frames are ever actually rendered before the browser itself shuts down.

The test itself has already passed and therefore the browser is killed. Closing as not a bug.

For this to "show" up we would have to artificially extend the run by a couple seconds which seems unnecessary considering there isn't really any useful information in the last couple frames. Had you run more tests the video would have covered all of them.

@Yaowenjie
Copy link

Yaowenjie commented Jan 24, 2019

I have similar issue, but it only happens in Linux, not for Mac.

Actually it is not only incomplete, but also intermittent. You can see the video runs fine in first 3 to 5 seconds, then the video stay there for about 10 seconds, in the end of the video you might see one second view of moment of next steps. Videos becomes useless if they are always like this. But it works very well in Mac. Does anyone has same issue?

By the way, we use chrome67-ff57 docker images with cypress installed to run it, is it also related to this issue?

@danverde
Copy link

I'm having a similar issue as well but on Mac.
My spec file has 11 tests all with multiple assertions (they're not small tests). All my tests pass, but the video ends halfway through the 9th test. If not having enough tests in a spec file can cause this issue then how many tests are required before this is no longer an issue?

@jennifer-shehane
Copy link
Member

I've seen this issue crop up more recently. It does not generally look to be a couple of frames, but swaths of the video freeze during the video.

@platan
Copy link

platan commented Apr 3, 2019

In our case is just a matter of last frames. Currently we have only one test. We are using cypress 3.2.0 + docker cypress/base:8. An example incomplete video: https://47779-7910045-gh.circle-artifacts.com/0/root/project/cypress/videos/main-page.spec.js.mp4 (artifact from https://circleci.com/gh/badges/shields/47779#artifacts/containers/0). At the end this should be shown:
Screenshot from 2019-04-02 20-23-29
As @brian-mann said, this not a big problem when test is passing. But it would be valuable to have full video then test is failing (I don't know if video is incomplete in this case).

@szokrika
Copy link

szokrika commented Apr 8, 2019

With version 3.2.0:
Same here, I can confirm that a few frames are missing from the end of the generated video...

@szokrika
Copy link

szokrika commented Apr 9, 2019

I've kind of 'made it work' by adding a wait(1000) to the end of the test...

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue type: bug labels Apr 24, 2019
@cypress-bot cypress-bot bot added stage: needs investigating Someone from Cypress needs to look at this and removed stage: needs information Not enough info to reproduce the issue labels Apr 25, 2019
@austinfox
Copy link
Contributor

I can confirm that I am seeing large amounts of my recordings "frozen". The first few seconds of the video are fine and then the the video hangs for the rest of the test. Sometimes the video resumes for a short period later on in the tests, but only for a short while until it freezes again. This seems to be transient for me, not happening to any particular test all the time. This has been an issue ever since upgrading to 3.2.0

@pisti2010
Copy link

I also join and confirm this is an issue for us. The video starts fine for about 5sec, then it gets "stuck" or "frozen" and stays like that for the whole duration of the test, usually between 40sec to 1min30sec.
The issue seems to be completely random. It does not happen all the time, it does not happen to the same test files.
We run out tests on GitlabCi. If I can offer any information to help diagnose this please let me know.

@maryhipp
Copy link

We are also seeing this issue with recordings on our Cypress Dashboard using cypress v3.2.0. It doesn't happen on every video, but it does happen often (maybe 7 times out of 10). It will freeze around the 1 minute mark and sometimes recovers, sometimes doesn't, in which case we essentially lose the entire recording. I have tried with and without video compression and doesn't seem to impact.

Our tests run on Jenkins. Happy to offer more info if I can!

@platan
Copy link

platan commented May 16, 2019

We have the same issue in https://github.com/badges/shields. Example videos https://52855-7910045-gh.circle-artifacts.com/0/root/project/cypress/videos/main-page.spec.js.mp4, https://53812-7910045-gh.circle-artifacts.com/0/root/project/cypress/videos/main-page.spec.js.mp4. But I think that these "frozen" videos are a separate problem. Original problem described in this issue is about incomplete videos.

@jennifer-shehane
Copy link
Member

@platan I agree, the issue with the Test Runner rendering 'freezing' during video record is a different issue than a video ending prematurely - so that the last frames of the test running are not present at all in the video.

@pisti2010 @maryhipp Can you open a separate issue about 'freezing' videos?

@jennifer-shehane jennifer-shehane changed the title Video recorded is incomplete Video recorded is incomplete - last frames before tests are complete are not recorded Jul 16, 2019
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jul 16, 2019

❗️ I opened a new issue for when the UI appears to 'freeze' or be frozen during the video recording here: #4722

❓ If you're having the issue where the video recording clearly finishes without the last frames of the test run being recorded at all - please comment in this issue, ideally with all of your environment information:

  • Cypress version? - PLEASE update to latest version and see if this still happens
  • Operating System?
  • CI?

@WillsB3
Copy link

WillsB3 commented Jul 24, 2019

I'm also having this issue. The recording is missing at least 2-3 seconds (maybe more) from the end. (e.g. the video ends before the last test is even in progress).

I've observed this when running cypress locally with npx cypress run on MacOS 10.14.5, and I've also seen the same issue when Cypress is running in GitLab CI.

This is with Cypress 3.4.0.

@bahmutov bahmutov self-assigned this Jul 24, 2019
@bahmutov
Copy link
Contributor

Let me take a look, because missing last frames of the video are very annoying, seeing it in https://github.com/bahmutov/cypress-test-clock

end

We should probably wait better for the video frames to arrive after the spec is over and before we close the Electron browser.

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs investigating Someone from Cypress needs to look at this labels Jul 24, 2019
@WillsB3
Copy link

WillsB3 commented Jul 24, 2019

Having thought about this a little more - I wonder if what I was seeing is more related to #4722 - Perhaps the video is freezing during the last test and so it appears as though the video is being cut off when actually it's missing frames because of the freezing…

@bahmutov
Copy link
Contributor

yeah @WillsB3 the freezing of the video seems to be a different issue from us closing the Electron before last video frames are received and encoded.

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Jul 24, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jul 29, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 29, 2019

The code for this is done in cypress-io/cypress#4804, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 29, 2019

Released in 3.4.1.

@Dksoni81291
Copy link

I'm using Cypress v3.5.0, but still I'm not getting full video execution of my spec file run.

@rightsaidjames
Copy link

We are using 3.6.1 and are still encountering missing frames at the end of passing test runs. One workaround I've discovered is that if we add a cy.screenshot() command in an after block in index.js then the video will cut off at the point that the screenshot command is fired, hence all of the tests will have completed at the point that the video cuts off:
Screenshot 2019-11-27 at 14 22 18

... but obviously this workaround probably isn't very performant, and it still doesn't show the final state of the test run - it just so happens that the final state (the taking of the screenshot) is no longer important.

@jennifer-shehane
Copy link
Member

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@cypress-io cypress-io locked and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.