Skip to content

test(databases): stabilize flaky SQLAlchemy-form visibility assertion#41823

Merged
rusackas merged 1 commit into
masterfrom
fix-database-modal-flaky-test
Jul 7, 2026
Merged

test(databases): stabilize flaky SQLAlchemy-form visibility assertion#41823
rusackas merged 1 commit into
masterfrom
fix-database-modal-flaky-test

Conversation

@rusackas

@rusackas rusackas commented Jul 6, 2026

Copy link
Copy Markdown
Member

SUMMARY

Stabilizes a flaky assertion in the DatabaseModal RTL suite that has been intermittently failing jest shard 1 on unrelated PRs (bit #41776 today; passed on plain rerun of the same commit).

switches to the SQLAlchemy URI form via the connect link (from the Cypress→RTL migration, #41436) asserts toBeVisible() on inputs that mount inside the modal's animated={{ tabPane: true }} Tabs. rc-motion's animation state in jsdom is nondeterministic — in the bad mode the pane never reports visible and the test burns its full timeout, so waitFor-ing visibility wouldn't help. Reproduced locally as bimodal: same tree passes or fails 3/3 depending on the run.

The tab-switch regression the test guards is "the SQLAlchemy form is rendered after clicking connect," so this asserts document presence instead of animation-dependent visibility.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — test-only.

TESTING INSTRUCTIONS

npx jest src/features/databases/DatabaseModal/index.test.tsx — 82/82 pass; the previously flaky test passes 4/4 consecutive runs (previously failing 3/3 in the bad mode).

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

The form mounts inside DatabaseModal's animated tab pane, and
rc-motion's animation state in jsdom is nondeterministic: toBeVisible
intermittently times out (observed on unrelated PRs' jest shards) even
though the form is rendered. Assert on document presence instead, which
is what the tab-switch regression check actually needs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #4c4536

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/features/databases/DatabaseModal/index.test.tsx - 1
    • Weak test assertions for form switch · Line 1807-1814
      Rule [6262] requires tests to verify behavior, not just rendering. The test name 'switches to the SQLAlchemy URI form via the connect link' describes a functional transition, but `toBeInTheDocument()` only confirms presence, not usability. Consider adding an assertion that the inputs are enabled and can accept values, e.g., `expect(screen.getByTestId('database-name-input')).toBeEnabled()` or typing into the field to prove the form switch worked.
Review Details
  • Files reviewed - 1 · Commit Range: b304f33..b304f33
    • superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b304f33
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a4bff9bf744a8000887c4f7
😎 Deploy Preview https://deploy-preview-41823--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.73%. Comparing base (83d93b8) to head (b304f33).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41823      +/-   ##
==========================================
- Coverage   64.74%   64.73%   -0.01%     
==========================================
  Files        2687     2687              
  Lines      148747   148747              
  Branches    34330    34330              
==========================================
- Hits        96299    96293       -6     
- Misses      50681    50687       +6     
  Partials     1767     1767              
Flag Coverage Δ
javascript 69.57% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi aminghadersohi 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.

Scans N/A (single test file, no Python). Fix replaces toBeVisible() with toBeInTheDocument() for the SQLAlchemy form inputs (lines 1812/1814) — not a mask: the flake source is rc-motion's animation state in jsdom being nondeterministic for the tab pane, which is orthogonal to whether the form actually rendered. The regression being guarded ("form renders after clicking connect") is a presence question, and presence is still verified with the specific testids via the pre-existing findByTestId await. Reasonable, well-documented trade-off — no concerns.

@aminghadersohi aminghadersohi 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.

approved_clean: CI fully green (all required checks pass, no pending/red); zero findings above NIT (clean, well-documented root-cause test-stabilization fix — toBeVisible → toBeInTheDocument to remove rc-motion animation nondeterminism from the assertion while still verifying the SQLAlchemy form renders); no open threads from any reviewer; trusted MEMBER author.

@rusackas rusackas merged commit 85eaf15 into master Jul 7, 2026
68 checks passed
@rusackas rusackas deleted the fix-database-modal-flaky-test branch July 7, 2026 01:05
@rusackas rusackas restored the fix-database-modal-flaky-test branch July 7, 2026 01:21
@rusackas

rusackas commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

Added toBeEnabled() checks alongside the presence assertions — good catch.

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.

3 participants