11import {
2- type CreateLocatorOptions ,
32 createSimpleLocator as clientCreateSimpleLocator ,
43 type LocatorFunction ,
54} from 'create-locator' ;
65
76import { addDomContentLoadedHandler as clientAddDomContentLoadedHandler } from './addDomContentLoadedHandler' ;
87import { addOnClickOnClass as clientAddOnClickOnClass } from './addOnClickOnClass' ;
8+ import { assertValueIsDefined as clientAssertValueIsDefined } from './assertValueIsDefined' ;
99import { clickOnRetry as clientClickOnRetry } from './clickOnRetry' ;
1010import { clickOnStep as clientClickOnStep } from './clickOnStep' ;
1111import { clickOnTestRun as clientClickOnTestRun } from './clickOnTestRun' ;
12+ import { createJsxRuntime as clientCreateJsxRuntime } from './createJsxRuntime' ;
1213import { onDomContentLoad as clientOnDomContentLoad } from './onDomContentLoad' ;
1314import { renderAttributes as clientRenderAttributes } from './render' ;
1415import { setReadJsonReportDataObservers as clientSetReadJsonReportDataObservers } from './setReadJsonReportDataObservers' ;
1516
16- import type { SafeHtml } from '../../../types/internal' ;
17+ import type { ReportClientState , SafeHtml } from '../../../types/internal' ;
1718
18- declare const createLocatorOptions : CreateLocatorOptions ;
19- declare let locator : LocatorFunction < SafeHtml > ;
19+ declare const reportClientState : ReportClientState ;
2020
2121const addDomContentLoadedHandler = clientAddDomContentLoadedHandler ;
2222const addOnClickOnClass = clientAddOnClickOnClass ;
23+ const assertValueIsDefined : typeof clientAssertValueIsDefined = clientAssertValueIsDefined ;
2324const clickOnRetry = clientClickOnRetry ;
2425const clickOnStep = clientClickOnStep ;
2526const clickOnTestRun = clientClickOnTestRun ;
27+ const createJsxRuntime = clientCreateJsxRuntime ;
2628const createSimpleLocator = clientCreateSimpleLocator ;
2729const onDomContentLoad = clientOnDomContentLoad ;
2830const renderAttributes = clientRenderAttributes ;
@@ -34,11 +36,20 @@ const setReadJsonReportDataObservers = clientSetReadJsonReportDataObservers;
3436 * @internal
3537 */
3638export function initialScript ( ) : void {
37- const { locator : locatorAttributes } = createSimpleLocator ( createLocatorOptions ) ;
39+ const jsxRuntime = createJsxRuntime ( ) ;
40+ const e2edRightColumnContainer = document . getElementById ( 'e2edRightColumnContainer' ) ?? undefined ;
3841
39- locator = ( ... args ) : SafeHtml => renderAttributes ( locatorAttributes ( ... ( args as [ string ] ) ) ) ;
42+ assertValueIsDefined ( e2edRightColumnContainer ) ;
4043
41- locator ( '' ) ;
44+ const { locator : locatorAttributes } = createSimpleLocator ( reportClientState . createLocatorOptions ) ;
45+ const locator : LocatorFunction < SafeHtml > = ( ...args ) =>
46+ renderAttributes ( locatorAttributes ( ...( args as [ string ] ) ) ) ;
47+
48+ Object . assign < ReportClientState , Partial < ReportClientState > > ( reportClientState , {
49+ e2edRightColumnContainer,
50+ jsxRuntime,
51+ locator,
52+ } ) ;
4253
4354 addOnClickOnClass ( 'nav-tabs__button' , clickOnRetry ) ;
4455 addOnClickOnClass ( 'step-expanded' , clickOnStep ) ;
0 commit comments