Skip to content

e2e : birth form page 2 - #5

Open
taohidkhan22 wants to merge 6 commits into
developfrom
birth-page-2
Open

taohidkhan22 wants to merge 6 commits into
developfrom
birth-page-2

Conversation

@taohidkhan22

@taohidkhan22 taohidkhan22 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Playwright coverage for TestRail C2666 – Validate Child's details page in the birth declaration form (page 2). It also fixes the shared auth and upload URLs, because all tests failed against the current environments without that fix.

Changes

1. New spec: tests/birth-death-forms/birth-form/validate-child-details-page.spec.ts

There is one Playwright test per TestRail step, tagged @C2666. Each test.step name uses the TestRail sub-step number, so a failure in the report points straight to a TestRail step.

Step Field What's covered
1, 2 First name(s), Last name Allowed characters (number, hyphen, apostrophe), invalid _ error, 32-character limit (truncation), Required error on review
3 Sex Every option can be selected, Required error when empty
4 Date of birth Past date accepted, invalid date (31 Feb), future date, Required error when empty
5 Reason for delayed registration Hidden when the child is under 365 days old, shown when older, Required error when empty
6 Place of delivery Required error, options listed, Health Institution list limited to the registrar's jurisdiction, address forms for Residential address and Other
7 Address of place of delivery Default country, province and district, village selection, optional fields, "Invalid input" when the village is empty
8, 9 Attendant at birth, Type of birth Optional (no error when empty), every option can be selected
10 Weight at birth Negative sign is dropped, value ≤ 6 accepted, value > 6 shows "Must be within 0 and 6"
11 Continue Moves on to Informant's details

2. Fix: auth and API URLs (support/constants.ts)

The environments no longer have the gateway. subdomain, so login returned 404 for every test. The URLs now match opencrvs-core develop:

Constant Before After
AUTH_URL https://gateway.<domain>/auth https://login.<domain>/api/auth
GATEWAY_HOST https://gateway.<domain> https://register.<domain>/api

3. Fix: upload URL (support/test-data/utils.ts)

new URL('/upload', GATEWAY_HOST) dropped the /api path, so uploads returned 405. It is now `${GATEWAY_HOST}/upload`.

⚠️ These two fixes affect every spec that logs in or uploads files, not only this one.

TestRail updates

C2666 was changed to match the current UI:

  • "O'Neill" uses a plain apostrophe (').
  • New error texts: "Invalid date field", "Must be a valid birth date", and the full invalid-name message.
  • Birth type options are now "Twin" and "Higher multiple delivery".
  • The village has no default value, and an empty village shows "Invalid input".

@taohidkhan22 taohidkhan22 changed the title wip: child detials page e2e : child detials page 2 Nov 18, 2026
@taohidkhan22 taohidkhan22 changed the title e2e : child detials page 2 e2e : birth form 2 Nov 18, 2026
@taohidkhan22 taohidkhan22 changed the title e2e : birth form 2 e2e : birth form page 2 Nov 18, 2026
@taohidkhan22
taohidkhan22 requested a review from onnee04 November 18, 2026 10:44
@taohidkhan22
taohidkhan22 requested review from tiri39 and removed request for onnee04 November 23, 2026 09:48
await openChildDetailsPage(page)
})

await test.step('3.1 Select each value of the dropdown', async () => {

@tiri39 tiri39 Nov 27, 2026 •

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.

C2666 is updated for the new × button on dropdowns. Please recheck the dropdown steps (3, 6, 7, 8, 9) against it.

await changeOnReview(page, 'child.dob')
})

await test.step('5.2 Enter a date of birth before the delayed registration period', async () => {

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.

step titles for 5.1 and 5.2 seem confusing as any date before one year of birth falls in the delayed reg period.

should be replaced with something simpler like -
5.1: "Enter a date of birth less than 1 year ago"
5.2: "Enter a date of birth more than 1 year ago"

const field = page.locator(fieldId)
await field.click()
await field.getByText(option, { exact: true }).click()
await expect(field).toContainText(option)

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.

selectDropdownOption (L141). toContainText(option) can pass while the menu is still open, because the open list contains every option's text. Suggesting checking that the menu closed and the field shows the selected value:

-  await expect(field).toContainText(option)
+  await expect(page.locator('.react-select__menu')).toBeHidden()
+  await expect(field.locator('.react-select__single-value')).toHaveText(option)

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