Created
October 12, 2021 20:39
-
-
Save filiphric/deae1e99b6407afd0115341701bcb272 to your computer and use it in GitHub Desktop.
Changing user agent in cy.visit() command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('changing user agent', () => { | |
cy.visit('/', { | |
onBeforeLoad: (win) => { | |
Object.defineProperty(win.navigator, 'userAgent', { | |
value: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', | |
}); | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment