cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.41k stars 3.2k forks source link

fix: prevent overwriting of video files #30673

Open YJDoc2 opened 3 days ago

YJDoc2 commented 3 days ago

Additional details

Why was this change necessary?

Currently multiple runs of cypress in same dir (with trashAssetsBeforeRuns=false) will keep the screenshots files across runs, but will overwrite the video file. For more details, please check the issue discussion.

What is affected by this change?

The videos dir will now retain existing video files if trashAssetsBeforeRuns=false is set

Any implementation details to explain?

Nothing much, I have moved the getPath function used for generating screenshot paths into fs.ts from screenshot.js and did some minor modifications to accommodate both screenshots and videos. There is one "hack" which I'm not sure how to fix, help appreciated :

Steps to test

For current develop branch,

How has the user experience changed?

They will keep the videos from previous runs if any.

PR Tasks

CLAassistant commented 3 days ago

CLA assistant check
All committers have signed the CLA.

cypress-app-bot commented 3 days ago
YJDoc2 commented 3 days ago

Not sure why semantic CI is failing, I have added changelog entry. I don't think this will make to the next release so might have to update it later.

btw, this PR is ready for review.

MikeMcC399 commented 3 days ago

@YJDoc2

Not sure why semantic CI is failing, I have added changelog entry. I don't think this will make to the next release so might have to update it later.

The previous PR introduced an unwanted blank line 2 which is causing your failure.

https://github.com/cypress-io/cypress/blob/12df40ed8c1101c5c4053a1fe63c06fcd2809bc7/cli/CHANGELOG.md?plain=1#L1-L3

The blank line should be removed.

YJDoc2 commented 2 days ago

Hey @MikeMcC399 , thanks for the help! I have fixed the changelog and pushed.