Comments (10)
I am facing exactly the same problem as the OP, running cypress 12.17.4 and cypress-image-diff-js1.32.0.
I have set
viewportWidth: 1280,
viewportHeight: 960
In headless mode, the screenshots have the correct size, but in headed mode (cypress open with electron), I get a size of 1414x1060 for a screenshot of the complete viewport.
I could narrow the problem down to desktop scaling in windows. As I have a HiDPI monitor, I configured a scale factor of 110% for my desktop. If I reset the scaling to 100%, then the screenshots have the correct size.
I hope this information is helpful to you.
from cypress-image-diff.
Hi @uhlstefa
Did you install the correct package? I see you referencing it as a dependency like
"cypress-image-diff": "^2.0.0"
which is NOT this plugin.
Our latest version is 1.32.0 and you can install it by npm i -D cypress-image-diff-js
. Make sure add "js" at the end of the package name.
from cypress-image-diff.
I removed the not necessary package. don't know why i had installed it.
Anyway, the issue remains.
But seems it is cause of this:
https://www.cypress.io/blog/2021/03/01/generate-high-resolution-videos-and-screenshots
from cypress-image-diff.
We recommend running tests in docker (headless) to avoid compatibility issues.
from cypress-image-diff.
I saw some issues with screen resolution today. I will try to investigate it further this week. @uhlstefa
Even though I was running the tests in docker. The captured screenshot resolution was different.
Quick findings:
- I set resolution to
1920x1080
- With
[email protected]
version the screenshots were captured as1920x951
- With
cypress@^12.0.0
version the screenshots were captured as1920x1080
as expected
In the meantime, can you check if your issue persist with version 12.8.0?
from cypress-image-diff.
This issue is stale because it has been open for 30 days with no activity.
from cypress-image-diff.
I had the same problem here and was able to workaround it with an environment variable for Windows cmd and powershell:
For Electron:
cmd.exe:
set ELECTRON_EXTRA_LAUNCH_ARGS=force-device-scale-factor=1
powershell:
$env:ELECTRON_EXTRA_LAUNCH_ARGS='force-device-scale-factor=1'
see https://docs.cypress.io/api/plugins/browser-launch-api#Modify-Electron-app-switches
And for Edge it works as an option as in the first post above:
on('before:browser:launch', (browser = {}, launchOptions) => {
[...]
if (browser.name === 'edge') {
launchOptions.args.push('--force-device-scale-factor=1');
}
}
from cypress-image-diff.
Thank you @ElSuture , this is a very helpful advice! I tested it for Electron, and it works.
For me, it now needs the combination of 2 measures to capture screenshots with the correct size in the cypress gui, independently from the scaling I set up for my windows desktop:
- Setting the environment variable like @ElSuture explained it
- Running the Cypress GUI in fullscreen mode
If I run the Cypress GUI in windowed mode, then the screenshots are still taken at a lower resolution than configured.
From my understanding, the need for both measures is independent from the plugin implementation, and maybe could be circumvented by the devs of the Cypress GUI. So in my opinion, this bug can be closed, but it would be nice to have both measures documented somewhere...
from cypress-image-diff.
Related Issues (20)
- 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
- 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
- User config error `cypress-image-diff.config.js`
- Missing JSON report when in `cypress OPEN` mode HOT 3
- Unable to update folder locations HOT 5
- Unable to generate JSON REPORT under Folder cypress-image-diff-html-report HOT 1
- Specify shared location/path for Screenshots and Reports HOT 2
- Package subpath './dist/plugin' is not defined by "exports"... HOT 8
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.