@@ -111,21 +111,38 @@ export function startDebugConfigurationTests(): void {
111111 ) ;
112112 await applicationInDirectModeButton . click ( ) ;
113113 await ElementHelper . waitPageLoad ( "domcontentloaded" ) ;
114- const configurationElement = await ElementHelper . TryFindElement (
115- Element . configurationElementSelector ,
116- 5000 ,
117- ) ;
118114
119- let launchContent = await configurationElement ?. textContent ( ) ;
120- if ( launchContent ) {
121- launchContent = launchContent . replace ( / \s / g, "" ) ;
122- assert . ok (
123- launchContent . includes ( "DebugAndroidHermes" ) ,
124- `Expected launchContent to include "Debug Android Hermes", but got: ${ launchContent } ` ,
115+ // Retry reading launch.json content to account for async insertion timing
116+ let launchContent : string | null | undefined = null ;
117+ let includesHermesConfig = false ;
118+ const maxAttempts = 20 ; // ~10s with 500ms waits
119+
120+ for ( let attempt = 0 ; attempt < maxAttempts ; attempt ++ ) {
121+ const configurationElement = await ElementHelper . TryFindElement (
122+ Element . configurationElementSelector ,
123+ 5000 ,
125124 ) ;
126- } else {
125+ launchContent = await configurationElement ?. textContent ( ) ;
126+ if ( launchContent ) {
127+ const normalized = launchContent . replace ( / \s / g, "" ) ;
128+ if ( normalized . includes ( "DebugAndroidHermes" ) ) {
129+ includesHermesConfig = true ;
130+ break ;
131+ }
132+ }
133+ await ElementHelper . waitPageLoad ( "networkidle" ) ;
134+ }
135+
136+ if ( ! launchContent ) {
127137 assert . fail ( "Fail to set launch file configuration." ) ;
128138 }
139+
140+ assert . ok (
141+ includesHermesConfig ,
142+ `Expected launchContent to include "Debug Android Hermes", but got: ${ (
143+ launchContent || ""
144+ ) . replace ( / \s / g, "" ) } `,
145+ ) ;
129146 } ) ;
130147 } ) ;
131148}
0 commit comments