Skip to content

Conversation

inancgumus
Copy link
Contributor

@inancgumus inancgumus commented Oct 15, 2025

What?

  • Adds Page.waitForEvent for waiting until a Page event occurs.
  • Enables WaitForResponse to use the existing Page event handling system.
  • Removes duplicated page response event handling mechanics and a goroutine.

Why?

  • Improves the module's maintainability by using the existing event handling system.
  • Unlocks future WaitForX methods, such as WaitForEvent (with a capital W).

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link

Related PR(s)/Issue(s)

It always uses Page and it doesn't make sense to keep it as a function.

Plus, it's a Page behavior rather than a stand-alone functionality.
Changes:
- Unexported: Not required except in the package.
- This function doesn't only matches URLs, its usage is broad. So, it
  doesn't make sense to name it as URLMatcher.
And fix some naming inconsistencies throughout.
It's a duplication and replaced by RegExMatcher.
It's an unnecessary indirection for a single-line JS execution.
We're also renaming related functions for consistency with RegExMatcher.
We'll use this method later for all page event handling methods, such as
WaitForResponse and WaitForRequest. Implementing it also unlocks us to
easily implement WaitForEvent in the future.
This functionality is a duplication of the existing page.on event system
and complicates the page.on event handling system. Using the existing
event handling system makes the code coherent with the existing and
future functionality.
@inancgumus inancgumus force-pushed the add/page-wait-for-event branch from b5237f2 to b736ccc Compare October 15, 2025 23:46
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 15, 2025 23:52 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 15, 2025 23:54 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 16, 2025 00:01 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 16, 2025 00:03 — with GitHub Actions Inactive
We no longer use events only for Page.On. Events are generic and belongs
to a Page. So, they're now called just page events.
@inancgumus inancgumus force-pushed the add/page-wait-for-event branch from 9bdc188 to 2d2008b Compare October 16, 2025 00:59
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 16, 2025 01:05 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing October 16, 2025 01:06 — with GitHub Actions Inactive
@inancgumus inancgumus force-pushed the refactor/pattern-matcher branch 2 times, most recently from 7f404c6 to 2b264b0 Compare October 16, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant