Skip to content

Automate C2491: validate quick search options - #6

Open
tiri39 wants to merge 4 commits into
developfrom
e2e/C2491-quick-search
Open

tiri39 wants to merge 4 commits into
developfrom
e2e/C2491-quick-search

Conversation

@tiri39

@tiri39 tiri39 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Automates C2491. The test searches by tracking ID, name, registration number, NID, phone and email, with valid and invalid values.

  • tests/search/functionality/quick-search-options.spec.ts: the test (@C2491)
  • support/search/quick-search-records.ts: creates the test records
  • support/test-data/death-declaration.ts: now also returns trackingId

Why it works in every release

The test creates its own records at the start of each run, with random names and values. It does not use or change existing data, so records from earlier runs or releases cannot affect it. It also checks every page of the search results.

Fuzzy search

The name search checks the TestRail rule at each limit:

  • 1–2 letters: exact match only
  • 3–5 letters: 1 wrong letter still matches, 2 do not
  • More than 5 letters: 2 wrong letters still match, 3 do not

The names are random, but the test makes the "wrong" versions from them and checks the number of changes on every run.

Update: 5 tests with soft checks

  • C2491 is split into 5 tests (all @C2491). Each test creates only its own records.
  • Result checks are soft. A failed check is reported, and the later steps still run.

Update: file upload fix

The API helpers failed with "File does not belong to this record". The server now accepts a file only when the file is stored under the record (opencrvs-core #14473).

The changes in support/test-data/ are copied from packages/testland/e2e/support/test-data/ in opencrvs-core:

  • uploadFile() in utils.ts now takes the event ID. It sends path: events/<eventId>/ with the upload.
  • The four callers in api-actions.ts, birth-declaration.ts and death-declaration.ts now pass the event ID.

Other change:

  • quick-search-records.ts moved from support/search/ to tests/search/, because only the quick search tests use it.

All specs import the changed helpers, so the CI check runs the full suite.

@tiri39
tiri39 requested review from onnee04 and taohidkhan22 and removed request for onnee04 and taohidkhan22 November 18, 2026 05:54
@tiri39
tiri39 force-pushed the e2e/C2491-quick-search branch from f65a341 to d4493fb Compare November 23, 2026 08:54
@tiri39
tiri39 requested a review from taohidkhan22 November 23, 2026 09:25

@taohidkhan22 taohidkhan22 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.

Review of PR #6: Automate C2491 (quick search)

Verdict: request changes. The test design is good: each test creates its own random records, waits through the API until search finds them, checks every result page, and checks the fuzzy edit distances on each run.

Must fix

  1. Wrong tag (quick-search-options.spec.ts:496). The "Extra checks" test is not in C2491, but it has the @C2491 tag. Create a TestRail case for it, or remove the test.
  2. Spec-only code in support/. support/ is a copy of core. Move quick-search-records.ts next to the spec. Put the reusable search helpers and the trackingId change in death-declaration.ts in a PR to core. The NOTIFY branch does not return trackingId.

Should fix

  1. Setup problems show as search failures.
    • The registration number can be missing (:259-270). Wait for it in createIdRecord(), and remove the if (!registrationNumber) return branch.
    • trackingId as string (5 places) hides a missing ID. Throw an error in setup.
  2. 30-second timeout (:57). CLAUDE.md does not permit a longer timeout. Wait for the follow-up request with page.waitForResponse(). If the slow request is a client bug, report it.
  3. Open the record with openRecordByTitle() (:193), as core does.
  4. Check the summary page (:197), for example with getByTestId('tracking-id-value').

Nits

  • Add the helper names to assertFunctionNames in eslint.config.mjs, and remove the 3 eslint-disable comments.
  • Link the workbook (quick-search-records.ts:31), or remove the reference.
  • count(), isVisible() and isDisabled() in findInResults do not retry. They can become flaky if the render order changes.
  • Use expect(...).toBeVisible() instead of waitFor() (:230), and toHaveURL(predicate) instead of expect.poll (:69).
  • Use a test ID or getByRole('row') instead of [id^="row_"] (:45).
  • The check for exactly 3 row buttons (:98) breaks if the row gets a new button.
  • Use role names, not usernames, in comments.
  • The edit-distance code is a lot to maintain. Fixed name pairs would be simpler.

copy corCopy core's support files
@tiri39
tiri39 requested a review from taohidkhan22 November 27, 2026 10:42
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