fix(test): resolve flaky DSCrudAndBindings_Spec after-hook cleanup failure#41830
fix(test): resolve flaky DSCrudAndBindings_Spec after-hook cleanup failure#41830subrata71 wants to merge 1 commit into
Conversation
…ilure The after() hook failed deterministically because DeleteApplication could not find the app card after NavigateToHomeDirectly — the correct workspace was not selected. Also merged two it() blocks that shared deployed-mode state without a reset, and added focus assertions on the slider interaction. Fixes https://linear.app/appsmith/issue/APP-15242/fix-flaky-cypress-spec-dscrudandbindings-spects-after-hook-cleanup
WalkthroughA Cypress Git regression test consolidates two test cases into one flow, removes redundant comments, adds explicit visibility and focus assertions to slider interactions, and changes cleanup navigation to workspace selection instead of home navigation. ChangesGit Regression Test Restructuring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts (1)
242-249: ⚖️ Poor tradeoffConsider refactoring cleanup logic to avoid after() hook.
The coding guidelines specify "Avoid using after and aftereach in test cases." While this cleanup logic is necessary and the current fix (line 246) correctly addresses the immediate flaky test issue, consider moving cleanup operations to a different pattern in future refactoring (e.g., explicit cleanup within the test or using a custom command).
Note: This is pre-existing code; the current PR appropriately focuses on the minimal fix for the flaky test. As per coding guidelines, after and afterEach hooks should be avoided in test cases.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/client/cypress/e2e/Regression/ClientSide/Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts` around lines 242 - 249, The test uses an after() hook for cleanup (gitSync.DeleteDeployKey, agHelper.WaitUntilAllToastsDisappear, deployMode.NavigateToHomeDirectly, homePage.SelectWorkspace, homePage.DeleteApplication, homePage.DeleteWorkspace); refactor by removing the after() block and moving these cleanup steps into the test flow or a reusable custom Cypress command (e.g., cy.cleanupAppRepo) so cleanup is invoked explicitly at the end of the test where needed; ensure the new pattern calls the same methods in the same order and preserves error handling/awaiting of toasts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@app/client/cypress/e2e/Regression/ClientSide/Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts`:
- Around line 242-249: The test uses an after() hook for cleanup
(gitSync.DeleteDeployKey, agHelper.WaitUntilAllToastsDisappear,
deployMode.NavigateToHomeDirectly, homePage.SelectWorkspace,
homePage.DeleteApplication, homePage.DeleteWorkspace); refactor by removing the
after() block and moving these cleanup steps into the test flow or a reusable
custom Cypress command (e.g., cy.cleanupAppRepo) so cleanup is invoked
explicitly at the end of the test where needed; ensure the new pattern calls the
same methods in the same order and preserves error handling/awaiting of toasts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d6ab97b4-6f23-4f74-8ac6-eeda53b3779d
📒 Files selected for processing (1)
app/client/cypress/e2e/Regression/ClientSide/Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts
Description
The Cypress spec
DSCrudAndBindings_Spec.ts(Git > ExistingApps > v1.9.24) fails deterministically in EE CI with a 30s timeout in theafter()hook whenDeleteApplicationcannot find the app card on the home page.Root cause: After returning from deployed mode via
NavigateToHomeDirectly(), the correct workspace is not selected on the home page.DeleteApplicationassumes the app card is already visible, but it isn't — unlikeDeleteWorkspace, which callsSelectWorkspaceinternally.Three fixes applied:
homePage.SelectWorkspace(workspaceName)beforeDeleteApplicationto ensure the correct workspace is visibleit()blocks — The two tests shared deployed-mode state with no navigation reset between them. Merging eliminates the inter-test state dependency that caused theafter allhook to fire between tests.should("be.visible")and.should("be.focused")to the slider interaction to guard against undetected focus failuresEvidence:
Fixes https://linear.app/appsmith/issue/APP-15242/fix-flaky-cypress-spec-dscrudandbindings-spects-after-hook-cleanup
Automation
/ok-to-test tags="@tag.Git"
🔍 Cypress test results
Communication
Should the DevRel and Marketing teams inform users about this change?
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/26168633701
Commit: 2466c67
Cypress dashboard.
Tags:
@tag.GitSpec:
Wed, 20 May 2026 14:43:45 UTC