Skip to content

test: embedded use case dashboards (DataSpaceFrontend #476) - #122

Merged
saqibmanan merged 5 commits into
CIfrom
test-sync/DataSpaceFrontend-pr476
Sep 24, 2026
Merged

saqibmanan merged 5 commits into
CIfrom
test-sync/DataSpaceFrontend-pr476

Conversation

@saqibmanan

@saqibmanan saqibmanan commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Source: CivicDataLab/DataSpaceFrontend#476 (merge 8b5ac961, merged to dev 2026-09-24). Base: CI, the branch where the workflows run.

What changed (from the diff)

The use case detail page is /usecases/<id>, and the only files touched are Dashboards.tsx and UsecaseDetailsClient.tsx.

  • Linked dashboards used to show as link cards. They are now embedded as <iframe>s. Each iframe has an "Open dashboard in a new tab" link with target=_blank and rel=noreferrer.
  • Links whose path contains /superset/ get standalone=1 added. Other query params are kept.
  • Links that are not http(s), including empty ones, are dropped. If no dashboard is left, the whole section is hidden. Before this change, an empty-link dashboard still showed the section with a card that linked nowhere.
  • The section moved from below the partners block to above "Datasets in this Use Case".

Added

tests/consumer/smoke/test_con_usecase_dashboards.py, marked smoke and readonly:

  • test_superset_dashboard_is_embedded_standalone: the iframe titled with the dashboard's name points at the dashboard link, with standalone=1 added and the link's own params kept. The new-tab link has the same URL, _blank and noreferrer.
  • test_dashboards_render_above_datasets: the dashboards section comes before the datasets section in the DOM.
  • test_section_hidden_without_embeddable_dashboards[no_dashboards | no_usable_link]: no section appears for a use case with no dashboards, or for one whose dashboards all lack an http(s) link.

Use cases are chosen at runtime from the backend (useCases + usecaseDashboards), not hardcoded. Some use cases have dashboards and some don't, and the data differs between dev and prod. If no matching use case exists, the test skips with the reason.

Supporting changes:

  • New locators in locators/consumer/usecase_locators.py.
  • Detail-page helpers on UseCasePage.
  • run-smoke.yml: consumer-smoke now gets API_BASE_URL, using the same expression api-smoke uses. The frontend's deploy workflow passes the prod API URL for main, so a prod readonly run looks up prod use cases.

Why smoke only: this is a UI-only change with no schema or resolver change, so there is no api test. I didn't use regression because run-smoke never selects that marker.

Proof

Everything below ran locally. The frontend worktree was served against the dev API with HOME_URL_DEV=http://localhost:3476.

Green, at the #476 merge commit (8b5ac961):

test_superset_dashboard_is_embedded_standalone PASSED
test_dashboards_render_above_datasets PASSED
test_section_hidden_without_embeddable_dashboards[no_dashboards] PASSED
test_section_hidden_without_embeddable_dashboards[no_usable_link] PASSED

Red, at the parent commit (2970ce92, the page before #476):

test_superset_dashboard_is_embedded_standalone  -> TimeoutException (no iframe on the page)
E  AssertionError: use case 312: 'Dashboards Linked to this Use Case' renders below 'Datasets in this Use Case'
E  AssertionError: use case 320 (no_usable_link): dashboards section rendered with nothing embeddable to show
test_section_hidden_without_embeddable_dashboards[no_dashboards] PASSED   (unchanged behaviour, see below)

no_dashboards with its assertion flipped, at 8b5ac961:

E  AssertionError: use case 314 (no_dashboards): dashboards section rendered with nothing embeddable to show
1 failed

This case guards the new early return null. It passes on the old page because the old page also hid the section when there were no dashboards.

Existing tests on the affected page

Test Result
test_con_006, test_con_007_use_case_download, test_publishers_flow (con_009/010/011), TC_UC_01/02 7 passed against dev
Same tests against the local #476 build Can't run locally. The header nav doesn't render there (my stub Keycloak/NextAuth env), and every one of these starts from a nav click.
test_con_007's path on the #476 build, walked in the browser con_007 opens use case 97, which has no dashboards, so #476 doesn't change its path. On use case 312 (which has a dashboard), the first dataset card is below the 640px iframe and still receives clicks at its centre.

Verified on dev (#476 live, 2026-09-24)

Checked in the browser on /usecases/312:

  • The dashboards section sits above datasets.
  • The iframe URL has standalone=1, and the new-tab link points to the same URL.
  • The Superset charts render inside the embed. The CSRF error I saw locally only happened because localhost is cross-site to the analytics domain.

New tests plus the existing use-case tests, run serially against dev:

test_superset_dashboard_is_embedded_standalone PASSED
test_dashboards_render_above_datasets PASSED
test_section_hidden_without_embeddable_dashboards[no_dashboards] PASSED
test_section_hidden_without_embeddable_dashboards[no_usable_link] PASSED
test_con_006_access_use_case_page PASSED
test_con_007_use_case_download[0-0] PASSED
test_publishers_flow[test_con_009-all|010-org|011-ind] PASSED
test_TC_UC_01_header_text / test_TC_UC_02_usecase_cards PASSED
11 passed

This PR's own consumer-smoke job (run 36006101071, -n 4) ran all 4 new tests and they passed: 61 passed, 4 skipped, none of the skips from this file.

Follow-up commit 3035a35: use case 312's dashboard link was changed to dev analytics and now already contains standalone=1. With that link, the Superset test would pass even if the frontend stopped adding the param. The fixture now prefers a Superset link without standalone (use case 322 on dev) and falls back to any Superset link.

⚠️ Merge only after #476 is on prod (main)

These tests are readonly, so they also run in the prod gates. The DataSpaceFrontend and DataSpaceBackend main deploys both call run-smoke.yml@CI with suite: readonly, pointed at the prod frontend. #476 is on dev only. I ran the file against prod read-only (civicdataspace.in + api.datakeep.civicdays.in):

test_superset_dashboard_is_embedded_standalone              FAILED (no iframe, old page)
test_dashboards_render_above_datasets                       FAILED
test_section_hidden_without_embeddable_dashboards[no_dashboards]  PASSED
test_section_hidden_without_embeddable_dashboards[no_usable_link] FAILED (use case 320)

If this PR merges into CI before #476 is released, the next prod deploy of either repo fails its readonly gate and rolls back. Order: release #476 (dev→main), confirm prod shows the new page, then merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant