Skip to content

test(dashboard): migrate standalone mode Cypress spec to RTL - #40914

Merged
sadpandajoe merged 4 commits into
masterfrom
dashboard-load-rtl
Jun 15, 2026
Merged

sadpandajoe merged 4 commits into
masterfrom
dashboard-load-rtl

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Migrates the dashboard standalone-mode scenario from the deleted Cypress spec cypress-base/cypress/e2e/dashboard/_skip.load.test.ts (removed in #40384) to a component-level RTL test in DashboardBuilder.test.tsx. Part of the Cypress→Playwright/RTL migration epic.

The original Cypress spec opened ?edit=true&standalone=true and asserted three things. Two are already covered by existing unit tests; the new RTL test covers the third:

Original assertion Where covered
?edit=true → discard-changes-button visible URL→state in extractUrlParams.test.ts; state→DOM in Header.test.tsx (should render the "Discard changes" button under editMode: true).
?standalone=true → #app-menu not in DOM #app-menu lives in Flask's spa.html and is gated server-side by {% if standalone_mode %} — out of RTL's reach. The React-side equivalent is ?standalone=2 (DashboardStandaloneMode.HideNavAndTitle), which makes DashboardBuilder suppress <DashboardHeader />. Net-new RTL test added.
Log emission (originally skipped as flaky) Already covered by logger.test.ts (should POST an event to /superset/log/ when called).

The literal ?standalone=true parses to 1 (HideNav), which only hides the Flask-rendered app menu. Using standalone=2 documents the closest React-level contract and is called out in the test's comment.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — test-only change.

TESTING INSTRUCTIONS

```bash
cd superset-frontend
npm run test -- src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx
```
All 25 tests should pass, including the new one:

  • `should hide DashboardHeader when standalone mode hides nav and title (?standalone=2)`

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Replaces the standalone-mode assertion from the deleted Cypress spec
`cypress-base/cypress/e2e/dashboard/_skip.load.test.ts` (removed in
#40384) with a component-level RTL test in DashboardBuilder.test.tsx.
The React-side contract is `?standalone=2` (HideNavAndTitle) suppressing
`<DashboardHeader />`; the original Flask-template `#app-menu` selector
is out of RTL's reach. Other assertions in the deleted spec are already
covered by existing unit tests (extractUrlParams, Header, logger).

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

codecov Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.14%. Comparing base (8eda626) to head (ae582cc).
⚠️ Report is 91 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #40914   +/-   ##
=======================================
  Coverage   64.14%   64.14%           
=======================================
  Files        2653     2653           
  Lines      143525   143525           
  Branches    33120    33120           
=======================================
+ Hits        92063    92070    +7     
+ Misses      49851    49844    -7     
  Partials     1611     1611           
Flag Coverage Δ
javascript 67.87% <ø> (+<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.

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit e6d770d
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a28640d5028980008fc38f6
😎 Deploy Preview https://deploy-preview-40914--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.

Copilot AI 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.

Pull request overview

Migrates the dashboard standalone-mode assertion from a removed Cypress _skip E2E spec into a React Testing Library component test, ensuring the React-side “standalone hides header” contract remains covered as part of the Cypress → RTL/Playwright migration effort.

Changes:

  • Add an RTL test verifying ?standalone=2 (HideNavAndTitle) suppresses the DashboardHeader in DashboardBuilder.

@bito-code-review

Copy link
Copy Markdown
Contributor

The suggestion to capture and restore the full window.location.href is appropriate. This approach ensures that the pathname and hash are preserved, preventing potential state leakage to subsequent tests. Below is the recommended update for the test setup:

const originalHref = window.location.href;
// ... test logic ...
window.history.replaceState({}, '', originalHref);

superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx

const originalHref = window.location.href;
// ... test logic ...
window.history.replaceState({}, '', originalHref);

sadpandajoe and others added 2 commits June 9, 2026 16:29
Save window.location.href instead of just window.location.search so the
finally block restores the original pathname and hash too, not just the
query string. Prevents state leakage if the Jest base URL ever moves
off the root path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the React-side analogue of the legacy `?edit=true&standalone=true`
Cypress mount, asserting the two URL params remain orthogonal:
standalone=2 hides DashboardHeader while editMode still drives the
`dashboard--editing` wrapper class. Satisfies sc-107447 task 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jun 9, 2026
@sadpandajoe
sadpandajoe marked this pull request as ready for review June 10, 2026 17:13
@bito-code-review

bito-code-review Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #310627

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: e6d770d..8230b7e
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.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

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Address PR #40914 review feedback:

- Add a companion test asserting ?standalone=1 (HideNav) keeps the
  React-side DashboardHeader present, pinning the boundary against
  ?standalone=2 (HideNavAndTitle) which suppresses it.
- Rename the combined-params test and drop the inert ?edit=true URL
  param: DashboardBuilder reads only URL_PARAMS.standalone; editMode is
  sourced from Redux, so the legacy edit=true param had no effect on the
  rendered output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #734402

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 8230b7e..ae582cc
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.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

@sadpandajoe
sadpandajoe merged commit 5a97e01 into master Jun 15, 2026
65 checks passed
@sadpandajoe
sadpandajoe deleted the dashboard-load-rtl branch June 15, 2026 16:57
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