It is testing a website or app at different screen sizes to make sure it looks and works well on all devices like phones, tablets, and desktops.
Click to reveal answer
beginner
Why do we test at different breakpoints?
Because websites change layout and style at certain screen widths called breakpoints, testing ensures the site stays usable and pretty on all devices.
Click to reveal answer
intermediate
How can Cypress help with responsive breakpoint testing?
Cypress can set the browser size to different widths and heights during tests, so you can check how your site behaves at each breakpoint automatically.
Click to reveal answer
beginner
Example of setting viewport size in Cypress?
Use cy.viewport(width, height) to change the browser size. For example, cy.viewport(375, 667) sets the size to a small phone screen.
Click to reveal answer
beginner
What should you check at each breakpoint during testing?
Check that all buttons, text, images, and menus are visible and usable. Also, check that no content is cut off or overlapping.
Click to reveal answer
What does cy.viewport(1024, 768) do in Cypress?
AWaits for 1024 milliseconds
BClicks a button with id 1024
CSets the browser size to 1024 pixels wide and 768 pixels tall
DOpens a new tab with URL 768
✗ Incorrect
cy.viewport(width, height) sets the browser window size to test responsive layouts.
Why is responsive breakpoint testing important?
ATo speed up the website loading time
BTo check if the website works well on different screen sizes
CTo test backend server responses
DTo check spelling mistakes
✗ Incorrect
Responsive breakpoint testing ensures the site looks and works well on phones, tablets, and desktops.
Which of these is NOT a common breakpoint size?
A5000px (super large screen)
B768px (tablet)
C1440px (large desktop)
D320px (small phone)
✗ Incorrect
5000px is not a typical breakpoint size used in responsive design.
In Cypress, how do you test multiple breakpoints efficiently?
AUse cy.viewport() with different sizes inside a loop or multiple tests
BChange the CSS manually each time
CRestart the browser for each size
DUse cy.click() to resize the window
✗ Incorrect
Using cy.viewport() with different sizes in tests automates checking multiple breakpoints.
What should you NOT ignore when testing responsive breakpoints?
AContent visibility and layout
BButton functionality
CText readability
DPage background color
✗ Incorrect
While background color matters, the main focus is on content visibility, layout, and usability.
Explain how you would write a Cypress test to check a website at three different breakpoints.
Think about setting viewport sizes and running assertions for each.
You got /4 concepts.
Why is it important to test responsive breakpoints in automated tests rather than only manually?
Consider benefits of automation vs manual testing.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using cy.viewport() in Cypress tests?
easy
A. To capture screenshots of the current page
B. To speed up test execution by skipping UI rendering
C. To mock API responses during tests
D. To simulate different screen sizes for responsive testing
Solution
Step 1: Understand cy.viewport() role
cy.viewport() changes the browser size to simulate devices.
Step 2: Identify its use in responsive testing
This helps check if UI adapts correctly on phones, tablets, and desktops.
Final Answer:
To simulate different screen sizes for responsive testing -> Option D
Quick Check:
cy.viewport() = simulate screen sizes [OK]
Hint: Remember: viewport changes screen size for layout checks [OK]
Common Mistakes:
Confusing viewport with API mocking
Thinking it speeds up tests by skipping UI
Assuming it captures screenshots
2. Which of the following is the correct syntax for the iPhone 6 viewport preset in Cypress?
easy
A. cy.viewport('iphone-6')
B. cy.viewport(375, 667)
C. cy.viewport('iPhone6')
D. cy.setViewport('iphone-6')
Solution
Step 1: Recall Cypress viewport presets
Cypress supports device names like 'iphone-6' in cy.viewport().
Step 2: Check syntax correctness
cy.viewport('iphone-6') uses correct method and exact device name string.
Final Answer:
cy.viewport('iphone-6') -> Option A
Quick Check:
Correct device name string in cy.viewport() [OK]
Hint: Use exact device names in quotes with cy.viewport() [OK]
Common Mistakes:
Using wrong method name like cy.setViewport()
Incorrect device name casing or spelling
Passing numbers without quotes for presets
3. What will be the result of this Cypress test snippet?