Repository navigation
test(e2e): fix account and workspaces flaky test - #335
Conversation
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.
|
@SinghAstra is attempting to deploy a commit to the MagicAPI Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe account connections E2E test now filters GitHub provider locators to visible elements before checking connection status and disconnectability. ChangesGitHub provider visibility
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to 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: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
imshashank
left a comment
There was a problem hiding this comment.
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, andapps/webis 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.
What this changes
Fixes an intermittent strict mode violation in the
account-and-workspaces.spec.tsend-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 matchinggetByTestId('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 theprovider-githublocator 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
.envvariables (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 verifyis green, all four checks (relying on CI)any, no non-null assertions@orbit/sharedpackages/shared/src/policy, not only in the UIbun run db:releaseandbun run db:check-driftpassed against the target database before this shipsAnything 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.
provider-githublocators to visible elements.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
Reviews (1): Last reviewed commit: "test(e2e): fix account and workspaces fl..." | Re-trigger Greptile