diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css index ff20288cbf..9ae47b179d 100644 --- a/packages/html-reporter/src/testCaseView.css +++ b/packages/html-reporter/src/testCaseView.css @@ -50,6 +50,11 @@ line-height: 24px; } +.test-case-run-duration { + color: var(--color-fg-subtle); + padding-left: 8px; +} + .test-case-path { flex: none; align-items: center; diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx index 183d44c019..8aa3fafc8f 100644 --- a/packages/html-reporter/src/testCaseView.spec.tsx +++ b/packages/html-reporter/src/testCaseView.spec.tsx @@ -212,7 +212,7 @@ test('should correctly render prev and next', async ({ mount }) => { - text: group - link "« previous" - link "next »" - - text: "My test test.spec.ts:42 100ms" + - text: "My test test.spec.ts:42 10ms" `); }); @@ -237,10 +237,15 @@ const testCaseWithTwoAttempts: TestCase = { test('total duration is selected run duration', async ({ mount, page }) => { const component = await mount(); await expect(component).toMatchAriaSnapshot(` - - text: "My test test.spec.ts:42 50ms" + - text: "My test test.spec.ts:42 200ms" + - text: "Run 50ms Retry #1 150ms" `); - await page.getByText('Retry #1').click(); + await page.locator('.tabbed-pane-tab-label', { hasText: 'Run50ms' }).click(); await expect(component).toMatchAriaSnapshot(` - - text: "My test test.spec.ts:42 150ms" + - text: "My test test.spec.ts:42 200ms" + `); + await page.locator('.tabbed-pane-tab-label', { hasText: 'Retry #1150ms' }).click(); + await expect(component).toMatchAriaSnapshot(` + - text: "My test test.spec.ts:42 200ms" `); }); diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index bbd0d7ad13..ca5ff6d2e2 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -65,7 +65,7 @@ export const TestCaseView: React.FC<{
-
{msToString(test.results[selectedResultIndex]?.duration ?? test.duration)}
+
{msToString(test.duration)}
} {test && (!!test.projectName || labels) &&
{test && !!test.projectName && } @@ -77,7 +77,10 @@ export const TestCaseView: React.FC<{ {test && ({ id: String(index), - title:
{statusIcon(result.status)} {retryLabel(index)}
, + title:
+ {statusIcon(result.status)} {retryLabel(index)} + {(test.results.length > 1) && {msToString(result.duration)}} +
, render: () => })) || []} selectedTab={String(selectedResultIndex)} setSelectedTab={id => setSelectedResultIndex(+id)} />}
;