11import { assertValueIsDefined as clientAssertValueIsDefined } from './assertValueIsDefined' ;
2- import {
3- renderApiStatistics as clientRenderApiStatistics ,
4- renderTestRunDetails as clientRenderTestRunDetails ,
5- } from './render' ;
6-
7- import type {
8- ApiStatisticsReportHash ,
9- ReportClientState ,
10- RunHash ,
11- SafeHtml ,
12- } from '../../../types/internal' ;
2+ import { maybeRenderApiStatistics as clientMaybeRenderApiStatistics } from './maybeRenderApiStatistics' ;
3+ import { renderTestRunDetails as clientRenderTestRunDetails } from './render' ;
4+
5+ import type { ReportClientState , RunHash , SafeHtml } from '../../../types/internal' ;
136
147const assertValueIsDefined : typeof clientAssertValueIsDefined = clientAssertValueIsDefined ;
15- const renderApiStatistics = clientRenderApiStatistics ;
8+ const maybeRenderApiStatistics = clientMaybeRenderApiStatistics ;
169const renderTestRunDetails = clientRenderTestRunDetails ;
1710
1811declare const reportClientState : ReportClientState ;
@@ -35,7 +28,7 @@ export function chooseTestRun(runHash: RunHash): void {
3528 return ;
3629 }
3730
38- const previousHash = window . location . hash as RunHash ;
31+ const previousHash = window . location . hash . replaceAll ( '#' , '' ) as RunHash ;
3932
4033 window . location . hash = runHash ;
4134
@@ -47,7 +40,10 @@ export function chooseTestRun(runHash: RunHash): void {
4740
4841 const previousTestRunDetailsElement = e2edRightColumnContainer . firstElementChild as HTMLElement ;
4942
50- if ( ! ( previousHash in testRunDetailsElementsByHash ) ) {
43+ if (
44+ ! ( previousHash in testRunDetailsElementsByHash ) &&
45+ ! previousTestRunDetailsElement . classList . contains ( 'test-details-empty' )
46+ ) {
5147 testRunDetailsElementsByHash [ previousHash ] = previousTestRunDetailsElement ;
5248 }
5349
@@ -61,30 +57,9 @@ export function chooseTestRun(runHash: RunHash): void {
6157 return ;
6258 }
6359
64- const pagesHash : ApiStatisticsReportHash = 'api-statistics-pages' ;
65- const requestsHash : ApiStatisticsReportHash = 'api-statistics-requests' ;
66- const resourcesHash : ApiStatisticsReportHash = 'api-statistics-resources' ;
67-
68- let rightColumnHtml : SafeHtml | undefined ;
69-
70- const hash = String ( runHash ) ;
71-
72- if ( hash === pagesHash || hash === requestsHash || hash === resourcesHash ) {
73- const { reportClientData} = reportClientState ;
74-
75- if ( reportClientData === undefined ) {
76- // eslint-disable-next-line no-console
77- console . error (
78- `Cannot find report client data in JSON report data (tried to click "${ runHash } "). Probably JSON report data not yet completely loaded. Please try click again later` ,
79- ) ;
80-
81- return ;
82- }
83-
84- const { apiStatistics} = reportClientData ;
60+ let rightColumnHtml : SafeHtml | undefined = maybeRenderApiStatistics ( runHash ) ;
8561
86- rightColumnHtml = renderApiStatistics ( { apiStatistics, hash} ) ;
87- } else {
62+ if ( rightColumnHtml === undefined ) {
8863 const { fullTestRuns} = reportClientState ;
8964 const fullTestRun = fullTestRuns . find ( ( testRun ) => testRun . runHash === runHash ) ;
9065
0 commit comments