Recall & Review
beginner
What is Cypress used for in software testing?
Cypress is a tool used to write and run tests that check if web applications work correctly by simulating user actions in a browser.
Click to reveal answer
beginner
What does the command
cy.visit('https://example.com') do in a Cypress test?It opens the web page at 'https://example.com' inside the test browser so Cypress can interact with it.
Click to reveal answer
beginner
In Cypress, how do you check if a page contains the text 'Welcome'?
You use
cy.contains('Welcome') which looks for that text on the page and passes if found.Click to reveal answer
intermediate
Why is it important to use clear and simple selectors in Cypress tests?
Clear selectors make tests easier to read and less likely to break if the page changes, helping tests stay reliable.
Click to reveal answer
beginner
What does the
describe block do in a Cypress test file?It groups related tests together under a common name, making the test output organized and easier to understand.
Click to reveal answer
Which Cypress command opens a web page for testing?
✗ Incorrect
The correct command to open a page is cy.visit().
How do you check if a button with text 'Submit' exists on the page in Cypress?
✗ Incorrect
cy.contains('Submit') finds any element with the text 'Submit'.
What is the purpose of the
it block in Cypress tests?✗ Incorrect
The it block defines one test case with a description and test steps.
Which of these is a good practice for selecting elements in Cypress tests?
✗ Incorrect
Using data attributes like data-cy keeps selectors stable and tests reliable.
What will happen if an assertion in a Cypress test fails?
✗ Incorrect
Cypress stops the test and reports failure when an assertion fails.
Explain the basic structure of a Cypress test and how it runs a simple check on a web page.
Think about how you tell Cypress what page to open and what to look for.
You got /5 concepts.
Describe why using stable selectors like data attributes is important in Cypress tests.
Imagine if your test breaks every time the page style changes.
You got /4 concepts.