question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

different screen shots for the same test

See original GitHub issue

I run the same exact test multiple time, which basically opens up a static page and compares screens each time the screen shot is slightly different as if its ignoring the capture setting or the resolution, i tried viewport and full screen, what else am I missing?

cy.visit(/kits/1233) cy.wait(900) cy.document().toMatchImageSnapshot({ name: 1233 })

this is my “env”: { “cypress-plugin-snapshots”: { “autoCleanUp”: true, “autopassNewSnapshots”: true, “excludeFields”: [], “imageConfig”: { “createDiffImage”: true, “resizeDevicePixelRatio”: true, “threshold”: 0.01, “thresholdType”: “pixel” }, “screenshotConfig”: { “blackout”: [], “capture”: “viewport”, “clip”: null, “disableTimersAndAnimations”: true, “log”: true, “scale”: false, “timeout”: 30000, “log”: true } } }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
askirmascommented, May 31, 2020

Check your cypress run parameters like browser - it sounds like you’re running chrome and electron. Also for applying viewport sizes I added to cypress/plugins/index.js

  const {viewportWidth: w, viewportHeight: h} = config
  on('before:browser:launch', (browser = {}, launchOptions) => {
    switch (browser.name) {
      //browser.family === 'chromium' && browser.name !== 'electron')
      case 'chrome':
        launchOptions.args.push(`--window-size=${w},${h}`)
        /*
        launchOptions.push('--cast-initial-screen-width=1600')
        launchOptions.push('--cast-initial-screen-height=900')
         */
        break
      case 'electron':
        launchOptions.preferences.width = w;
        launchOptions.preferences.height = h;
        break
    }
    return launchOptions
  })  

It is from some not shallow cypress documentation

0reactions
davidkhesscommented, Jun 17, 2020

Forcing chrome to a particular size with the fix above to cypress/plugins/index.js worked for me. It appears that chrome was running at a slightly different window size with cypress run vs. with cypress open. Using this to force the same size on both fixed it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Screenshot Testing On Real Browsers & Devices - BrowserStack
Generate Screenshots of your Website on Chrome, IE, Firefox and Safari to test for Cross Browser compatibility on desktop browsers and real mobile...
Read more >
Visual Testing using Screenshot Comparison - Ghost Inspector
Ghost Inspector is capable of tracking what your website is supposed to look like via our visual testing screenshot comparison feature.
Read more >
What is Screenshot Testing? - Medium
Screenshot Testing is a technique used by end-to-end testing which captures a screenshot from an URL and then compares the result with an ......
Read more >
Screenshot Testing with Selenium, Cypress and Playwright
Capturing screens is a fundamental piece of testing web assets and reporting defects. There are other use cases for these screenshots, too.
Read more >
Perform Automated Screenshot Testing - LambdaTest
At LambdaTest, you can capture up to 25 screenshots of different browsers and OS configurations in a single session. You can choose from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found