Skip to content

test: mocked e2e coverage for outpatient prioritization and custom forms - #620

Merged
marceloarocha merged 1 commit into
developfrom
claude/beautiful-maxwell-n4ny4r
Sep 6, 2026
Merged

test: mocked e2e coverage for outpatient prioritization and custom forms#620
marceloarocha merged 1 commit into
developfrom
claude/beautiful-maxwell-n4ny4r

Conversation

@marceloarocha

Copy link
Copy Markdown
Collaborator

Extends the mocked e2e suite to two features that had no coverage at all.

tests/mocked/outpatient/outpatientPrioritization.spec.ts

The PRIMARYCARE patient list (/pacientes-ambulatoriais, src/features/outpatient). 6 tests:

  • the default filter payload sent by POST /patient/list on mount (including the hardcoded idSegment: 1), the resolved patient names from POST /names, the observation column showing only the first paragraph, the formatted scheduled date, and the row action opening /prescricao/:id in a new tab;
  • the Setores options following the selected Segmento (departments of other segments hidden, a department shared by two segments listed once) and reaching the search payload;
  • the secondary filters behind "Ver mais": counted in the badge (segment/department/appointment dates are excluded from the count) and sent as appointment / tags;
  • expansion limited to rows carrying marcadores — untagged rows keep only the column spacer — plus the expand-all/collapse-all header toggle;
  • the client-side search box filtering by name and by nº atendimento, ignoring inputs of 3 characters or fewer, and never issuing a new request;
  • a failing POST /patient/list reporting the error and leaving the empty state.

tests/mocked/customForms/customForms.spec.ts

Evolution forms (/configuracoes/forms-personalizados, src/features/memory/CustomForms). 9 tests:

  • the list counting groups and questions per form, the active tag and the name sort;
  • editing a form → PUT /memory/custom-forms/:id with the complete record, success notification and navigation back to the list;
  • changing a question away from a selection type clearing its options in the saved payload;
  • required-field validation (name, group, question id and label) blocking the save, with the header/tab error markers;
  • the unique-question-id rule flagging both duplicates ("ID duplicado"), spaces stripped from ids, and the save going through once fixed;
  • "Duplicar" navigating to new?copyFrom=<key>, prefilling "Cópia de …" and saving as a new record (PUT /memory/custom-forms, no id in the path);
  • the JSON import/export buttons hidden without MAINTAINER, a pasted JSON replacing the form under edit (still saved under the record's own id), and an invalid JSON rejected without touching the form.

Notes

  • No production code changed; only new specs plus the folder list in the CLAUDE.md test tree.
  • Both suites run under the existing make e2e-mock / e2e-mock.yml workflow. Verified locally with --repeat-each=2: 30/30 green.
  • Found while writing the validation test (not fixed here, out of scope for a test-only PR): in CustomFormEditorPage/FormBody, the "Verifique os campos obrigatórios antes de salvar." notification and the automatic jump to the first failing group never fire on the first failed save — the effect depends only on submitCount, so it reads Formik's errors one render too early and bails out; it works from the second attempt on. Adding errors to the effect deps would fix it. The tests assert the field-level errors and the absence of the save request instead, so they stay valid either way.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

🤖 Generated with Claude Code

https://claude.ai/code/session_01RQpzfg94gWWra1P8gmibhv


Generated by Claude Code

Adds two mocked-backend suites for features that had no e2e coverage:

- tests/mocked/outpatient — the PRIMARYCARE patient list: default filter
  payload, department options following the selected segment, secondary
  filter badge/payload, marcadores expansion, the client-side search and
  the failure path.
- tests/mocked/customForms — evolution forms: list counters, save payload
  for an edit and for a duplicate, required-field and unique-id
  validation, options cleared on a question type change, and the
  MAINTAINER-only JSON import.

Also lists the new folders in the CLAUDE.md test tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQpzfg94gWWra1P8gmibhv

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR successfully adds comprehensive test coverage for two previously untested features: outpatient prioritization and custom forms. The mocked E2E test suite now includes 15 new test cases (6 for outpatient prioritization, 9 for custom forms) that cover key workflows including filtering, validation, CRUD operations, and error handling.

The tests are well-structured, follow repository patterns, and appropriately use fictitious test data as required by the project guidelines. All changes are test-only additions with no production code modifications, making this a low-risk enhancement to the test suite.

The documentation update to CLAUDE.md correctly reflects the new test directory structure. Ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@marceloarocha
marceloarocha merged commit 2c5cfd8 into develop Sep 6, 2026
9 checks passed
@marceloarocha
marceloarocha deleted the claude/beautiful-maxwell-n4ny4r branch September 6, 2026 13:32
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.

2 participants