How to set the browser's language in Cypress.io (electron/chrome)?

后端 未结 4 1287
感动是毒
感动是毒 2021-02-14 10:00

My question is about configuring Cypress to launch a browser instance in a certain language.

In order to:

  • make assertions on localized (i18n) text labels?<
4条回答
  •  囚心锁ツ
    2021-02-14 10:23

    from Gleb Bahmutov:

    you set it during cy.visit using onBeforeLoad with something like Object.defineProperty(navigator, 'language', { value: 'de-GE' })

    src: https://gitter.im/cypress-io/cypress?at=5d61408a07d1ff39f8769545

提交回复
热议问题