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?
✗ Incorrect
The correct Cypress command to take a screenshot with a custom name is cy.screenshot('filename').
Where does Cypress save screenshots by default?
✗ Incorrect
Cypress saves screenshots in the cypress/screenshots folder by default.
How do you capture a screenshot of only a button with id 'submit'?
✗ Incorrect
Use cy.get('#submit').screenshot() to capture only the button element.
Which option captures the full page screenshot?
✗ Incorrect
The correct option is { capture: 'fullPage' } to capture the entire page.
What happens if you call
cy.screenshot() without arguments?✗ Incorrect
Cypress takes a screenshot with a default auto-generated name if no argument is provided.
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.