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.

Screenshot path is different when running headless and open

See original GitHub issue

Current behavior

While using cypress-image-snapshot I noticed that, since Cypress v10, the path where screenshots (or snapshots in this case) are saved differs when Cypress is run in headless and open modes. I only noticed this issue when having features organised inside folders. So, imagine I have this structure for my tests:

- cypress
    - e2e
        - testFolder1
            - testFeature1.cy.feature
        - testFolder2
            - testFeature2.cy.feature

Now, if I run testFeature1 in open mode, snapshot is saved at cypress/snapshots/testFeature1.png, but when I ran headless mode, the snapshot is saved at cypress/snapshots/testFolder1/testFeature1.cy.feature/testFeature1.png .

An issue is open an cypress-image-snapshot board, but it looks like this is the expected behaviour?

Desired behavior

Screenshots should be stored in the same folder, no matter if it’s launched in open or headless mode.

Test code to reproduce

Simply execute: cy.matchImageSnapshot(snapshot);

Cypress Version

10.2.0

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
marktnoonancommented, Jul 19, 2022

Hi @baronvonbirra, you’re correct that as of Cypress 10 and the switch from testFiles to specPattern this is currently expected. You’re not the first person to mention this change is confusing so I’m going to keep this issue open as a feature request – or possibly convert it to a GH discussion.

0reactions
0xc0d3rcommented, Aug 4, 2022

@nagash77 @marktnoonan Can you suggest any workaround for now? Our internal test reports were broken as screenshots and videos are not loading.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium webdriver screenshot is different when using
I have tried different browsers and ways (opening in new tab and switching but not working when using '--headless') but not working... Any...
Read more >
Using a headless browser to capture page screenshots
A headless browser is a browser without the graphical user interface. It is a way to navigate the web via the command line....
Read more >
Issue #211 · mattheworiordan/capybara-screenshot - GitHub
The issue is that capybara-screnshot decides what driver you're using based on what you call it, not what it actually is. Headless Chrome...
Read more >
Chrome and Firefox Can Take Screenshots of Sites From the ...
Both Chrome and Firefox have the ability to take screenshots of web sites directly from the command line. This allows you to create...
Read more >
How to take screenshots using Puppeteer and Headless ...
Using headless Chrome to take screenshots of a website requires properly connecting the chrome-headless service container to the Node library ...
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