mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-07 11:46:42 +03:00
fix(html-reporter): do not show empty project name (#20735)
This commit is contained in:
parent
4259d4e1d6
commit
161f3f144a
@ -85,6 +85,16 @@ test('should show the project names', async ({ mount }) => {
|
|||||||
</HeaderView>);
|
</HeaderView>);
|
||||||
await expect(component.getByText('Project: my-project')).toBeVisible();
|
await expect(component.getByText('Project: my-project')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
await test.step('with 1 project and empty projectName', async () => {
|
||||||
|
const component = await mount(<HeaderView
|
||||||
|
stats={stats}
|
||||||
|
filterText=''
|
||||||
|
setFilterText={() => {}}
|
||||||
|
projectNames={['']}
|
||||||
|
>
|
||||||
|
</HeaderView>);
|
||||||
|
await expect(component.getByText('Project:')).toBeHidden();
|
||||||
|
});
|
||||||
await test.step('with more than 1 project', async () => {
|
await test.step('with more than 1 project', async () => {
|
||||||
const component = await mount(<HeaderView
|
const component = await mount(<HeaderView
|
||||||
stats={stats}
|
stats={stats}
|
||||||
|
@ -60,7 +60,7 @@ export const HeaderView: React.FC<React.PropsWithChildren<{
|
|||||||
</div>
|
</div>
|
||||||
{reportLoaderError && <div className='header-view-status-line pt-2' data-testid='loader-error' style={{ color: 'var(--color-danger-emphasis)', textAlign: 'right' }}>{reportLoaderError}</div>}
|
{reportLoaderError && <div className='header-view-status-line pt-2' data-testid='loader-error' style={{ color: 'var(--color-danger-emphasis)', textAlign: 'right' }}>{reportLoaderError}</div>}
|
||||||
<div className='header-view-status-line pt-2'>
|
<div className='header-view-status-line pt-2'>
|
||||||
{projectNames.length === 1 && <span data-testid="project-name" style={{ color: 'var(--color-fg-subtle)', float: 'left' }}>Project: {projectNames[0]}</span>}
|
{projectNames.length === 1 && !!projectNames[0] && <span data-testid="project-name" style={{ color: 'var(--color-fg-subtle)', float: 'left' }}>Project: {projectNames[0]}</span>}
|
||||||
<span data-testid="overall-duration" style={{ color: 'var(--color-fg-subtle)', float: 'right' }}>Total time: {msToString(stats.duration)}</span>
|
<span data-testid="overall-duration" style={{ color: 'var(--color-fg-subtle)', float: 'right' }}>Total time: {msToString(stats.duration)}</span>
|
||||||
</div>
|
</div>
|
||||||
</>);
|
</>);
|
||||||
|
Loading…
Reference in New Issue
Block a user