Skip to content

Commit 79f8281

Browse files
committed
Update the frame.waitForNavigate mapping
We're now injecting and retrieving the jsRegexChecker to pass into WaitForNavigation that will be used to perform a url match against the pattern input from the user script.
1 parent 6c2e42a commit 79f8281

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/js/modules/k6/browser/browser/frame_mapping.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,15 @@ func mapFrame(vu moduleVU, f *common.Frame) mapping {
387387
return nil, fmt.Errorf("parsing frame wait for navigation options: %w", err)
388388
}
389389

390-
return k6ext.Promise(vu.Context(), func() (result any, reason error) {
391-
resp, err := f.WaitForNavigation(popts, nil)
390+
// Inject JS regex checker for URL regex pattern matching
391+
ctx := vu.Context()
392+
jsRegexChecker, err := injectRegexMatcherScript(ctx, vu, f.Page().TargetID())
393+
if err != nil {
394+
return nil, err
395+
}
396+
397+
return k6ext.Promise(ctx, func() (result any, reason error) {
398+
resp, err := f.WaitForNavigation(popts, jsRegexChecker)
392399
if err != nil {
393400
return nil, err //nolint:wrapcheck
394401
}

0 commit comments

Comments
 (0)