chore(html-reporter) ammend test for page title and favicon
This commit is contained in:
parent
47465e2a6c
commit
5e985a664a
|
|
@ -77,6 +77,18 @@ test('should render test case', async ({ mount }) => {
|
||||||
await expect(component.getByText('My test')).toBeVisible();
|
await expect(component.getByText('My test')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should correctly set the page title and favicon', async ({ mount, page }) => {
|
||||||
|
await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={testCase} run={0} anchor=''></TestCaseView>);
|
||||||
|
expect(await page.locator('link[rel="icon"]').getAttribute('href')).toEqual('../logo_expected.svg');
|
||||||
|
expect(await page.title()).toEqual(`| ${testCase.title}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should fallback to default title and favicon', async ({ mount, page }) => {
|
||||||
|
await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={undefined} run={0} anchor=''></TestCaseView>);
|
||||||
|
expect(await page.locator('link[rel="icon"]').getAttribute('href')).toEqual('../logo_default.svg');
|
||||||
|
expect(await page.title()).toEqual('Playwright Test Report');
|
||||||
|
});
|
||||||
|
|
||||||
const linkRenderingTestCase: TestCase = {
|
const linkRenderingTestCase: TestCase = {
|
||||||
testId: 'testid',
|
testId: 'testid',
|
||||||
title: 'My test',
|
title: 'My test',
|
||||||
|
|
@ -95,12 +107,6 @@ const linkRenderingTestCase: TestCase = {
|
||||||
results: [result]
|
results: [result]
|
||||||
};
|
};
|
||||||
|
|
||||||
test('should correctly set the page title and favicon', async ({ mount, page }) => {
|
|
||||||
await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={linkRenderingTestCase} run={0} anchor=''></TestCaseView>);
|
|
||||||
expect(await page.locator('link[rel="icon"]').getAttribute('href')).toEqual('../logo_expected.svg');
|
|
||||||
expect(await page.title()).toEqual(`| ${linkRenderingTestCase.title}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should correctly render links in annotations', async ({ mount, page }) => {
|
test('should correctly render links in annotations', async ({ mount, page }) => {
|
||||||
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={linkRenderingTestCase} run={0} anchor=''></TestCaseView>);
|
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={linkRenderingTestCase} run={0} anchor=''></TestCaseView>);
|
||||||
// const container = await(component.getByText('Annotations'));
|
// const container = await(component.getByText('Annotations'));
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export const TestCaseView: React.FC<{
|
||||||
}, [test?.annotations]);
|
}, [test?.annotations]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
document.title = `| ${test?.title}` ?? 'Playwright Test Report';
|
document.title = test?.title ? `| ${test.title}` : 'Playwright Test Report';
|
||||||
setSvgFavicon(test?.outcome);
|
setSvgFavicon(test?.outcome);
|
||||||
}, [test?.outcome, test?.title]);
|
}, [test?.outcome, test?.title]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue