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

Test failing because of images sizes are not same #219

Open
Anuradha4dm opened this issue Aug 11, 2021 · 5 comments
Open

Test failing because of images sizes are not same #219

Anuradha4dm opened this issue Aug 11, 2021 · 5 comments

Comments

@Anuradha4dm
Copy link

Anuradha4dm commented Aug 11, 2021

when the test is running in different monitors , passing only the monitor that base image is taken. I have taken the initial image (base image) in a large screen and when i try to run the test in smaller screen then the error pop up

this is the configuration

addMatchImageSnapshotCommand({ failureThreshold: 0.01, //threshold for entire image failureThresholdType: 'percent', //percent of image or number of pixels customDiffConfig: { threshold: 0.1 }, //threshold for each pixel capture: 'viewport', //capture viewport in screenshot allowSizeMismatch:true });

this is the error message
error

@Vishwaas
Copy link

even with viewport this issue exists, I believe the issue is already raised

@hassanzohaib
Copy link

There is no solution for this. You have to use the same docker container everytime to get the same size images.

@Vishwaas
Copy link

wouldnt that make testing extremely difficult

@leonid-sviderskii-mtl
Copy link

Free screenshot comparison cannot be easy :) Here, Gleb was explaining the things related to the question.

@sirganya
Copy link

sirganya commented Jan 7, 2022

I managed to get cypress to work on macOS where it produces the same screenshots in the runner and e2e-headless.

I haven't tested in CI yet.

When you run cypress for e2e be sure to use the browser chrome flag in a before browser launch event.

./node_modules/.bin/cypress run --browser chrome

and then add these chrome flags to plugins/index.js

 on("before:browser:launch", (browser, launchOptions) => {
      console.log("launching browser %s is headless? %s",
        browser.name,
        browser.isHeadless
      );

    if (browser.name !== "chrome") throw new Error("Must use Chrome");

    launchOptions.args.push("--force-device-scale-factor=1");
    launchOptions.args.push("--disable-gpu");
    launchOptions.args.push("--force-color-profile=srgb");

    // IMPORTANT: return the updated browser launch options
    return launchOptions;
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants