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

Cypress is not able to clean /screenshots #4655

Open
gabbersepp opened this issue Jul 5, 2019 · 2 comments

Comments

2 participants
@gabbersepp
Copy link

commented Jul 5, 2019

Current behavior:

On every run, cypress will clean it's screenshots folder (as mentioned in the documentation). Unfortunately on Windows it is likely that the filenames are too long and thus can not be deleted. When cypress tries to do this, it ignores those files.
We take all screenshots after the test runs and publish them as build artifacts. So this is a problem as we always see old screenshots.

Desired behavior:

Cypress should be able to delete them anyway.

I will use a own build step that uses "rimraf" to do this. maybe cypress should include rimraf or similar for this task?

Steps to reproduce: (app code and test code)

https://github.com/gabbersepp/cypress-test-tiny

Execute cypress from this repo on a Windows 2016 Server.

Please note: It seems that Windows 10 has increased it's max path length. So when using this repo on a Win10 machine, you will have no issues.

Versions

cypress 3.3.2
Windows 10
Chrome: Version 75.0.3770.100 (Offizieller Build) (64-Bit)

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jul 8, 2019

Thanks for providing a reproducible example. We shouldn't be creating screenshot files with a filename that is too long - so that we don't run into a problem deleting them.

There is some code to ensure filename length here: https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/screenshots.coffee#L326

As well as tests here: https://github.com/cypress-io/cypress/blob/develop/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshots_spec.coffee#L243

@gabbersepp

This comment has been minimized.

Copy link
Author

commented Jul 8, 2019

Thanks to make that clear.
Unfortunatelly, this code ensures a max filename length but ignores the directory structure.
In Windows we have 260 chars including the directory structure.

But I am not sure if this needs to be fixed as stated in https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names the new Win10 versions do not have this limitation anymore and also new windows server versions doesn't restrict the length.

By using rimraf I have fixed this for our purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.