Execution Trace Quiz - 1 Questions
Test your understanding
What is the main purpose of setting different viewports in this test?
cy.viewport() to simulate different screen sizes during tests, helping catch layout or usability issues on different devices.cy.viewport(), which accepts device names like 'iphone-6'.cy.viewport('ipad-2')
cy.get('.menu').should('be.visible')cy.viewport('ipad-2') changes the screen size to iPad 2 dimensions for the test..menu is visible at that viewport size. If hidden, test fails; if visible, test passes.cy.viewport(1024, 768)
cy.get('#nav').should('be.visible')
cy.viewport('iphone-x')cy.viewport(1024, 768) sets screen size, then assertion runs. But the second cy.viewport('iphone-x') is called after assertion, which won't affect that assertion.Pass the test and this pattern moves unknown