This commit is contained in:
Simon Knott 2024-07-25 12:48:29 +02:00
parent c8f2d6bed6
commit db641b83be
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 19 additions and 0 deletions

View file

@ -44,6 +44,7 @@ class TraceViewerPage {
consoleStacks: Locator;
stackFrames: Locator;
networkRequests: Locator;
metadataTab: Locator;
snapshotContainer: Locator;
constructor(public page: Page) {
@ -57,6 +58,7 @@ class TraceViewerPage {
this.stackFrames = page.getByTestId('stack-trace-list').locator('.list-view-entry');
this.networkRequests = page.getByTestId('network-list').locator('.list-view-entry');
this.snapshotContainer = page.locator('.snapshot-container iframe.snapshot-visible[name=snapshot]');
this.metadataTab = page.locator('.metadata-view');
}
async actionIconsText(action: string) {
@ -93,6 +95,10 @@ class TraceViewerPage {
await this.page.click('text="Network"');
}
async showMetadataTab() {
await this.page.click('text="Metadata"');
}
@step
async snapshotFrame(actionName: string, ordinal: number = 0, hasSubframe: boolean = false): Promise<FrameLocator> {
await this.selectAction(actionName, ordinal);

View file

@ -30,6 +30,10 @@ test.slow();
let traceFile: string;
test.use({
baseURL: 'https://example.com',
});
test.beforeAll(async function recordTrace({ browser, browserName, browserType, server }, workerInfo) {
const context = await browser.newContext();
await context.tracing.start({ name: 'test', screenshots: true, snapshots: true, sources: true });
@ -1368,3 +1372,12 @@ test('should allow hiding route actions', {
/route.fulfill/,
]);
});
test('should show baseURL in metadata pane', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31847' },
}, async ({ showTraceViewer }) => {
const traceViewer = await showTraceViewer([traceFile]);
await traceViewer.selectAction('page.evaluate');
await traceViewer.showMetadataTab();
await expect(traceViewer.metadataTab).toContainText('baseURL:https://example.com');
});