Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: default to en-US locale in all browsers in Playwright Test (#11133)
Andrey Lushnikov7b1fecc0099b
diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.tsindex 53a602091f..7249809221 100644--- a/packages/playwright-test/src/index.ts+++ b/packages/playwright-test/src/index.ts@@ -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 } ],diff --git a/tests/har.spec.ts b/tests/har.spec.tsindex db1e89530e..ca46351f80 100644--- a/tests/har.spec.ts+++ b/tests/har.spec.ts@@ -82,8 +82,11 @@ it('should have pages in persistent context', async ({ launchPersistent }, testIawait 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');});