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

Fix: Remove Non-Existent Video File in after:spec Handler #3737

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ugiordan
Copy link

@ugiordan ugiordan commented Feb 7, 2025

Description

During test execution with the Firefox browser, Cypress was failing with the following error:

> npm run cypress:run:mock -- --browser=firefox 
Warning: We failed capturing this video.

This error will not affect or change the exit code.

Error: Insufficient frames captured to create video.
    at ChildProcess.<anonymous> (<embedded>:778:16306)
    at ChildProcess.emit (node:events:514:28)
    at Process.onexit (node:internal/child_process:291:12)
An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

Error: ENOENT: no such file or directory, unlink '<path-to-workdir>/odh-dashboard/frontend/src/__tests__/cypress/results/mocked/videos/application.cy.ts.mp4'
    at Object.unlinkSync (node:fs:1954:11)
    at Object.handler (<path-to-workdir>/odh-dashboard/frontend/src/__tests__/cypress/cypress.config.ts:127:16)
    at RunPlugins.invoke (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:185:25)
    at /Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:59:14
    at tryCatcher (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/method.js:39:29)
    at Object.wrapChildPromise (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:58:23)
    at RunPlugins.execute (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:164:21)
    at EventEmitter.<anonymous> (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:56:12)
    at EventEmitter.emit (node:events:507:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:26)
    at process.emit (node:events:507:28)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Library/Caches/Cypress/13.16.0/Cypress.app/Contents/Resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
    at emit (node:internal/child_process:949:14)
    at processTicksAndRejections (node:internal/process/task_queues:91:21)

This occurred due to insufficient frames being captured by Cypress (likely caused by Firefox being unable to record videos). Since the video file was not created, unlinkSync failed when trying to delete it. This led to an ENOENT error.

How Has This Been Tested?

  • The fix was tested by running Cypress tests with Firefox with the command npm run cypress:run:mock -- --browser=firefox
  • After applying the fix, tests were rerun, and the error no longer occurred when the video file was missing.

Test Impact

  • The fix only impacts the video file removal in tests using Firefox.
  • No other tests were affected.

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • [] Included any necessary screenshots or gifs if it was a UI change.
  • [] Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.27%. Comparing base (1bea3ab) to head (9369428).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3737   +/-   ##
=======================================
  Coverage   84.26%   84.27%           
=======================================
  Files        1464     1464           
  Lines       33764    33764           
  Branches     9361     9361           
=======================================
+ Hits        28452    28453    +1     
+ Misses       5312     5311    -1     

see 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bea3ab...9369428. Read the comment docs.

@ugiordan
Copy link
Author

ugiordan commented Feb 7, 2025

/cc @lucferbux @andrewballantyne

@andrewballantyne
Copy link
Member

/assign @manosnoam @antowaddle

Mind reviewing this?

Copy link
Contributor

@antowaddle antowaddle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ugiordan Can you please test this on Jenkins also? cypress/job/dashboard-tests/ is the Jenkins job we are currently using. Can you also please confirm that there are no negative consequences when running the Cypress tests on Chrome?

@ugiordan
Copy link
Author

ugiordan commented Feb 7, 2025

@ugiordan Can you please test this on Jenkins also? cypress/job/dashboard-tests/ is the Jenkins job we are currently using. Can you also please confirm that there are no negative consequences when running the Cypress tests on Chrome?

@antowaddle I ran the test using the Jenkins pipeline, and everything went smoothly. No issues with Cypress tests on Chrome.

@antowaddle
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Feb 7, 2025
@ugiordan ugiordan force-pushed the fix/cypress-video-recording-failing branch from c1749f7 to 9369428 Compare February 7, 2025 16:44
@openshift-ci openshift-ci bot removed the lgtm label Feb 7, 2025
Copy link
Contributor

openshift-ci bot commented Feb 7, 2025

New changes are detected. LGTM label has been removed.

Copy link
Contributor

openshift-ci bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from antowaddle. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@antowaddle
Copy link
Contributor

/cc @manosnoam

@openshift-ci openshift-ci bot requested a review from manosnoam February 10, 2025 09:08
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

Successfully merging this pull request may close these issues.

4 participants