Closed ctigelaar closed 2 years ago
It works btw when you use config with Windows paths, eg:
{
...,
"videosFolder": "../../dist/cypress/apps/my-app-e2e/videos",
"screenshotsFolder": "..\\..\\dist\\cypress\\apps\\my-app-e2e\\screenshots",
"downloadsFolder": "../../dist/cypress/apps/my-app-e2e/downloads",
...
}
But the main issue remains, that the .replace()
is not respecting OS path separators, while Cypress itself apparently does.
I tried to replicate the bug with cypress v10 and everything works as expected.
Can you try to upgrade?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Environment
What happened?
Trying to implement reports with embedded screenshots, but I'm receiving an error
no such file or directory
on trying to read the screenshot file. I did some research myself and the paths set by theregister.js
file are not correct on Windows. The Cypress config uses unix-like paths like../../folder/where/screenshots/are
(because we run CI on Linux agents), but running it locally the incoming filenames have a Windows path with Windows path separators like..\..\folder\where\screenshots\are
.Inside method
saveScreenshotReference
inregister.js
you're roughlyString.replace
-ing these both values, to get a relative path to the image file, without the value ofscreenShotFolder
. Thisreplace
is simply not working on Windows, because the two values have no overlap because of the non-matching path separators.It's fixable by using
details.path.split('\\').join('/');
on the incoming filepath of the image, but then I would make the assumption given config paths are always unix-style, and I may be introducing other issues elsewhere. Hence the fact I didn't offer a PR, but opened an issue.Config file
Relevant log output
Anything else?
No response