fix(fixtures): make sure connected browser respects context options (#11990)

Connected browser was wired up to the wrong browserType object.
This commit is contained in:
Dmitry Gozman 2022-02-09 15:25:15 -08:00 committed by GitHub
parent 6f87955243
commit ae7c52154f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -171,7 +171,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
browser = Browser.from(playwright._initializer.preLaunchedBrowser!);
browser._logger = logger;
browser._shouldCloseConnectionOnClose = true;
browser._setBrowserType((playwright as any)[browser._name]);
browser._setBrowserType(this);
browser._localUtils = this._playwright._utils;
browser.on(Events.Browser.Disconnected, closePipe);
return browser;

View file

@ -568,9 +568,11 @@ test('should work with connectOptions', async ({ runInlineTest }) => {
`,
'a.test.ts': `
const { test } = pwt;
test.use({ locale: 'fr-CH' });
test('pass', async ({ page }) => {
await page.setContent('<div>PASS</div>');
await expect(page.locator('div')).toHaveText('PASS');
expect(await page.evaluate(() => navigator.language)).toBe('fr-CH');
});
`,
});