From 4f69930fbe48674af16107845488a00db151db68 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 26 Feb 2020 11:01:46 -0800 Subject: [PATCH] fix(chromium): make locale overrides work (#1108) --- src/chromium/crPage.ts | 2 ++ test/emulation.spec.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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();