mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
parent
100d3b2601
commit
4d82d6801f
@ -129,7 +129,8 @@ const NetworkResource: React.FunctionComponent<{
|
|||||||
}> = ({ resource, boundaries }) => {
|
}> = ({ resource, boundaries }) => {
|
||||||
const { routeStatus, resourceName, contentType } = React.useMemo(() => {
|
const { routeStatus, resourceName, contentType } = React.useMemo(() => {
|
||||||
const routeStatus = formatRouteStatus(resource);
|
const routeStatus = formatRouteStatus(resource);
|
||||||
const resourceName = resource.request.url.substring(resource.request.url.lastIndexOf('/'));
|
const url = new URL(resource.request.url);
|
||||||
|
const resourceName = url.pathname;
|
||||||
let contentType = resource.response.content.mimeType;
|
let contentType = resource.response.content.mimeType;
|
||||||
const charset = contentType.match(/^(.*);\s*charset=.*$/);
|
const charset = contentType.match(/^(.*);\s*charset=.*$/);
|
||||||
if (charset)
|
if (charset)
|
||||||
|
@ -241,9 +241,9 @@ test('should have network requests', async ({ showTraceViewer }) => {
|
|||||||
const traceViewer = await showTraceViewer([traceFile]);
|
const traceViewer = await showTraceViewer([traceFile]);
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
await expect(traceViewer.networkRequests).toContainText([/200GET\/frame.htmltext\/html/]);
|
await expect(traceViewer.networkRequests).toContainText([/200GET\/frames\/frame.htmltext\/html/]);
|
||||||
await expect(traceViewer.networkRequests).toContainText([/200GET\/style.csstext\/css/]);
|
await expect(traceViewer.networkRequests).toContainText([/200GET\/frames\/style.csstext\/css/]);
|
||||||
await expect(traceViewer.networkRequests).toContainText([/200GET\/script.jsapplication\/javascript/]);
|
await expect(traceViewer.networkRequests).toContainText([/200GET\/frames\/script.jsapplication\/javascript/]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should have network request overrides', async ({ page, server, runAndTrace }) => {
|
test('should have network request overrides', async ({ page, server, runAndTrace }) => {
|
||||||
@ -253,8 +253,8 @@ test('should have network request overrides', async ({ page, server, runAndTrace
|
|||||||
});
|
});
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
await expect(traceViewer.networkRequests).toContainText([/200GET\/frame.htmltext\/html/]);
|
await expect(traceViewer.networkRequests).toContainText([/200GET\/frames\/frame.htmltext\/html/]);
|
||||||
await expect(traceViewer.networkRequests).toContainText([/GET\/style.cssx-unknown.*aborted/]);
|
await expect(traceViewer.networkRequests).toContainText([/GET\/frames\/style.cssx-unknown.*aborted/]);
|
||||||
await expect(traceViewer.networkRequests).not.toContainText([/continued/]);
|
await expect(traceViewer.networkRequests).not.toContainText([/continued/]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -265,8 +265,8 @@ test('should have network request overrides 2', async ({ page, server, runAndTra
|
|||||||
});
|
});
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
await expect.soft(traceViewer.networkRequests).toContainText([/200GET\/frame.htmltext\/html.*/]);
|
await expect.soft(traceViewer.networkRequests).toContainText([/200GET\/frames\/frame.htmltext\/html.*/]);
|
||||||
await expect.soft(traceViewer.networkRequests).toContainText([/200GET\/script.jsapplication\/javascript.*continued/]);
|
await expect.soft(traceViewer.networkRequests).toContainText([/200GET\/frames\/script.jsapplication\/javascript.*continued/]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show snapshot URL', async ({ page, runAndTrace, server }) => {
|
test('should show snapshot URL', async ({ page, runAndTrace, server }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user