Skip to content

Commit daa30bb

Browse files
committed
Add test for regex failure case
1 parent 7646352 commit daa30bb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

internal/js/modules/k6/browser/tests/page_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,3 +2864,24 @@ func TestWaitForNavigationWithURL(t *testing.T) {
28642864
)
28652865
assert.Equal(t, sobek.Undefined(), got.Result())
28662866
}
2867+
2868+
func TestWaitForNavigationWithURL_RegexFailure(t *testing.T) {
2869+
t.Parallel()
2870+
2871+
tb := newTestBrowser(t, withFileServer())
2872+
tb.vu.ActivateVU()
2873+
tb.vu.StartIteration(t)
2874+
2875+
_, err := tb.vu.RunAsync(t, `
2876+
const page = await browser.newPage();
2877+
await page.goto('%s');
2878+
2879+
await Promise.all([
2880+
page.waitForNavigation({ url: /^.*/my_messages.*$/ }),
2881+
page.locator('#page2').click()
2882+
]);
2883+
`,
2884+
tb.staticURL("waitfornavigation_test.html"),
2885+
)
2886+
assert.ErrorContains(t, err, "Unexpected token *")
2887+
}

0 commit comments

Comments
 (0)