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

This commit is contained in:
Yury Semikhatsky 2020-08-05 13:43:38 -07:00 committed by GitHub
parent e582cc678c
commit aa2ec09e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
});