chore(html-reporter) fix bug when favicon does not reset to default when browser back button occurs
This commit is contained in:
parent
28b7ed10e1
commit
863ae531fd
|
|
@ -47,6 +47,14 @@ export const TestCaseView: React.FC<{
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
document.title = test?.title ? `| ${test.title}` : 'Playwright Test Report';
|
document.title = test?.title ? `| ${test.title}` : 'Playwright Test Report';
|
||||||
test?.outcome ? setFavicon({ outcome: test.outcome }) : setFavicon('default');
|
test?.outcome ? setFavicon({ outcome: test.outcome }) : setFavicon('default');
|
||||||
|
const resetFaviconOnBack = () => {
|
||||||
|
setFavicon('default');
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('popstate', resetFaviconOnBack);
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('popstate', resetFaviconOnBack);
|
||||||
|
};
|
||||||
}, [test?.outcome, test?.title]);
|
}, [test?.outcome, test?.title]);
|
||||||
|
|
||||||
return <div className='test-case-column vbox'>
|
return <div className='test-case-column vbox'>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue