feat(trace): instantiate consoleAPI in popout with correct testIdAttribute (#23238)
This commit is contained in:
parent
b1db4a8191
commit
848f1dff3f
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as consoleApiSource from '../../../generated/consoleApiSource';
|
|
||||||
import { HttpServer } from '../../../utils/httpServer';
|
import { HttpServer } from '../../../utils/httpServer';
|
||||||
import { findChromiumChannel } from '../../registry';
|
import { findChromiumChannel } from '../../registry';
|
||||||
import { isUnderTest } from '../../../utils';
|
import { isUnderTest } from '../../../utils';
|
||||||
|
|
@ -96,7 +95,6 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,
|
||||||
await controller.run(async progress => {
|
await controller.run(async progress => {
|
||||||
await context._browser._defaultContext!._loadDefaultContextAsIs(progress);
|
await context._browser._defaultContext!._loadDefaultContextAsIs(progress);
|
||||||
});
|
});
|
||||||
await context.extendInjectedScript(consoleApiSource.source);
|
|
||||||
const [page] = context.pages();
|
const [page] = context.pages();
|
||||||
|
|
||||||
if (process.env.PWTEST_PRINT_WS_ENDPOINT)
|
if (process.env.PWTEST_PRINT_WS_ENDPOINT)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import { ToolbarButton } from '@web/components/toolbarButton';
|
||||||
import { copy, useMeasure } from '@web/uiUtils';
|
import { copy, useMeasure } from '@web/uiUtils';
|
||||||
import { InjectedScript } from '@injected/injectedScript';
|
import { InjectedScript } from '@injected/injectedScript';
|
||||||
import { Recorder } from '@injected/recorder';
|
import { Recorder } from '@injected/recorder';
|
||||||
|
import ConsoleAPI from '@injected/consoleApi';
|
||||||
import { asLocator } from '@isomorphic/locatorGenerators';
|
import { asLocator } from '@isomorphic/locatorGenerators';
|
||||||
import type { Language } from '@isomorphic/locatorGenerators';
|
import type { Language } from '@isomorphic/locatorGenerators';
|
||||||
import { locatorOrSelectorAsSelector } from '@isomorphic/locatorParser';
|
import { locatorOrSelectorAsSelector } from '@isomorphic/locatorParser';
|
||||||
|
|
@ -183,7 +184,11 @@ export const SnapshotTab: React.FunctionComponent<{
|
||||||
})}
|
})}
|
||||||
<div style={{ flex: 'auto' }}></div>
|
<div style={{ flex: 'auto' }}></div>
|
||||||
<ToolbarButton icon='link-external' title='Open snapshot in a new tab' disabled={!popoutUrl} onClick={() => {
|
<ToolbarButton icon='link-external' title='Open snapshot in a new tab' disabled={!popoutUrl} onClick={() => {
|
||||||
window.open(popoutUrl || '', '_blank');
|
const win = window.open(popoutUrl || '', '_blank');
|
||||||
|
win?.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const injectedScript = new InjectedScript(win as any, false, sdkLanguage, testIdAttributeName, 1, 'chromium', []);
|
||||||
|
new ConsoleAPI(injectedScript);
|
||||||
|
});
|
||||||
}}></ToolbarButton>
|
}}></ToolbarButton>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
{pickerVisible && <Toolbar noMinHeight={true}>
|
{pickerVisible && <Toolbar noMinHeight={true}>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue