playwright: [BUG] Webkit and Firefox do not respect locale setting

Context:

  • Playwright Version: latest
  • Operating System: Win10
  • Node.js version: LTS
  • Browser: Webkit, Firefox
  • Extra: [any specific details about your environment]

Describe the bug Our frontend application is built using Angular.

Every request it sends to the backend must have Accept-Language header, with short language value, e.g. cs. NOT cs-CZ - that is considered invalid, and backend will return HTTP error.

I have two issues:

  • when locale is not explicitly set in the configuration, then Webkit and Firefox ignore cs value which should be set by application under test, and set en-US for Accept-Language header value.

  • when locale is explicitly set - either in config file, or using test.use() in the test, then it:

    • in the trace console log shows, that header value is cs, BUT backend logs shows, that in reality it sends cs, cs-CZ.
    • Firefox will start sending correct request header intermittently, or after calling page.reload()
    • Webkit will be still bugged

This is currently a blocker for testing on these two browsers, since without backend data application cannot render needed content.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 14
  • Comments: 23 (5 by maintainers)

Most upvoted comments

Any news on this BUG? Maybe someone has found a good workaround?

hi @pavelfeldman any update on this? Is it possible to fix this? Or maybe enable an option to opt out from default enforced locale setting (which does not work correctly and is causing issues?)

I can also confirm the issue on my side : locale is not respected by Firefox and Webkit, only Chromium is OK.

timezoneId is not respected either.

On Firefox/Webkit & Chromium, my simple type date input has different placeholder, and give different formatted date value with wrong timezone.

Note the placeholders (“jj/mm/aaaa” or “mm/dd/yyyy”) and the locales of the browsers here

Also, I don’t know if contextOptions.locale is supposed to be filled during tests, but its value is always undefined.

Playwright Version: 1.31.1 Operating System: Xubuntu 22.04.2 LTS Node.js version: v16.19.1 Browser: Chromium, Webkit, Firefox

export default defineConfig({
 ...
  use: {
    ...
    locale: 'fr-FR',
    timezoneId: 'Europe/Paris',
  },

  /* Configure projects for major browsers */
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], locale: 'fr-FR', timezoneId: 'Europe/Paris' },
    },
    {
      name: 'firefox',
      use: { ...devices['Desktop Firefox'], locale: 'fr-FR', timezoneId: 'Europe/Paris' },
    },
    {
      name: 'webkit',
      use: { ...devices['Desktop Safari'], locale: 'fr-FR', timezoneId: 'Europe/Paris' },
    },
  ],
});

I think we have enough information to act.