chore(docs): browser locale vs user locale (#35535)

This commit is contained in:
Simon Knott 2025-04-08 16:12:40 +02:00 committed by GitHub
parent 93d0bc4bab
commit 22f8f21a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -289,17 +289,17 @@ await using var context = await browser.NewContextAsync(new()
## Locale & Timezone ## Locale & Timezone
Emulate the user Locale and Timezone which can be set globally for all tests in the config and then overridden for particular tests. Emulate the browser Locale and Timezone which can be set globally for all tests in the config and then overridden for particular tests.
```js title="playwright.config.ts" ```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test'; import { defineConfig } from '@playwright/test';
export default defineConfig({ export default defineConfig({
use: { use: {
// Emulates the user locale. // Emulates the browser locale.
locale: 'en-GB', locale: 'en-GB',
// Emulates the user timezone. // Emulates the browser timezone.
timezoneId: 'Europe/Paris', timezoneId: 'Europe/Paris',
}, },
}); });
@ -355,6 +355,13 @@ await using var context = await browser.NewContextAsync(new()
``` ```
<img width="1394" alt="Bing in german lang and timezone" src="https://user-images.githubusercontent.com/13063165/220416571-ccc96ab1-44bb-4579-8430-64502fc24a15.png" /> <img width="1394" alt="Bing in german lang and timezone" src="https://user-images.githubusercontent.com/13063165/220416571-ccc96ab1-44bb-4579-8430-64502fc24a15.png" />
######
* langs: js
Note that this only affects the browser timezone and locale, not the test runner timezone.
To set the test runner timezone, you can use the [`TZ` environment variable](https://nodejs.org/api/cli.html#tz).
## Permissions ## Permissions
Allow app to show system notifications. Allow app to show system notifications.