Skip to content

[ENG-1009] 🧪 Run Playwright against the Care 3.1 seed backend and fix the specs it breaks - #17531

Draft
nihal467 wants to merge 5 commits into
developfrom
issues/ENG-1009/playwright-care-3-1-seed-backend
Draft

nihal467 wants to merge 5 commits into
developfrom
issues/ENG-1009/playwright-care-3-1-seed-backend

Conversation

@nihal467

@nihal467 nihal467 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes

Related: ohcnetwork/care#3900 (Care 3.1 default fixtures). There is no separate frontend issue.

  • Switch the Playwright CI companion backend default (CARE_BACKEND_REF) from develop to demo/care-3-1-seed, so every run on this PR builds the backend from that branch and loads its new seed data.
  • Fix the specs that the new seed data breaks (99 failed against the seed before this change, see Validation). The specs no longer depend on data that differs between the current and the Care 3.1 fixtures:
    • The auth setup clears admin's saved workspace choice. The fixtures make "Visit and handover" admin's default workspace, so every encounter opened on its handover page instead of updates (35 specs: questionnaire fill and forms, care team, back navigation and others).
    • Open the fixture state organization (Kerala) by name with a shared helper. Its Governance card now reads "State" (govt_org_type metadata) instead of "Government" (24 specs).
    • Match the seeded Pharmacy medicines by their exact old or new names ("Paracetamol" / "Paracetamol 500 mg tablet", same for Ibuprofen).
    • The account setup finds or creates the patient's active, open account through the API. The fixtures leave the active account mid-billing, and the patient page's search schema drops the status filter the setup sent.
    • External delivery specs create their product with a valid UCUM unit instead of copying a fixture product's unit.
    • Invoices: use a future date range for the empty list, and open an issued invoice that is not a refund for the payment sheet.
    • Print templates: enable the watermark with check(), and expect the margins that the facility's default template starts a new template with.
    • Department user spec links care-role-member (in no department); the queue spec matches the department option by its leading name (options now include the description); the admission permission spec doesn't expect a preselected department for a facility admin in two departments; the unit autofill spec makes Urinalysis Observation a single value first (the fixtures define it as a panel).
  • Fix a crash in the value set list ("Couldn't Load the Page") when a value set has no compose.exclude. The backend's ValueSetCompose.exclude is optional and omitted when empty, and the Care 3.1 fixtures seed such a value set (rounds-vitals). exclude is now typed as optional and read as empty when missing.
  • Seed issues worth fixing in [ENG-1009] Add the seed for Care 3.1 care#3900 (the specs work around them): 20 seeded products use unit codes the system-ucum-units value set rejects ({capsule}, {vial}, {strip}, {each} and others), so the API refuses them on save; the fixtures set a default workspace for the admin login; rounds-vitals is stored without exclude.
  • Draft for verification. Before merging, revert the backend default to develop (or to the released backend ref).

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Validation

  • Before this change: the full suite against the seed backend (dispatched Playwright Tests with backend_ref=demo/care-3-1-seed, run 47066805732) had 1518 passed, 99 failed, 7 not run of 1624. The same frontend commit passed 1624/1624 against develop.
  • After this change, in a Codespace on demo/care-3-1-seed (ec5dc711) with the default 144-patient fixtures, with the workflow's backend settings (rate limits off, JWKS, JWT lifetimes, gunicorn):
    • npx playwright test --project=setup-auth --project=setup-facility --project=setup-patient --project=setup-account --project=setup-data --workers=4: 10 passed.
    • npx playwright test --project=chromium --workers=3 <the 48 spec files that failed or were flaky against the seed>: 254 passed, 0 failed, 0 flaky.
  • npx tsc --noEmit -p tsconfig.json passed. ESLint and Prettier pass on the changed files.
  • Full suite in CI on this PR against the seed backend (run 47090798561): 1625 passed, 0 failed, 0 skipped. That run temporarily used the standard runner (ubuntu-latest, same 8 shards and 6 workers), because larger-runner jobs are blocked by the organization's Actions billing. The runner switch moved to [ENG-1009] Run the Playwright test shards on the standard runner #17539 and is reverted here, so new runs on this PR wait for the billing fix or [ENG-1009] Run the Playwright test shards on the standard runner #17539.
  • Not yet run against the develop backend; the PR's own run covers that once the backend default is reverted.

Point the companion backend default at ohcnetwork/care demo/care-3-1-seed
(ohcnetwork/care#3900) so the E2E suite exercises the new default fixtures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: db4cc7b
Status: ✅  Deploy successful!
Preview URL: https://6f5d8388.care-preview-a7w.pages.dev
Branch Preview URL: https://issues-eng-1009-playwright-c.care-preview-a7w.pages.dev

View logs

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 8
Workers per Shard: 6

Metric Count
Total Tests 1625
✅ Passed 1625
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #13935

The Care 3.1 default fixtures (ohcnetwork/care#3900) change data the specs
relied on. Keep the specs working with both the current and the new fixtures:

- Clear admin's saved workspace choice in the auth setup, so encounters open
  on the standard screens the specs expect instead of a seeded workspace.
- Open the fixture state organization (Kerala) by name. Its Governance card
  label now follows its metadata ("State") instead of "Government".
- Match the seeded Pharmacy medicines by their exact old or new names
  ("Paracetamol" or "Paracetamol 500 mg tablet", likewise Ibuprofen).
- Create the external delivery product with a valid UCUM unit instead of
  copying a fixture product's unit, which the API may reject.
- Use a future date range for the empty invoice list, and open an issued
  invoice that is not a refund for the payment sheet.
- Enable the print template watermark with check(), and expect the margins
  the facility's default template starts a new template with.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

React Doctor found 4 issues in 1 file · 4 warnings · score 89 / 100 (Great) · vs develop

4 warnings

src/components/ValueSet/ValueSetForm.tsx

  • ⚠️ L52 React function has high control-flow complexity no-high-complexity-react-function
  • ⚠️ L98 Data passed to parent via effect no-pass-data-to-parent
  • ⚠️ L98 Live state pushed to parent via effect no-pass-live-state-to-parent
  • ⚠️ L98 Parent kept in sync with a callback effect no-prop-callback-in-effect
⚠️ Warning: .github/workflows/react-doctor.yml is configured incorrectly. See below to fix.

React Doctor compares against develop to report only the issues this pull request introduces. This run couldn't complete that comparison (usually a shallow CI checkout with no merge base), so it listed every issue in the changed files, including ones that already existed on develop.

Add fetch-depth: 0 to the actions/checkout step in .github/workflows/react-doctor.yml so the checkout includes the history React Doctor needs:

 jobs:
   react-doctor:
     steps:
       - uses: actions/checkout@v5
+        with:
+          fetch-depth: 0

       - uses: millionco/react-doctor@v2

To silence this warning, set silence-missing-baseline-warning: true on the React Doctor action.

Reviewed by React Doctor for commit db4cc7b. See inline comments for fixes.

…ences

The value set list crashed ("Couldn't Load the Page") when a value set had no
compose.exclude: the backend omits it when a value set has no exclusions
(ValueSetCompose.exclude is optional), and the Care 3.1 fixtures seed such a
value set. Type exclude as optional and read a missing one as empty.

Specs, for the Care 3.1 fixtures (ohcnetwork/care#3900):

- Find or create the patient's open account in the account setup through
  the API. The fixtures leave the active account mid-billing, and the
  patient page's search schema drops the status filters the setup sent.
- Link a user in no department in the department user spec: the fixtures
  put care-volunteer in a team under Administration.
- Match the queue department option by its leading name; options now carry
  the department's description.
- Don't expect a preselected department for a facility admin with several.
- Make Urinalysis Observation a single value before the unit autofill spec,
  as the fixtures define it as a panel of components.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nihal467 nihal467 changed the title [ENG-1009] 🧪 Run Playwright against the Care 3.1 seed backend [ENG-1009] 🧪 Run Playwright against the Care 3.1 seed backend and fix the specs it breaks Dec 3, 2026
Larger-runner (ubuntu-latest-m) jobs fail to start: "recent account payments
have failed or your spending limit needs to be increased". Use ubuntu-latest
so this PR's suite runs against the Care 3.1 seed. Revert along with the
backend default before merging.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit 2619f56. The runner switch moves to its own PR, #17539.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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