fix(trace-viewer): fix snapshot.html (#31033)

Actual path to get trace contexts is /contexts, not /context
This commit is contained in:
Rui Figueira 2024-05-28 20:14:22 +00:00 committed by GitHub
parent e047c478a4
commit f254290ab4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -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>

View File

@ -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();
});