Skip to content

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

test: default and overriden locale isolation between contexts (#3308)

Yury Semikhatskyaa2ec09e97ea
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();
+ }
+});