Skip to content

Commit 0af875f

Browse files
authored
Merge pull request #1327 from opencrvs/ocrvs-9198-a
Ocrvs 9198 a
2 parents 7b86ca3 + ce319eb commit 0af875f

16 files changed

+5877
-46
lines changed

e2e/helpers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export async function createPIN(page: Page) {
2727
}
2828
}
2929

30+
export async function logout(page: Page) {
31+
await page.locator('#ProfileMenu-dropdownMenu').getByRole('button').click()
32+
await page.getByText('Logout').click()
33+
await page.context().clearCookies()
34+
}
35+
3036
export async function loginToV2(
3137
page: Page,
3238
credentials = CREDENTIALS.LOCAL_REGISTRAR

e2e/testcases/v2-birth/1-birth-event-declaration.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { expect, test, type Page } from '@playwright/test'
22
import { loginToV2 } from '../../helpers'
33
import path from 'path'
44
import { faker } from '@faker-js/faker'
5+
import { REQUIRED_VALIDATION_ERROR } from './helpers'
56

67
const child = {
78
firstNames: faker.person.firstName('female')
@@ -226,7 +227,7 @@ test.describe.serial('1. Birth event declaration', () => {
226227
* - Required for registration
227228
*/
228229
await expect(page.getByText("Informant's details")).toBeVisible()
229-
await expect(page.getByText('Required for registration')).toBeVisible()
230+
await expect(page.getByText(REQUIRED_VALIDATION_ERROR)).toBeVisible()
230231
})
231232

232233
test('1.5.3 Select any option in relationship to child and click the "continue" button', async () => {

e2e/testcases/v2-birth/2-validate-the-child-details-page.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test'
22
import { goToSection, loginToV2 } from '../../helpers'
3-
3+
import { REQUIRED_VALIDATION_ERROR } from './helpers'
44
test.describe.serial("2. Validate the child's details page", () => {
55
test.beforeEach(async ({ page }) => {
66
await loginToV2(page)
@@ -107,7 +107,7 @@ test.describe.serial("2. Validate the child's details page", () => {
107107
await expect(
108108
page
109109
.locator('[data-test-id="row-value-child.firstname"]')
110-
.getByText('Required for registration')
110+
.getByText(REQUIRED_VALIDATION_ERROR)
111111
).toBeVisible()
112112
})
113113

@@ -148,7 +148,7 @@ test.describe.serial("2. Validate the child's details page", () => {
148148
await expect(
149149
page
150150
.locator('[data-test-id="row-value-child.gender"]')
151-
.getByText('Required for registration')
151+
.getByText(REQUIRED_VALIDATION_ERROR)
152152
).toBeVisible()
153153
})
154154
})
@@ -217,7 +217,7 @@ test.describe.serial("2. Validate the child's details page", () => {
217217
await expect(
218218
page
219219
.locator('[data-test-id="row-value-child.dob"]')
220-
.getByText('Required for registration')
220+
.getByText(REQUIRED_VALIDATION_ERROR)
221221
).toBeVisible()
222222
})
223223
})
@@ -287,7 +287,7 @@ test.describe.serial("2. Validate the child's details page", () => {
287287
page
288288
.getByRole('row', { name: 'Reason for delayed' })
289289
.locator('[data-test-id="row-value-child.reason"]')
290-
).toHaveText('Required for registration')
290+
).toHaveText(REQUIRED_VALIDATION_ERROR)
291291
})
292292
})
293293

e2e/testcases/v2-birth/3-validate-the-mother-and-father-details-page.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { test, expect } from '@playwright/test'
22
import { goToSection, loginToV2 } from '../../helpers'
3+
import { REQUIRED_VALIDATION_ERROR } from './helpers'
34

45
test.describe('3. Validate the mothers and fathers details pages', () => {
56
test.beforeEach(async ({ page }) => {
@@ -87,7 +88,7 @@ test.describe('3. Validate the mothers and fathers details pages', () => {
8788
await expect(
8889
page
8990
.locator('[data-test-id="row-value-mother.firstname"]')
90-
.getByText('Required for registration')
91+
.getByText(REQUIRED_VALIDATION_ERROR)
9192
).toBeVisible()
9293
})
9394

@@ -115,7 +116,7 @@ test.describe('3. Validate the mothers and fathers details pages', () => {
115116
await page.locator('#mother____nid-form-input div').nth(1).click()
116117
await page.getByRole('heading', { name: 'Birth' }).click()
117118
await expect(page.locator('#mother____nid_error')).toContainText(
118-
'Required for registration'
119+
REQUIRED_VALIDATION_ERROR
119120
)
120121
})
121122

0 commit comments

Comments
 (0)