Skip to content

fix(e2e): arm waitForRequest before the click, not chained onto expect - #786

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/e2e-waitforrequest-chained-onto-expect
Sep 1, 2026
Merged

fix(e2e): arm waitForRequest before the click, not chained onto expect#786
rubenvdlinde merged 1 commit into
developmentfrom
fix/e2e-waitforrequest-chained-onto-expect

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

The signing-key rotation test died at load with:

TypeError: expect(...).toBeVisible(...).waitForRequest is not a function

page.waitForRequest had been chained onto the assertion:

await expect(rotateBtn)
    .toBeVisible()
    .waitForRequest(...)

expect().toBeVisible() resolves to undefined, not to the page. So the chain threw and the test died before ever clicking Rotate — it was never testing the rotation it is named for.

Two things wrong, not one

  1. The chain itself is invalid.
  2. waitForRequest has to be armed before the action that triggers the request, or it waits for one that has already gone. So the promise is created first, the click follows, and the promise is awaited after.

Verification

Measured against a live instance rather than read:

before after
playwright test --list could not collect the file collects, test found
playwright test -g rotating-the-signing-key TypeError at load 1 passed
lint 0 0

--list is the check that matters here: a chained-method TypeError is invisible to eslint and prettier, and only surfaces when Playwright actually loads the module.

The signing-key rotation test died at:

  TypeError: expect(...).toBeVisible(...).waitForRequest is not a function

page.waitForRequest had been chained onto the assertion:

  await expect(rotateBtn)
      .toBeVisible()
      .waitForRequest(...)

expect().toBeVisible() resolves to undefined, not to the page, so the chain
threw and the test died before ever clicking Rotate. It was never testing the
rotation it is named for.

waitForRequest also has to be armed BEFORE the action that triggers the
request, or it waits for one that has already gone. So the promise is created
first, the click follows, and the promise is awaited after.

Verified by running it against a live instance rather than by reading:
`playwright test -g rotating-the-signing-key` now reports 1 passed. Before,
`playwright test --list` could not even collect the file.
@rubenvdlinde
rubenvdlinde merged commit 86aa230 into development Sep 1, 2026
34 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/e2e-waitforrequest-chained-onto-expect branch September 1, 2026 12:49
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/learniq @ 7f357b4

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-specs
format
check-l10n-js
check-schema-l10n
composer ✅ 104/104
npm ✅ 637/637
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman ⏭️
Playwright ⏭️ deferred — runs on the promotion into beta/main, not on a pull request into development
Hydra gates

Quality workflow — 2026-09-01 12:57 UTC

Download the full PDF report from the workflow artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant