Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(chromium): make locale overrides work (#1108)

Yury Semikhatsky4f69930fbe48
diff --git a/src/chromium/crPage.ts b/src/chromium/crPage.ts
index 896510715d..b15e4a6156 100644
--- a/src/chromium/crPage.ts
+++ b/src/chromium/crPage.ts
@@ -112,6 +112,8 @@ export class CRPage implements PageDelegate {
promises.push(this._client.send('Emulation.setScriptExecutionDisabled', { value: true }));
if (options.userAgent || options.locale)
promises.push(this._client.send('Emulation.setUserAgentOverride', { userAgent: options.userAgent || '', acceptLanguage: options.locale }));
+ if (options.locale)
+ promises.push(this._client.send('Emulation.setLocaleOverride', { locale: options.locale }));
if (options.timezoneId)
promises.push(emulateTimezone(this._client, options.timezoneId));
if (options.geolocation)
diff --git a/test/emulation.spec.js b/test/emulation.spec.js
index 3f9140999d..4f49193075 100644
--- a/test/emulation.spec.js
+++ b/test/emulation.spec.js
@@ -253,7 +253,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
});
});
- describe.skip(CHROMIUM || FFOX)('BrowserContext({locale})', function() {
+ describe.skip(FFOX)('BrowserContext({locale})', function() {
it('should affect accept-language header', async({browser, server}) => {
const context = await browser.newContext({ locale: 'fr-CH' });
const page = await context.newPage();