Skip to content

bugfix: await the websocket visibility assertion so it actually runs#8317

Merged
bijin-bruno merged 1 commit into
usebruno:mainfrom
voidmatcha:bugfix/e2e-websocket-await-assertion
Jun 22, 2026
Merged

bugfix: await the websocket visibility assertion so it actually runs#8317
bijin-bruno merged 1 commit into
usebruno:mainfrom
voidmatcha:bugfix/e2e-websocket-await-assertion

Conversation

@voidmatcha

@voidmatcha voidmatcha commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Description

The first websocket E2E test, 'websocket requests are visible', has its only
assertion floating without an await:

test('websocket requests are visible', async ({ pageWithUserData: page, restartApp }) => {
  await page.locator('#sidebar-collection-name').click();

  expect(page.locator('span.item-name').filter({ hasText: BRU_REQ_NAME })).toBeVisible();
});

expect(locator).toBeVisible() is a Playwright web-first matcher: it returns a
Promise that polls and retries until the element is visible or the timeout
elapses. Because the call is not awaited, the Promise is created and discarded,
the assertion never runs, and the test passes whether or not the websocket
request is actually visible in the sidebar. Since this is the sole assertion in
the test, the test provided no real coverage.

The other six expect(...) calls in the same file are all already awaited, so
this is the one line that drifted from the file's own idiom.

The coding standards already flag this class of issue: CODING_STANDARDS.md calls
out "fake assertions" and "fake internal state checks" as things to avoid in
tests. A web-first matcher that is never awaited is exactly that, a check that
looks like an assertion but enforces nothing.

The fix adds the missing await:

-    expect(page.locator('span.item-name').filter({ hasText: BRU_REQ_NAME })).toBeVisible();
+    await expect(page.locator('span.item-name').filter({ hasText: BRU_REQ_NAME })).toBeVisible();

Scope is intentionally limited to this one missing-await in this one file. No
test titles, selectors, or behavior are changed.

Verified locally

Re-fetched and reviewed against main on 2026-06-20. Ran the repository preflight
against the changed spec:

  smell-delta    PASS  total 8->7, p0 3->2, ast 1->0
  ast-artifacts  PASS  postfix rules clean on 1 file(s)
  tsc            SKIP  no tsconfig.json found above changed files
  lint           SKIP  eslint not installed in the repo (node_modules/.bin/eslint absent)
  spec-run       SKIP  playwright not installed in the repo (node_modules/.bin/playwright absent)
  diff-hygiene   PASS  only intended files, no formatting churn
  authoring      PASS  no slop punctuation, 0 comment line(s), no test renames
PREFLIGHT 0 fail(s)

Not run locally: the Playwright websocket E2E suite, TypeScript, and lint. This
clone has no installed dependencies, so the preflight skipped the spec run, tsc,
and eslint. The change is a one-character assertion strengthening within an
existing test and adds no new code paths.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable. (not applicable, test-only change)
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Found while reviewing the test suite with e2e-skills/e2e-reviewer.

Summary by CodeRabbit

  • Tests
    • Enhanced test reliability by improving async handling in WebSocket connection tests.

The 'websocket requests are visible' test calls
expect(page.locator(...)).toBeVisible() without awaiting it. A Playwright
web-first matcher returns a Promise that polls and retries until the
element matches or the timeout elapses. When the expect is not awaited the
Promise is created and immediately discarded, so the assertion never runs
and the test passes whether or not the request is visible in the sidebar.

This is the sole assertion in that test, so the test gave no real coverage.
The six other expect calls in the same file are already awaited, so this
brings the line in line with the file's own idiom.

Signed-off-by: YONGJAE LEE <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e2b5f8a2-2648-45bc-a712-7a5cb4d29e35

📥 Commits

Reviewing files that changed from the base of the PR and between a93e1dc and d2c8ba4.

📒 Files selected for processing (1)
  • tests/websockets/connection.spec.ts

Walkthrough

A single-character fix in tests/websockets/connection.spec.ts adds await to a Playwright visibility assertion inside the websocket requests are visible test, ensuring the async matcher properly resolves before the test continues.

Changes

WebSocket Test Fix

Layer / File(s) Summary
Await visibility assertion
tests/websockets/connection.spec.ts
The expect(...).toBeVisible() call is now awaited, correcting the async control flow so Playwright's matcher result is properly awaited before the test advances.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • sid-bruno

Poem

A missing await once slipped through the net,
Playwright was asked but hadn't answered yet.
One tiny keyword, a world of relief,
The async gods exhale — no more grief.
✅ Tests now wait, as tests always should!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an await to a websocket visibility assertion to ensure it executes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bijin-bruno
bijin-bruno merged commit 21efded into usebruno:main Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants