How to Set the Locale Used in Cypress Tests

When running some Cypress tests in Github Actions that were inspecting dates recently, I wanted to be able to set the locale of the browser - specifically for Chrome which I was using with Cypress.

The tests checked the date format of dd/mm/yyyy and ran fine locally in my own locale of Great Britain, but when my Github action workflow executed them they appeared in a mm/dd/yyyy format.

Originally, I’d thought this require a step within setting up the github action environment itself which set my linux box to have the appropriate locale, but this doesn’t change anything - presumably because the Cypress github action runs in a separate step.

Turns out it is possible, but by using the chrome devtools protocol.

// cypress/support/index.js

Cypress.on("test:before:run", () => {
  Cypress.automation("remote:debugger:protocol", {
    command: "Emulation.setLocaleOverride",
    params: {
      locale: "en-GB",


Get Regular Tips to Your Inbox

My newsletter comes out every few weeks and is stuffed with helpful stories, tools and code showing how developers like yourself ship efficiently. It also features articles and videos I've recently published so you'll never miss out.

No spam, unsubscribe any time. Check out previous issues here.