Skip to content

test: fix always-passing e2e assertions and missing awaits#7616

Open
voidmatcha wants to merge 1 commit into
TanStack:mainfrom
voidmatcha:fix/e2e-non-asserting-checks
Open

test: fix always-passing e2e assertions and missing awaits#7616
voidmatcha wants to merge 1 commit into
TanStack:mainfrom
voidmatcha:fix/e2e-non-asserting-checks

Conversation

@voidmatcha

@voidmatcha voidmatcha commented Jun 12, 2026

Copy link
Copy Markdown

This PR strengthens existing Playwright E2E assertions. It does not add behavior or rename tests.

What changed:

  • Replace expect(locator).toBeTruthy() checks in the basic auth fixture with await expect(locator).toBeVisible(). A Playwright Locator object is always truthy, so the previous checks did not verify the visible error text.
  • Correct the signup assertion in the same auth fixture from test@gmail.com to test2@gmail.com, matching the address passed to login(page, 'test2@gmail.com', ...). The dead truthy assertion was hiding that expected-value typo.
  • Convert one-shot page.url(), innerText(), and isVisible() reads to web-first Playwright matchers (toHaveURL, toHaveText, toBeVisible).
  • Add await to six increase-button.click() calls in the Solid transition fixture so the following assertions do not race the click actions.

Scope note:

I intentionally kept this to 4 files and one assertion-family migration. The same broad families still appear in sibling Solid, Vue, and React fixture suites. I can follow up separately if maintainers want the mirror suites swept too.

Blame check:

  • The affected lines in these E2E fixtures trace at least as far back as cc12980 from 2026-03-06.

Verification:

  • Re-fetched origin/main on 2026-06-13.
  • Applied commit fdf325b to a temp worktree based on current origin/main and ran:
    bash scripts/pr-preflight.sh tmp/preflight-tanstack-router e2e/react-router/basic-file-based/tests/params.spec.ts e2e/react-start/basic-auth/tests/app.spec.ts e2e/react-start/custom-basepath/tests/navigation.spec.ts e2e/solid-router/basic-file-based/tests/transition.spec.ts
  • Result: PREFLIGHT 0 fail(s) with scanner delta total from 51 to 26, p0 from 26 to 1, ast from 10 to 0; AST artifacts clean; diff hygiene clean; authoring clean with 0 added comments and no test renames.
  • Not run locally: repo TypeScript, lint, or Playwright E2E. This clone has no node_modules, so preflight skipped tsc, eslint, and Playwright because local repo binaries were absent. The documented full path requires pnpm install, pnpm exec playwright install, and the repo build/dev setup.

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

- basic-auth: expect(locator).toBeTruthy() passes for any Locator object,
  so all three auth-failure tests verified nothing; converted to
  await expect(locator).toBeVisible(). The signup test asserted
  'test@gmail.com' while signing up 'test2@gmail.com' - latent expected-
  value typo that the dead assertion never caught; corrected to the
  signed-up address.
- custom-basepath + params: one-shot isVisible()/innerText()/page.url()
  reads converted to auto-retrying toBeVisible/toHaveText/toHaveURL
  (9 one-shot URL reads in params.spec.ts swept in the same pass)
- solid transition: await six floating increase-button click() statements

Same families exist in the solid/vue mirror suites; left untouched to
keep this change reviewable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR modernizes Playwright e2e test assertions across four independent test suites by replacing manual DOM queries and page checks with Playwright's built-in matchers, and improves async click handling in transition tests.

Changes

Playwright e2e test assertion modernization

Layer / File(s) Summary
React Router Unicode path assertion updates
e2e/react-router/basic-file-based/tests/params.spec.ts
Converted params.spec.ts assertions from direct page.url() comparisons and innerText() reads to await expect(page).toHaveURL() and await expect(...).toHaveText() matchers across unicode routing and non-latin path test cases.
React Start basic auth and signup assertion updates
e2e/react-start/basic-auth/tests/app.spec.ts
Updated app.spec.ts login failure assertions to use toBeVisible() instead of toBeTruthy(), and corrected post-signup verification to assert the newly submitted email (test2@gmail.com) instead of the previous email.
React Start custom basepath redirect assertion updates
e2e/react-start/custom-basepath/tests/navigation.spec.ts
Updated navigation.spec.ts server-side redirect test to use await expect(page).toHaveURL() and await expect(...).toBeVisible() matchers instead of synchronous isVisible() and page.url() checks.
Solid Router click interaction synchronization
e2e/solid-router/basic-file-based/tests/transition.spec.ts
Updated transition.spec.ts to await all increase-button click actions across 1-click, 2-click, and 3-click test sequences, ensuring proper synchronization with async UI behavior.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 Four test files dance with Playwright's grace,
No more manual checks in this e2e space,
Awaited clicks and matchers so fine,
Tests that synchronize, assertions align,
Hopping toward reliability, line by line! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically identifies the main changes: fixing non-asserting e2e assertions and adding missing awaits in Playwright tests.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

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