File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -364,7 +364,6 @@ export class McpContext implements Context {
364364 const networkMultiplier = getNetworkMultiplierFromString (
365365 this . getNetworkConditions ( ) ,
366366 ) ;
367-
368367 const waitForHelper = this . getWaitForHelper (
369368 page ,
370369 cpuMultiplier ,
Original file line number Diff line number Diff line change @@ -126,18 +126,24 @@ export class WaitForHelper {
126126 async waitForEventsAfterAction (
127127 action : ( ) => Promise < unknown > ,
128128 ) : Promise < void > {
129- const navigationStartedPromise = this . waitForNavigationStarted ( ) ;
129+ const navigationFinished = this . waitForNavigationStarted ( ) . then (
130+ navigationStated => {
131+ if ( navigationStated ) {
132+ return this . #page
133+ . waitForNavigation ( {
134+ timeout : this . #navigationTimeout,
135+ signal : this . #abortController. signal ,
136+ } )
137+ . catch ( error => logger ( error ) ) ;
138+ }
139+ return ;
140+ } ,
141+ ) ;
130142
131143 await action ( ) ;
132144
133145 try {
134- const navigationStated = await navigationStartedPromise ;
135- if ( navigationStated ) {
136- await this . #page. waitForNavigation ( {
137- timeout : this . #navigationTimeout,
138- signal : this . #abortController. signal ,
139- } ) ;
140- }
146+ await navigationFinished ;
141147
142148 // Wait for stable dom after navigation so we execute in
143149 // the correct context
You can’t perform that action at this time.
0 commit comments