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

Allow configuration of capture option for screenshots taken during failure #5920

Open
svobom57 opened this issue Dec 9, 2019 · 7 comments
Open
Labels
E2E Issue related to end-to-end testing topic: screenshots 📸 type: enhancement Requested enhancement of existing feature

Comments

@svobom57
Copy link

svobom57 commented Dec 9, 2019

Current behavior:

When my test fails, the screenshot taken is always captured in the runner size as per the documentation: https://docs.cypress.io/api/cypress-api/screenshot-api.html#Arguments:

For screenshots automatically taken on test failure, capture is always coerced to runner.

I was curious, why that's the case? I think it'd be beneficial to be able to override this configuration even for the screenshot on failure:

Cypress.Screenshot.defaults({
  capture: 'fullPage'
})

Often times I find myself looking at a failure video where Cypress can't find an element and I'm only seeing a portion of the page which isn't really helpful.

Desired behavior:

When I configure Cypress to capture screenshots like so:

Cypress.Screenshot.defaults({
  capture: 'fullPage'
})

I expect Cypress to take screenshot of the Full Page on failure rather than always taking runner despite the configuration.

Versions

Cypress 3.7.0, MacOS: 10.14.6

@jennifer-shehane jennifer-shehane changed the title Captured screenshots on failure being coerced to runner Allow configuration of capture option for screenshots taken during failure Dec 13, 2019
@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Dec 13, 2019
@jennifer-shehane jennifer-shehane added type: enhancement Requested enhancement of existing feature topic: screenshots 📸 stage: proposal 💡 No work has been done of this issue and removed stage: proposal 💡 No work has been done of this issue labels Dec 13, 2019
@karthi07
Copy link

Can I work on this ?

@jennifer-shehane
Copy link
Member

@karthi07 Yes we would love an open PR - even one that is a work in progress is fine. Check out our contributing doc and ask us if you get stuck.

@Seitar18
Copy link

Seitar18 commented Apr 9, 2021

Any news?
Still actual.

@kizylirio
Copy link

Any idea about how bypass it?

@johnnylopes
Copy link

johnnylopes commented Mar 3, 2022

any workaround for this? @karthi07 @jennifer-shehane @svobom57

is it possible to overwrite that default settings inside the support/index.js file, so it can be also applied on test failures?

@cypress-bot cypress-bot bot added stage: backlog and removed stage: proposal 💡 No work has been done of this issue labels Apr 29, 2022
@astone123 astone123 self-assigned this Sep 28, 2022
@astone123
Copy link
Contributor

So I think there are two different ways that we could go about offering a configuration for this:

  1. Add a new configuration option to screenshot, possibly captureOnRunFailure which takes the same options as capture

or

  1. Update the screenshotOnRunFailure option to accept values for screenshot.capture (runner, fullPage, viewport, or off), rather than true/false (this would be a breaking change)

Routing this to e2e core

@astone123 astone123 removed their assignment Sep 29, 2022
@thomasKuntermannDiva-e
Copy link

does the following also belongs to this thread or may I open another one(?):

  • when using cy.screenshot({capture: 'viewport'}) and we have Cypress env settings like viewportWidth & viewportHeight, I would expect that screenshots are taken with the custom dimensions. But Cypress currently makes screenshots in the Cypress Runner dimensions, in our case 1280x720, and not our custom settings. Only "fullpage" fits to our requirements, to have a high resolution screenshot.

@jennifer-shehane jennifer-shehane added E2E Issue related to end-to-end testing and removed stage: routed to e2e-core labels Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing topic: screenshots 📸 type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

8 participants