chore(html-report): show run duration for each retry (#34647)
This commit is contained in:
parent
3d3154de86
commit
34d9d4fc33
|
@ -50,6 +50,11 @@
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.test-case-run-duration {
|
||||||
|
color: var(--color-fg-subtle);
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.test-case-path {
|
.test-case-path {
|
||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -59,7 +59,7 @@ const testCase: TestCase = {
|
||||||
],
|
],
|
||||||
tags: [],
|
tags: [],
|
||||||
outcome: 'expected',
|
outcome: 'expected',
|
||||||
duration: 10,
|
duration: 200,
|
||||||
ok: true,
|
ok: true,
|
||||||
results: [result]
|
results: [result]
|
||||||
};
|
};
|
||||||
|
@ -215,3 +215,37 @@ test('should correctly render prev and next', async ({ mount }) => {
|
||||||
- text: "My test test.spec.ts:42 10ms"
|
- text: "My test test.spec.ts:42 10ms"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const testCaseWithTwoAttempts: TestCase = {
|
||||||
|
...testCase,
|
||||||
|
results: [
|
||||||
|
{
|
||||||
|
...result,
|
||||||
|
errors: ['Error message'],
|
||||||
|
status: 'failed',
|
||||||
|
duration: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...result,
|
||||||
|
duration: 150,
|
||||||
|
status: 'passed',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
test('total duration is selected run duration', async ({ mount, page }) => {
|
||||||
|
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={testCaseWithTwoAttempts} prev={undefined} next={undefined} run={0}></TestCaseView>);
|
||||||
|
await expect(component).toMatchAriaSnapshot(`
|
||||||
|
- text: "My test test.spec.ts:42 200ms"
|
||||||
|
- text: "Run 50ms Retry #1 150ms"
|
||||||
|
`);
|
||||||
|
await page.locator('.tabbed-pane-tab-label', { hasText: 'Run50ms' }).click();
|
||||||
|
await expect(component).toMatchAriaSnapshot(`
|
||||||
|
- 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"
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
|
@ -77,7 +77,10 @@ export const TestCaseView: React.FC<{
|
||||||
{test && <TabbedPane tabs={
|
{test && <TabbedPane tabs={
|
||||||
test.results.map((result, index) => ({
|
test.results.map((result, index) => ({
|
||||||
id: String(index),
|
id: String(index),
|
||||||
title: <div style={{ display: 'flex', alignItems: 'center' }}>{statusIcon(result.status)} {retryLabel(index)}</div>,
|
title: <div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
|
{statusIcon(result.status)} {retryLabel(index)}
|
||||||
|
{(test.results.length > 1) && <span className='test-case-run-duration'>{msToString(result.duration)}</span>}
|
||||||
|
</div>,
|
||||||
render: () => <TestResultView test={test!} result={result} />
|
render: () => <TestResultView test={test!} result={result} />
|
||||||
})) || []} selectedTab={String(selectedResultIndex)} setSelectedTab={id => setSelectedResultIndex(+id)} />}
|
})) || []} selectedTab={String(selectedResultIndex)} setSelectedTab={id => setSelectedResultIndex(+id)} />}
|
||||||
</div>;
|
</div>;
|
||||||
|
|
Loading…
Reference in New Issue