diff --git a/packages/trace-viewer/src/ui/actionList.tsx b/packages/trace-viewer/src/ui/actionList.tsx
index 886df28a4c46b..e5866ba310d87 100644
--- a/packages/trace-viewer/src/ui/actionList.tsx
+++ b/packages/trace-viewer/src/ui/actionList.tsx
@@ -102,6 +102,7 @@ export const renderAction = (
{action.apiName}
{locator &&
{locator}
}
{action.method === 'goto' && action.params.url && {action.params.url}
}
+ {action.class === 'APIRequestContext' && action.params.url && {excludeOrigin(action.params.url)}
}
{(showDuration || showBadges) && }
{showDuration && {time || }
}
@@ -111,3 +112,12 @@ export const renderAction = (
}
>;
};
+
+function excludeOrigin(url: string): string {
+ try {
+ const urlObject = new URL(url);
+ return urlObject.pathname + urlObject.search;
+ } catch (error) {
+ return url;
+ }
+}
\ No newline at end of file
diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts
index dc9e9facaf583..0f7feb365c7c0 100644
--- a/tests/library/trace-viewer.spec.ts
+++ b/tests/library/trace-viewer.spec.ts
@@ -812,12 +812,12 @@ test('should open two trace files', async ({ context, page, request, server, sho
await traceViewer.selectAction('apiRequestContext.get');
await traceViewer.selectAction('apiRequestContext.post');
await expect(traceViewer.actionTitles).toHaveText([
- `apiRequestContext.get`,
+ `apiRequestContext.get/simple.json`,
`page.gotohttp://localhost:${server.PORT}/input/button.html`,
- `apiRequestContext.head`,
+ `apiRequestContext.head/simplezip.json`,
`locator.clicklocator('button')`,
`locator.clicklocator('button')`,
- `apiRequestContext.post`,
+ `apiRequestContext.post/one-style.css`,
]);
await traceViewer.page.locator('text=Metadata').click();