Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: record correction - ( birth, death ) #1025

Merged
merged 36 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
177bcec
feat: add get_birth_registration_for_review in birth/helper
jamil314 Jun 5, 2024
454e3be
feat: implement application case - 17
jamil314 Jun 5, 2024
498579e
implemented correct record - 1
jamil314 Jun 10, 2024
cf8b345
fix: fix BirthDeclaration type
jamil314 Jun 11, 2024
b59276b
feat: implemented record correction - 2
jamil314 Jun 11, 2024
906486e
feat: implemented record correction - 3
jamil314 Jun 11, 2024
536c18d
feat: implemented record correction - 4
jamil314 Jun 11, 2024
c896a11
feat: implemented record correction - 5
jamil314 Jun 11, 2024
7254ba0
feat: implemented record correction - 6
jamil314 Jun 11, 2024
0ebb4c8
feat: implemented record correction - 7
jamil314 Jun 11, 2024
0fd902d
feat: implemented record correction - 8
jamil314 Jun 11, 2024
f78e0b7
feat: implemented record correction - 9
jamil314 Jun 11, 2024
c836461
refactor: record correction - 3
jamil314 Jun 11, 2024
9408cc2
amend: accept / reject correction
jamil314 Jun 12, 2024
b8d8f91
amend: validated correction in record audit
jamil314 Jun 13, 2024
d218b79
Merge remote-tracking branch 'origin/develop' into e2e/application
jamil314 Jun 14, 2024
ddc3f95
implemented correct record - 10
jamil314 Jun 14, 2024
942e790
fix: spelling of summary
jamil314 Jun 14, 2024
10c69bf
fix: page.url().includes()
jamil314 Jun 14, 2024
79b6757
feat: implemented correct record - 11
jamil314 Jun 14, 2024
e85d580
feat: implemented correct record - 12
jamil314 Jun 14, 2024
170813d
feat: implemented correct record - 13
jamil314 Jun 14, 2024
ed4027f
feat: implemented correct record - 14
jamil314 Jun 14, 2024
5ac696e
fix: correction summary url check
jamil314 Jun 14, 2024
7eadb4c
feat: implemented correct record - 15
jamil314 Jun 19, 2024
c90f9ab
feat: implemented correct record - 16
jamil314 Jun 19, 2024
1ce9959
feat: implemented correct record - 17
jamil314 Jun 19, 2024
1296cfc
amend: fix numbering
jamil314 Jun 19, 2024
455bfcc
feat: implemented correct record - 18
jamil314 Jun 19, 2024
a78b44b
amend: fix correction summary url() assertion
jamil314 Jun 20, 2024
6685c9a
amend: unskip failed test that are fixed
jamil314 Jun 24, 2024
84caacd
Merge branch 'develop' into e2e/application
jamil314 Aug 6, 2024
5c46f18
fix: kg -> kilogram(kg)
jamil314 Aug 6, 2024
97eb31e
fix: add confirm modal, update id for `same as`
jamil314 Aug 6, 2024
e78da42
fix: broken tests
jamil314 Aug 6, 2024
f614dd6
Merge branch 'develop' into e2e/application
rikukissa Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added e2e/assets/528KB-random.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions e2e/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page, expect } from '@playwright/test'
import { AUTH_URL, CLIENT_URL } from './constants'
import { Locator, Page, expect } from '@playwright/test'
import { AUTH_URL, CLIENT_URL, GATEWAY_HOST } from './constants'

export async function login(page: Page, username: string, password: string) {
const token = await getToken(username, password)
Expand Down Expand Up @@ -88,3 +88,20 @@ export async function validateSectionButtons(page: Page) {
await expect(page.getByText('Save & Exit', { exact: true })).toBeVisible()
await expect(page.locator('#eventToggleMenuToggleButton')).toBeVisible()
}

export const uploadImage = async (
page: Page,
locator: Locator,
image = './e2e/assets/528KB-random.png'
) => {
const fileChooserPromise = page.waitForEvent('filechooser')
locator.click()
const fileChooser = await fileChooserPromise
await fileChooser.setFiles(image)
}

export const getLocationNameFromFhirId = async (fhirId: string) => {
const res = await fetch(`${GATEWAY_HOST}/location/${fhirId}`)
const location = (await res.json()) as fhir.Location
return location.name
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { expect, test, type Page } from '@playwright/test'
import { createPIN, getToken, login } from '../../helpers'
import faker from '@faker-js/faker'
import { createDeclaration } from '../birth/helpers'
import TEST_DATA_1 from '../birth/data/1-both-mother-and-father.json'

test.describe
.serial('17. Validate user can correct a record from audit record page', () => {
let page: Page
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
})

test.afterAll(async () => {
await page.close()
})
test('17.0 Create Declaration', async () => {
const token = await getToken('k.mweene', 'test')
const res = await createDeclaration(token, {
child: {
firstNames: faker.name.firstName(),
familyName: faker.name.firstName(),
gender: TEST_DATA_1['Child details'].Sex.toLowerCase() as 'male'
},
informant: {
type: TEST_DATA_1['Informant details'][
'Relationship to child'
].toUpperCase() as 'MOTHER'
},
attendant: {
type: TEST_DATA_1['Child details'][
'Attendant at birth'
].toUpperCase() as 'PHYSICIAN'
},
mother: {
firstNames: faker.name.firstName(),
familyName: faker.name.firstName()
},
father: {
firstNames: faker.name.firstName(),
familyName: faker.name.firstName()
}
})
expect(res).toStrictEqual({
trackingId: expect.any(String),
compositionId: expect.any(String),
isPotentiallyDuplicate: false,
__typename: 'CreatedIds'
})
})

test('17.1 Go to ready to print tab > search for a certified record > click any application not downloaded', async () => {
await login(page, 'f.katongo', 'test')
await createPIN(page)

await page.getByRole('button', { name: 'Ready to print' }).click()
await page.locator('#name_0').click()

/*
* Expected result: should
* - Navigate to record audit page
* - Not show correct recort optoin
* - Print button should be disabled
*/
await expect(
page.getByRole('button', { name: 'Correct record' })
).not.toBeVisible()
await expect(
page.getByRole('button', { name: 'Print', exact: true })
).toBeDisabled()
expect(page.url().includes('record-audit'))
})

test('17.2 Click download > click assign', async () => {
await page.getByLabel('Assign record').click()
await page.getByRole('button', { name: 'Assign', exact: true }).click()

/*
* Expected result: should
* - Show correct recort optoin
* - Print button should not be disabled
*/
await expect(
page.getByRole('button', { name: 'Correct record' })
).toBeVisible()
await expect(
page.getByRole('button', { name: 'Print', exact: true })
).not.toBeDisabled()
})

test('17.3 Click "Correct record"', async () => {
await page.getByRole('button', { name: 'Correct record' }).click()

/*
* Expected result: should show correct record page
*/
await expect(
page.getByRole('heading', { name: 'Correct record' })
).toBeVisible()
expect(page.url().includes('correction'))
})
})
Loading
Loading