Skip to content

Instantly share code, notes, and snippets.

Created October 12, 2021 20:39
What would you like to do?
Changing user agent in cy.visit() command
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