My question is about configuring Cypress to launch a browser instance in a certain language.
In order to:
fr_FR
, and on the CI/CD VM it defaults to en_US
?I tried (without much success):
LANGUAGE=en_US
from the terminal invocation,Thanks!
navigator has two lang props:
navigator.language refers to the first element of navigator.languages but some libraries check navigator.languages[0] instead of navigator.language, so better if you set both properties
onBeforeLoad: (window, ...args) => {
Object.defineProperty(window.navigator, 'language', { value: 'en-GB' });
Object.defineProperty(window.navigator, 'languages', ['en-GB']);
ref: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/languages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With