Skip to content

Commit

Permalink
fix(trace-viewer): fix snapshot.html (#31033)
Browse files Browse the repository at this point in the history
Actual path to get trace contexts is /contexts, not /context
  • Loading branch information
ruifigueira committed May 28, 2024
1 parent e047c47 commit f254290
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/trace-viewer/snapshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
const traceUrl = new URL(location.href).searchParams.get('trace');
const params = new URLSearchParams();
params.set('trace', traceUrl);
await fetch('context?' + params.toString()).then(r => r.json());
await fetch('contexts?' + params.toString()).then(r => r.json());
await location.reload();
})();
</script>
Expand Down
17 changes: 17 additions & 0 deletions tests/library/trace-viewer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,3 +1207,20 @@ test('should remove noscript when javaScriptEnabled is set to true', async ({ br
await expect(frame.getByText('Always visible')).toBeVisible();
await expect(frame.getByText('Enable JavaScript to run this app.')).toBeHidden();
});

test('should open snapshot in new browser context', async ({ browser, page, runAndTrace, server }) => {
const traceViewer = await runAndTrace(async () => {
await page.goto(server.EMPTY_PAGE);
await page.setContent('hello');
});
await traceViewer.snapshotFrame('page.setContent');
const popupPromise = traceViewer.page.context().waitForEvent('page');
await traceViewer.page.getByTitle('Open snapshot in a new tab').click();
const popup = await popupPromise;

// doesn't share sw.bundle.js
const newPage = await browser.newPage();
await newPage.goto(popup.url());
await expect(newPage.getByText('hello')).toBeVisible();
await newPage.close();
});

0 comments on commit f254290

Please sign in to comment.