Skip to content

test: empty drafts list shows the create button with no ?tab (DataSpaceFrontend #471) - #137

Merged
saqibmanan merged 3 commits into
CIfrom
test-sync/DataSpaceFrontend-pr471
Sep 25, 2026
Merged

saqibmanan merged 3 commits into
CIfrom
test-sync/DataSpaceFrontend-pr471

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Source: CivicDataLab/DataSpaceFrontend#471 (merge b6e9d8bf, merged to dev 2026-09-22). Base: CI.

The merge's own dev deploy failed and rolled back. The later dev deploy of 8b5ac961 (#476), which contains #471, succeeded, so dev is running this change.

What changed (from the diff)

The Use Cases, Collaboratives and Datasets dashboard lists read their drafts/published tab from ?tab=. With no ?tab in the URL the tab started as null, and an effect set it to drafts only after the first render. On Use Cases and Collaboratives, the empty-list branch shows "You have not added any … yet." plus the Add New … button only when the tab is 'drafts'. Otherwise it shows "No Published … yet." with no button. An org with no drafts therefore had no way to start a create flow (the test_prv_011 timeouts). #471 makes drafts the default (parseAsString.withDefault('drafts')).

Datasets is not covered: its empty state (<Content>) shows Add New Dataset on either tab, so #471 did not change what it renders.

What this adds

  • test_prv_015_empty_drafts_list_shows_create_button[usecases|collaboratives] (smoke): logs in, opens an org's list page without ?tab, and asserts the Drafts empty state (with its Add New button) rendered.
  • The bug only shows on an empty drafts list, so the org is picked at runtime: the first of the account's canAdd orgs with zero drafts of that kind (GraphQL, organization header). None → skip with the reason. It never creates anything to force the empty state. If a concurrent create flow adds a draft mid-test, it skips rather than going red.
  • Page Object support: BasePage.list_view_state() returns drafts_empty / published_empty / rows, used by the new view_state() on UseCasesListPage and CollaborativesListPage. Locators live in their locator files.

smoke so it runs on PRs in provider-smoke, which already has API_BASE_URL and KEYCLOAK_*. Read-only, but not marked readonly: the provider suite never runs on prod.

Proof (local, against dev, account 1)

Collected under CI's filter:

$ pytest tests/provider/smoke -m smoke --collect-only -q
...test_prv_015_empty_drafts_list_shows_create_button[usecases]
...test_prv_015_empty_drafts_list_shows_create_button[collaboratives]
14/22 tests collected (8 deselected)

Green:

test_prv_015_empty_drafts_list_shows_create_button[usecases] PASSED
test_prv_015_empty_drafts_list_shows_create_button[collaboratives] PASSED
2 passed in 112.91s

Red: loading ?tab=published, the same non-drafts branch the old null tab rendered:

E  AssertionError: https://dev.civicdataspace.in/dashboard/organization/agami/usecases?tab=published (no ?tab) showed the 'published_empty' state for AGAMI's empty usecases drafts list; expected the Drafts empty state ...
E  AssertionError: https://dev.civicdataspace.in/dashboard/organization/agami/collaboratives?tab=published (no ?tab) showed the 'published_empty' state ...
2 failed in 123.17s

Reverted to the exact file of the green run above.

Gaps

  • Not run against the pre-#471 frontend. Dashboard pages need real Keycloak auth, which a local frontend with stub auth can't provide. The red run above exercises the same render branch instead.
  • Depends on data: it needs a writable org with zero drafts of that kind. On dev today the picked org was AGAMI (a real org, only read from). If every writable org gains drafts, the test skips; it never fails for that reason.
  • Individual (/dashboard/self/…) lists are not covered; account 1 has drafts in all of them.

@saqibmanan
saqibmanan marked this pull request as ready for review September 25, 2026 14:30
@saqibmanan
saqibmanan merged commit 3b3b5fb into CI Sep 25, 2026
3 checks passed
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