Skip to content

test(e2e): fix account and workspaces flaky test - #335

Merged
imshashank merged 1 commit into
Noveum:mainfrom
SinghAstra:fix/255-e2e-provider-flake
Aug 19, 2026
Merged

imshashank merged 1 commit into
Noveum:mainfrom
SinghAstra:fix/255-e2e-provider-flake

Conversation

@SinghAstra

@SinghAstra SinghAstra commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Fixes an intermittent strict mode violation in the account-and-workspaces.spec.ts end-to-end test.

Why

As outlined in the issue, when Playwright navigates to /settings/account/connections, Next.js begins rendering the incoming page but hasn't yet unmounted the outgoing tree. Playwright resolves both trees simultaneously, finds two elements matching getByTestId('provider-github'), and crashes due to a strict mode ambiguity.

Closes #255

How you know it works

Added .filter({ visible: true }) to both occurrences of the provider-github locator in the test.

To be completely honest, I didn't run the test command locally. I ran into a local Windows environment issue where the Playwright workers weren't picking up my .env variables (DATABASE_URL). Rather than fighting my local setup, I pushed the fix directly to let the GitHub CI pipeline verify the E2E run.

Screenshots

Not applicable.

Checklist

  • bun run verify is green, all four checks (relying on CI)
  • Tests added or updated, and they fail without the change
  • No comments added to code, and no em-dash characters anywhere
  • No any, no non-null assertions
  • External input is parsed with a Zod schema from @orbit/shared
  • Authorization is enforced on the server through packages/shared/src/policy, not only in the UI
  • Docs updated if behaviour, configuration or setup changed
  • bun run db:release and bun run db:check-drift passed against the target database before this ships

Anything reviewers should know

Went with the suggested .filter({ visible: true }) approach since it requires no changes to the actual React component and directly addresses the Playwright DOM resolution issue.

Greptile Summary

Updates the account and workspace end-to-end test to disambiguate duplicate GitHub provider cards during page transitions.

  • Filters both provider-github locators to visible elements.
  • Preserves the existing connected-state and disconnect-button assertions.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The pinned Playwright version supports the visibility filter, and the locator narrowing is consistent with the duplicate outgoing and incoming tree scenario the test is intended to handle.

Important Files Changed

Filename Overview
apps/web/e2e/account-and-workspaces.spec.ts The updated locators use a Playwright-supported visibility filter to avoid strict-mode ambiguity without changing test intent.

Reviews (1): Last reviewed commit: "test(e2e): fix account and workspaces fl..." | Re-trigger Greptile

Resolves Noveum#255. Fixes the strict mode violation caused by navigation races. Added .filter({ visible: true }) to the provider card locator so Playwright strictly interacts with the incoming visible component and ignores the outgoing hidden tree while Next.js is unmounting it.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@SinghAstra is attempting to deploy a commit to the MagicAPI Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added tests Test coverage and test infrastructure area: web The Next.js app and its UI labels Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

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 Plus

Run ID: 5a26454d-8842-44c2-ad81-c2a1cd94baf7

📥 Commits

Reviewing files that changed from the base of the PR and between a447d5a and bc3dfba.

📒 Files selected for processing (1)
  • apps/web/e2e/account-and-workspaces.spec.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The account connections E2E test now filters GitHub provider locators to visible elements before checking connection status and disconnectability.

Changes

GitHub provider visibility

Layer / File(s) Summary
Visible provider assertions
apps/web/e2e/account-and-workspaces.spec.ts
The test scopes GitHub connection and disconnect-button locators to visible provider elements.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to bc3df

This PR narrowly adjusts an end-to-end test locator to avoid a transient duplicate-element match; no actionable merge-blocking risk remains after normal CI checks and review.

Suggested reviewers: imshashank, pulkitxm

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the E2E flaky-test fix described by the changes.
Description check ✅ Passed The description explains the strict mode failure, the visibility fix, and the linked issue.
Linked Issues check ✅ Passed The changes address issue #255 by filtering both GitHub provider locators to visible elements.
Out of Scope Changes check ✅ Passed The changes are limited to the account-and-workspaces E2E locator fix required by issue #255.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@imshashank imshashank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the diagnosis in #255 exactly. The issue concluded that two trees are briefly mounted during the soft navigation and one is hidden, and .filter({ visible: true }) is the right way to say "the one the user can actually see" rather than widening the assertion or adding a sleep.

Checked the things that could have bitten:

  • filter({ visible: true }) needs Playwright 1.51 or newer, and apps/web is on ^1.62.1.
  • Both getByTestId('provider-github') call sites in the spec are covered. I grepped, lines 84 and 110 were the only two, and you got both.
  • The e2e job passed on CI.

Thanks for saying plainly that you did not run it locally and leaned on CI instead. That is the right call for an e2e-only change and much more useful to me than a checkbox I would have had to take on trust.

@imshashank
imshashank merged commit b945462 into Noveum:main Aug 19, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: web The Next.js app and its UI tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

account-and-workspaces e2e flakes on a duplicated provider card

2 participants