0
0
Cypresstesting~5 mins

Screenshot capture (cy.screenshot) in Cypress - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does cy.screenshot() do in Cypress?
It takes a screenshot of the current state of the application under test and saves it as an image file.
Click to reveal answer
beginner
How can you name a screenshot file in Cypress?
You can pass a string as an argument to cy.screenshot('filename') to name the screenshot file.
Click to reveal answer
beginner
What is the default folder where Cypress saves screenshots?
Cypress saves screenshots by default in the cypress/screenshots folder inside your project directory.
Click to reveal answer
intermediate
How do you capture a screenshot of a specific element using Cypress?
Use cy.get('selector').screenshot() to capture a screenshot of only the selected element.
Click to reveal answer
intermediate
What option can you use with cy.screenshot() to capture the full page?
Use cy.screenshot({ capture: 'fullPage' }) to capture the entire page, not just the visible viewport.
Click to reveal answer
What is the correct way to take a screenshot named 'login-page' in Cypress?
Acy.screenshot('login-page')
Bcy.takeScreenshot('login-page')
Ccy.captureScreenshot('login-page')
Dcy.saveScreenshot('login-page')
Where does Cypress save screenshots by default?
Acypress/images
Bscreenshots/
Ccypress/screenshots
Dimages/screenshots
How do you capture a screenshot of only a button with id 'submit'?
Acy.capture('#submit')
Bcy.screenshot('#submit')
Ccy.screenshotElement('#submit')
Dcy.get('#submit').screenshot()
Which option captures the full page screenshot?
Acy.screenshot({ capture: 'fullPage' })
Bcy.screenshot({ full: true })
Ccy.screenshot({ page: 'all' })
Dcy.screenshot({ viewport: 'full' })
What happens if you call cy.screenshot() without arguments?
ASaves screenshot to desktop
BTakes a screenshot with an auto-generated name
CDoes nothing
DThrows an error
Explain how to take a screenshot of a specific element and save it with a custom name in Cypress.
Think about chaining commands and naming screenshots.
You got /3 concepts.
    Describe the difference between a viewport screenshot and a full page screenshot in Cypress.
    Consider what part of the page is visible vs entire content.
    You got /3 concepts.