fix: default to en-US locale in all browsers in Playwright Test (#11133)

It makes sense to default to en-US by default across all our browsers in Playwright Test.

Fixes #11127
This commit is contained in:
Andrey Lushnikov 2022-01-10 09:37:55 -07:00 committed by GitHub
parent d31f13468a
commit 7b1fecc009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -96,7 +96,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
ignoreHTTPSErrors: [ undefined, { option: true } ],
isMobile: [ undefined, { option: true } ],
javaScriptEnabled: [ undefined, { option: true } ],
locale: [ undefined, { option: true } ],
locale: [ 'en-US', { option: true } ],
offline: [ undefined, { option: true } ],
permissions: [ undefined, { option: true } ],
proxy: [ undefined, { option: true } ],

View File

@ -82,8 +82,11 @@ it('should have pages in persistent context', async ({ launchPersistent }, testI
await page.waitForLoadState('domcontentloaded');
await context.close();
const log = JSON.parse(fs.readFileSync(harPath).toString())['log'];
expect(log.pages.length).toBe(1);
const pageEntry = log.pages[0];
// Explicit locale emulation forces a new page creation when
// doing a new context.
// See https://github.com/microsoft/playwright/blob/13dd41c2e36a63f35ddef5dc5dec322052d670c6/packages/playwright-core/src/server/browserContext.ts#L232-L242
expect(log.pages.length).toBe(2);
const pageEntry = log.pages[1];
expect(pageEntry.id).toBeTruthy();
expect(pageEntry.title).toBe('Hello');
});