I'm trying to run tests with Cypress using electron browser, but the system language is changed according to the language of the browser. This is making the tests fail.
I've tried to override visit
method as in the code below, but didn't work.
/ commands.js
Cypress.Commands.overwrite("visit", (originalVisit, url, options = {}) => {
console.log('calling cy.visit')
const opts = {
onBeforeLoad: (win) => {
Object.defineProperty(win.navigator, 'language', {
value: 'pt-BR'
})
},
onLoad: (win) => {
console.log('onLoad')
}
}
return originalVisit(url, opts)
})
My question is: Is there any way I can configure the browser to always start with a specific language?