From aa2ec09e97ea9144a4f6ddd16a3a124532b04cb5 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 5 Aug 2020 13:43:38 -0700 Subject: [PATCH] test: default and overriden locale isolation between contexts (#3308) --- test/browsercontext-locale.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/browsercontext-locale.spec.js b/test/browsercontext-locale.spec.js index 09b14df969..abfbce0ca8 100644 --- a/test/browsercontext-locale.spec.js +++ b/test/browsercontext-locale.spec.js @@ -138,3 +138,28 @@ it('should be isolated between contexts', async({browser, server}) => { context2.close() ]); }); + +it.fail(FFOX)('should not change default locale in another context', async({browser, server}) => { + async function getContextLocale(context) { + const page = await context.newPage(); + return await page.evaluate(() => (new Intl.NumberFormat()).resolvedOptions().locale); + } + + let defaultLocale; + { + const context = await browser.newContext(); + defaultLocale = await getContextLocale(context); + await context.close(); + } + const localeOverride = defaultLocale === 'ru-RU' ? 'de-DE' : 'ru-RU'; + { + const context = await browser.newContext({ locale: localeOverride}); + expect(await getContextLocale(context)).toBe(localeOverride); + await context.close(); + } + { + const context = await browser.newContext(); + expect(await getContextLocale(context)).toBe(defaultLocale); + await context.close(); + } +});