mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
fix(extensions): do not enable screencast for background pages (#4919)
This commit is contained in:
parent
8fd34c6beb
commit
0a2fe62cb7
@ -461,7 +461,7 @@ class FrameSession {
|
|||||||
promises.push(this._evaluateOnNewDocument(source, 'main'));
|
promises.push(this._evaluateOnNewDocument(source, 'main'));
|
||||||
for (const source of this._crPage._page._evaluateOnNewDocumentSources)
|
for (const source of this._crPage._page._evaluateOnNewDocumentSources)
|
||||||
promises.push(this._evaluateOnNewDocument(source, 'main'));
|
promises.push(this._evaluateOnNewDocument(source, 'main'));
|
||||||
if (this._isMainFrame() && this._crPage._browserContext._options.recordVideo) {
|
if (this._isMainFrame() && this._crPage._browserContext._options.recordVideo && hasUIWindow) {
|
||||||
const size = this._crPage._browserContext._options.recordVideo.size || this._crPage._browserContext._options.viewport || { width: 1280, height: 720 };
|
const size = this._crPage._browserContext._options.recordVideo.size || this._crPage._browserContext._options.viewport || { width: 1280, height: 720 };
|
||||||
const screencastId = createGuid();
|
const screencastId = createGuid();
|
||||||
const outputFile = path.join(this._crPage._browserContext._options.recordVideo.dir, screencastId + '.webm');
|
const outputFile = path.join(this._crPage._browserContext._options.recordVideo.dir, screencastId + '.webm');
|
||||||
|
@ -77,6 +77,32 @@ it('should return background pages', (test, { browserName }) => {
|
|||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return background pages when recording video', (test, { browserName }) => {
|
||||||
|
test.skip(browserName !== 'chromium');
|
||||||
|
}, async ({browserType, testInfo, browserOptions, createUserDataDir}) => {
|
||||||
|
const userDataDir = await createUserDataDir();
|
||||||
|
const extensionPath = path.join(__dirname, '..', 'assets', 'simple-extension');
|
||||||
|
const extensionOptions = {...browserOptions,
|
||||||
|
headless: false,
|
||||||
|
args: [
|
||||||
|
`--disable-extensions-except=${extensionPath}`,
|
||||||
|
`--load-extension=${extensionPath}`,
|
||||||
|
],
|
||||||
|
recordVideo: {
|
||||||
|
dir: testInfo.outputPath(''),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const context = await browserType.launchPersistentContext(userDataDir, extensionOptions) as ChromiumBrowserContext;
|
||||||
|
const backgroundPages = context.backgroundPages();
|
||||||
|
const backgroundPage = backgroundPages.length
|
||||||
|
? backgroundPages[0]
|
||||||
|
: await context.waitForEvent('backgroundpage');
|
||||||
|
expect(backgroundPage).toBeTruthy();
|
||||||
|
expect(context.backgroundPages()).toContain(backgroundPage);
|
||||||
|
expect(context.pages()).not.toContain(backgroundPage);
|
||||||
|
await context.close();
|
||||||
|
});
|
||||||
|
|
||||||
it('should not create pages automatically', (test, { browserName }) => {
|
it('should not create pages automatically', (test, { browserName }) => {
|
||||||
test.skip(browserName !== 'chromium');
|
test.skip(browserName !== 'chromium');
|
||||||
}, async ({browserType, browserOptions}) => {
|
}, async ({browserType, browserOptions}) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user