Skip to content

Commit

Permalink
test: default and overriden locale isolation between contexts (#3308)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Aug 5, 2020
1 parent e582cc6 commit aa2ec09
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/browsercontext-locale.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});

0 comments on commit aa2ec09

Please sign in to comment.