Comments (15)
Hello, I have had a similar issue when running cypress open
locally on a windows machine. After some trial and error I narrowed it down to the setFilePermission
function. It looks like the issue is that after opening and changing the file permissions the file stays open which locks other actions being performed on the given file.
This is a really quick fix adding closeSync
to the end of the function to ensure that the file is closed to give other actions access to the files.
const setFilePermission = (dir, permission) => {
try {
if (fs.existsSync(dir)) {
const fd = fs.openSync(dir, 'r')
fs.fchmodSync(fd, permission)
fs.closeSync(fd)
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
}
}
from cypress-image-diff.
@bentleyvk we change the permission of the screenshot so the file can be copied/removed from one folder to the other. I think similar to this issue, there is some confiugration that will fail if we don't set the permission. I think if we copy only instead file permission is not necessary.
Do you have any plan of fixing this or any permanent workaround? I have to stay at 1.15.7 due to this issue.
from cypress-image-diff.
@bentleyvk we change the permission of the screenshot so the file can be copied/removed from one folder to the other. I think similar to this issue, there is some confiugration that will fail if we don't set the permission. I think if we copy only instead file permission is not necessary.
Do you have any plan of fixing this or any permanent workaround? I have to stay at 1.15.7 due to this issue.
yep, I am working on it! I will ask you guys to test it out for feedback soon though
from cypress-image-diff.
I am merging the above PR, it will generate a new version...try it out and let me know...
my understanding is that the failure is here:
_fsExtra["default"].moveSync(originalFilePath, newFilePath, {
overwrite: true
});
so it could mean the the file within compared does not have the permission to be overwritten, so I am granting the most flexible file permission possible so any user could mess with it...
from cypress-image-diff.
@bentleyvk can you share more details?
- where are you running the tests? locally, some remote desktop, docker etc..
- which directory the tests are triggered?
- what OS are you working on..
Before I can fix it I need to replicate it...
I am running locally on Windows 10 Version 20H2 using Docker Desktop with Use the WSL 2 based engine
enabled (when it is disabled, tests seem to pass but sometimes I get the same permission error).
I have a monorepo with yarn workspaces.
I am starting tests using Node script that runs cypress in docker. Test command is triggered in root directory but scripts run in subrepo.
from cypress-image-diff.
Yup, adding that fixes it for me as well
from cypress-image-diff.
I will add the fix above, thanks so much for sharing @ParsonsProjects
from cypress-image-diff.
I will be having a look at this.
from cypress-image-diff.
I am having the same issue. If I understand correctly it appears only when running Docker Desktop with WSL flag enabled:
Because disabling this flag, tests passes.
Also, when I commented out (0, _utils.setFilePermission)(details.path, 511);
, tests pass even with this flag on.
Here is more info about WSL and file permissions: https://docs.docker.com/desktop/windows/troubleshoot/#permissions-errors-on-data-directories-for-shared-volumes
Just curious why it is needed to change permissions to 511
?
from cypress-image-diff.
@bentleyvk we change the permission of the screenshot so the file can be copied/removed from one folder to the other. I think similar to this issue, there is some confiugration that will fail if we don't set the permission. I think if we copy only instead file permission is not necessary.
from cypress-image-diff.
Can you guys test this out? I assume the problem is overwriting a permissionless file... so adding permission should workaround it:
from cypress-image-diff.
I still get the same error Error: ENOENT: no such file or directory, open '/e2e/demo/cypress-visual-screenshots/comparison/PageLayoutDemo.spec.tsx-basic-3440x1440.png'
😕
I tried removing comparison
folder before running tests but no luck.
from cypress-image-diff.
@bentleyvk can you share more details?
- where are you running the tests? locally, some remote desktop, docker etc..
- which directory the tests are triggered?
- what OS are you working on..
Before I can fix it I need to replicate it...
from cypress-image-diff.
I still having this Error as well, I'll try the solution above and report back if it works in my case
from cypress-image-diff.
@ParsonsProjects fix has now been merged, thanks a lot for contributing team!
from cypress-image-diff.
Related Issues (20)
- A bug of @1.27.0 TypeError: Cannot read properties of undefined (reading 'FAILURE_THRESHOLD') HOT 2
- Modify Reports by optionally specifying a custom hbs in config file HOT 1
- Random failure of a test with captured image of the wrong size HOT 5
- Issue with peerdependency updating Cypress to V13.1.0 HOT 3
- How to disable css animations and transitons using this plugin HOT 3
- Cannot read properties of undefined (reading 'FAIL_ON_MISSING_BASELINE') HOT 7
- Configure reporting assets location HOT 4
- HTML report generation cypress-mochawesome-reporter plugin broken when updating cypress-image-diff-js from V1.26.0 to V1.30.1 HOT 3
- Customizable baseline image name format HOT 9
- In projects with cucumber, the standard json report is not generated HOT 5
- Incorrect Difference Percentage Resulting from compareSnapshot Command HOT 6
- v1.31.0 was a breaking change HOT 3
- Add option to not take full size screenshot HOT 5
- Taken screenshots are not the size I configured HOT 10
- Option to run all tests and get diff files at once even if there are failing ones HOT 2
- Custom config file is not working HOT 14
- Cannot find module cypress-image-diff-js/dist/plugin HOT 12
- Error preparing file: cypress/support/e2e.js HOT 8
- Config "FAILURE_THRESHOLD" did not work HOT 5
- Cypress integration broken: The deleteScreenshot 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task() HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-image-diff.