Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/utils/report/client/chooseTestRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@ declare const reportClientState: ReportClientState;
* This base client function should not use scope variables (except other base functions).
* @internal
*/
// eslint-disable-next-line max-statements
// eslint-disable-next-line complexity, max-statements
export const chooseTestRun = (runHash: RunHash): void => {
const {e2edRightColumnContainer} = reportClientState;
let {e2edRightColumnContainer} = reportClientState;

if (!e2edRightColumnContainer) {
console.error(
'Cannot find right column container (id="e2edRightColumnContainer"). Probably page not yet completely loaded. Please try click again later',
);
e2edRightColumnContainer = document.getElementById('e2edRightColumnContainer') ?? undefined;

return;
if (e2edRightColumnContainer) {
Object.assign<ReportClientState, Partial<ReportClientState>>(reportClientState, {
e2edRightColumnContainer,
});
} else {
console.error(
'Cannot find right column container (id="e2edRightColumnContainer"). Probably page not yet completely loaded. Please try click again later',
);

return;
}
}

const previousHash = window.location.hash.replaceAll('#', '') as RunHash;
Expand Down
25 changes: 14 additions & 11 deletions src/utils/report/client/onDomContentLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ const readJsonReportData = clientReadJsonReportData;
* @internal
*/
export const onDomContentLoad = (): void => {
const e2edRightColumnContainer = document.getElementById('e2edRightColumnContainer') ?? undefined;

if (!e2edRightColumnContainer) {
// eslint-disable-next-line no-console
console.error(
'Cannot find right column container (id="e2edRightColumnContainer") after DOMContentLoaded.',
);
} else {
Object.assign<ReportClientState, Partial<ReportClientState>>(reportClientState, {
e2edRightColumnContainer,
});
if (!reportClientState.e2edRightColumnContainer) {
const e2edRightColumnContainer =
document.getElementById('e2edRightColumnContainer') ?? undefined;

if (!e2edRightColumnContainer) {
// eslint-disable-next-line no-console
console.error(
'Cannot find right column container (id="e2edRightColumnContainer") after DOMContentLoaded.',
);
} else {
Object.assign<ReportClientState, Partial<ReportClientState>>(reportClientState, {
e2edRightColumnContainer,
});
}
}

readJsonReportData(true);
Expand Down