Skip to content

Add E2E empty state tests for organization FAQ and resource pages #2143

Description

@aasimsyed

Terms

Description

Background

Subtask of #1983. Organization FAQ (/organizations/[id]/faq) and organization resources (/organizations/[id]/resources) pages render <EmptyState> when embedded lists (faqEntries, resources on the organization payload from getOrganization) are empty, with different copy for admins (can add) vs non-editors. Event FAQ and resources already have dedicated empty-state E2E specs (#2073); the organization entity does not yet mirror that coverage and still relies on seed-dependent display branches in generic page specs.

This subtask adds Playwright specs that use page.route() to fulfill HTTP 200 on the public organization detail GET with an organization JSON body whose faqEntries and resources arrays are empty (or overridden to include items for the “not empty” case), then assert empty-state visibility, messaging/variant, and that the empty state is not shown when at least one item is present.


Scope

Pages:

Page Empty condition
/organizations/[id]/faq Organization has no FAQ entries
/organizations/[id]/resources Organization has no resources

API to mock (align with the app):

  • GET organization by id via the public API base used by getOrganization (withoutAuth: true/api/public/communities/organizations/:id or equivalent glob used in the Nuxt proxy). FAQ and resource lists for these subpages are read from the same organization detail payload (not separate list URLs), analogous to events and mock-public-event-detail.ts.

Permission branching:

  • Admin / can-edit: empty state visible with the variant that includes create/add affordances (per EmptyState permission prop)
  • Non-editor (viewer): empty state visible with the read-only variant (no misleading edit CTAs)

Test cases

For each page (FAQ and resources):

  1. Empty list — After mocking empty faqEntries or resources on the organization detail response, data-testid="empty-state" (or page-object emptyState) is visible and the message matches expectations for that page type
  2. Admin vs viewer — With the same empty API response, assert the correct empty-state variant for an admin vs a member/viewer (see epic [Epic] Add E2E tests for error and empty states across entity pages #1983 and EmptyState props)
  3. Not empty — When the mocked payload includes at least one FAQ entry or resource (or default backend data is allowed), empty state is not shown and list/cards are visible

Spec file locations

frontend/test-e2e/specs/all/organizations/organization-faq/organization-faq-empty-states.spec.ts
frontend/test-e2e/specs/all/organizations/organization-resources/organization-resources-empty-states.spec.ts

Implementation notes

Detail mock setup — Add a small helper module (for example frontend/test-e2e/utils/mock-public-organization-detail.ts) patterned after mock-public-event-detail.ts: stable UUID constant for cold page.goto, routeMockPublicOrganizationDetail(page, orgId, body), and mockOrganizationDetailPayload(orgId, overrides) returning minimal JSON valid for mapOrganization (including required fields such as texts, location, socialLinks, status, and empty faqEntries / resources by default). Fulfill 200 + application/json before page.goto so client-only fetches see the mock.

Page objects — Prefer OrganizationFAQPage (~/test-e2e/page-objects/organization/faq/OrganizationFAQPage.ts) and organization resources locators from newOrganizationPage (~/test-e2e/page-objects/organization/OrganizationPage.ts), reusing emptyState / emptyStateMessage patterns from event specs.

Auth / roles — Use test.use({ storageState: ... }) or existing constants such as MEMBER_AUTH_STATE_PATH vs default admin storage, consistent with event-faq-empty-states.spec.ts and other entity permission specs.

Cleanupawait page.unrouteAll() in afterEach (or scoped route teardown) to avoid leaking mocks.

Tags — Use @desktop and @mobile to match sibling entity specs.

Contribution

Part of #1983 — E2E error and empty state coverage. Should follow the implementation and assertions established for events in #2073. Can be worked in parallel with organization group empty-state and form-validation subtasks. Parent audit context: #1959.

Metadata

Metadata

Assignees

Labels

featureNew feature or requestfrontendRelates to the project frontendtypescriptRelates to TypeScript code

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions