0
0
Cypresstesting~20 mins

Full-page screenshots in Cypress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Full-page Screenshot Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the result of this Cypress command?
Consider the following Cypress test code snippet that takes a full-page screenshot. What will be the outcome after running this test?
Cypress
cy.visit('https://example.com')
cy.screenshot({ capture: 'fullPage' })
AA full-page screenshot of https://example.com is saved in the default screenshots folder.
BThe screenshot is saved but only includes the header section of the page.
CThe test throws an error because 'capture' is not a valid option for cy.screenshot.
DOnly the visible viewport area of https://example.com is captured and saved.
Attempts:
2 left
💡 Hint
The 'capture' option controls what part of the page is captured in the screenshot.
assertion
intermediate
2:00remaining
Which assertion correctly verifies a full-page screenshot was taken?
You want to confirm that a full-page screenshot was saved with the correct file name pattern after running cy.screenshot({ capture: 'fullPage' }). Which assertion is correct?
Cypress
cy.screenshot('homepage', { capture: 'fullPage' })
// Which assertion below correctly checks the screenshot file?
Acy.get('screenshot').should('have.attr', 'data-capture', 'fullPage')
Bcy.task('findScreenshot', 'homepage').should('include', 'fullPage')
Ccy.screenshot('homepage').should('have.property', 'capture', 'fullPage')
Dcy.readFile('cypress/screenshots/homepage.png').should('exist')
Attempts:
2 left
💡 Hint
Screenshots are saved as files in the screenshots folder.
🔧 Debug
advanced
2:00remaining
Why does this full-page screenshot command fail?
This Cypress test tries to take a full-page screenshot but fails with an error. What is the most likely cause?
Cypress
cy.visit('https://example.com')
cy.screenshot({ capture: 'fullpage' })
Acy.screenshot does not support the 'capture' option at all.
BThe option value 'fullpage' is case-sensitive and should be 'fullPage'.
CThe URL https://example.com does not allow screenshots.
DThe test must scroll the page manually before taking a full-page screenshot.
Attempts:
2 left
💡 Hint
Check the exact spelling and casing of option values.
framework
advanced
2:00remaining
How to configure Cypress to always take full-page screenshots on test failure?
You want Cypress to automatically take full-page screenshots whenever a test fails. Which configuration snippet achieves this?
AIn cypress.config.js, set: { screenshotsFolder: 'cypress/screenshots', screenshotOnRunFailure: true, screenshotOptions: { capture: 'fullPage' } }
BIn cypress.config.js, set: { screenshotOnRunFailure: true, screenshot: { capture: 'fullPage' } }
CIn cypress.config.js, set: { screenshotOnRunFailure: true, screenshotOnFailureOptions: { capture: 'fullPage' } }
DIn cypress.config.js, set: { screenshotOnRunFailure: true, screenshotOnRunFailureOptions: { capture: 'fullPage' } }
Attempts:
2 left
💡 Hint
Look for the official Cypress config option names for screenshots.
🧠 Conceptual
expert
2:00remaining
What is a limitation of full-page screenshots in Cypress?
Which of the following is a known limitation when using Cypress to capture full-page screenshots?
AFull-page screenshots automatically scroll the page but do not stitch images together.
BFull-page screenshots always include browser UI elements like address bar and tabs.
CFull-page screenshots may not capture content inside iframes correctly.
DFull-page screenshots cannot be taken on pages with any scrollable content.
Attempts:
2 left
💡 Hint
Think about what content is outside the main page DOM.