You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/06/09 19:05:48 UTC
[PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
sadpandajoe opened a new pull request, #40914:
URL: https://github.com/apache/superset/pull/40914
### 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](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #40914:
URL: https://github.com/apache/superset/pull/40914
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4663273601
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | e6d770d1ddec4a15502b0d9e0eb59ef54f6b5e15 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a28640d5028980008fc38f6 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40914--superset-docs-preview.netlify.app](https://deploy-preview-40914--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DckxDoAgDADAv3SWpEEl1R_4jEolDGhJZTHGv8t2yb1QTc_aYAUYYDe-Yu4WvvOubOKKsjhrpa8cteizSf_AnsKEMqOnhRCRUhwpBfh-) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-40914--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4674071399
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4663120461
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4663197230
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40914?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.14%. Comparing base ([`8eda626`](https://app.codecov.io/gh/apache/superset/commit/8eda626466de552e96fd39251f0194e86ddee7fb?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e6d770d`](https://app.codecov.io/gh/apache/superset/commit/e6d770d1ddec4a15502b0d9e0eb59ef54f6b5e15?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 43 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ 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](https://app.codecov.io/gh/apache/superset/pull/40914/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/40914/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.87% <ø> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/40914?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #40914:
URL: https://github.com/apache/superset/pull/40914#discussion_r3383950392
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx:
##########
@@ -165,6 +165,22 @@ describe('DashboardBuilder', () => {
expect(header).toBeInTheDocument();
});
+ test('should hide DashboardHeader when standalone mode hides nav and title (?standalone=2)', () => {
+ // React-level equivalent of the legacy `cy.get('#app-menu').should('not.exist')`
+ // Cypress assertion. The `#app-menu` node lives in Flask's spa.html template,
+ // gated by `{% if standalone_mode %}`, so RTL cannot reach it directly.
+ // `?standalone=2` maps to DashboardStandaloneMode.HideNavAndTitle, which the
+ // DashboardBuilder honours by suppressing the React-side DashboardHeader.
+ const originalSearch = window.location.search;
+ window.history.replaceState({}, '', '/?standalone=2');
+ try {
+ const { queryByTestId } = setup();
+ expect(queryByTestId('dashboard-header-container')).not.toBeInTheDocument();
+ } finally {
+ window.history.replaceState({}, '', `/${originalSearch}`);
+ }
Review Comment:
The test mutates the browser URL but only saves/restores `window.location.search`. Since the test also changes the pathname to `/?standalone=2`, restoring only the search can leave the pathname/hash different from what it was before the test (and can leak state to subsequent tests if the Jest URL ever changes or another test sets a non-root pathname). Prefer capturing/restoring the full `window.location.href` (pattern used elsewhere) and only change the query param while preserving the existing pathname/hash.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4664206590
<!-- Bito Reply -->
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:
```typescript
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);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40914:
URL: https://github.com/apache/superset/pull/40914#issuecomment-4696697511
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] test(dashboard): migrate standalone mode Cypress spec to RTL [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #40914:
URL: https://github.com/apache/superset/pull/40914#discussion_r3391585340
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx:
##########
@@ -165,6 +165,42 @@ describe('DashboardBuilder', () => {
expect(header).toBeInTheDocument();
});
+ test('should hide DashboardHeader when standalone mode hides nav and title (?standalone=2)', () => {
+ // React-level equivalent of the legacy `cy.get('#app-menu').should('not.exist')`
+ // Cypress assertion. The `#app-menu` node lives in Flask's spa.html template,
+ // gated by `{% if standalone_mode %}`, so RTL cannot reach it directly.
+ // `?standalone=2` maps to DashboardStandaloneMode.HideNavAndTitle, which the
+ // DashboardBuilder honours by suppressing the React-side DashboardHeader.
+ const originalHref = window.location.href;
+ window.history.replaceState({}, '', '/?standalone=2');
+ try {
+ const { queryByTestId } = setup();
+ expect(queryByTestId('dashboard-header-container')).not.toBeInTheDocument();
+ } finally {
+ window.history.replaceState({}, '', originalHref);
+ }
+ });
+
+ test('should apply editing class and hide header when both edit and standalone params are set', () => {
+ // Combined-params analogue of the legacy `?edit=true&standalone=true` Cypress
+ // mount. The two URL params are orthogonal on the React side: standalone=2
+ // suppresses DashboardHeader regardless of editMode, while editMode still
+ // drives the `dashboard--editing` class on the wrapper.
+ const originalHref = window.location.href;
+ window.history.replaceState({}, '', '/?edit=true&standalone=2');
Review Comment:
This test claims to validate behavior when both `edit` and `standalone` URL params are set, but `DashboardBuilder` only reads `URL_PARAMS.standalone` (it never reads `edit`). Since `editMode` is being forced via the redux override, `?edit=true` in the URL is misleading and could give false confidence about URL→state coverage in this file. Consider removing the `edit=true` query param and updating the test name/comment to reflect that `editMode` comes from state here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org