Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cypress runner loading mobile site instead of desktop site

I am opening the website https://www.vangoghmuseum.nl/nl with cy.visit().

However, the cypress runner is opening the mobile website instead of the desktop website.

Any ideas why and how to change this behavior?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The mobile setting seem to be more like tablet size settings.

You can control the viewport before visiting

it('opens van gogh', () => {
  cy.viewport(1800,1000)
  cy.visit('https://www.vangoghmuseum.nl/nl');    // large screen layout
});

If you open devtools to the right and resize, you will see the breakpoint is around 1025 px wide.

Cypress viewport defaults to 1000 px, so you get the small-screen layout.


If you look at one of the <article> elements, it has breakpoint styling of

@media only screen and (min-width: 64em)

which equates to 1024px for the default pixel size of 16px.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading