Skip to content

Commit

Permalink
Edit from immunization data
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijaykv5 committed Jun 24, 2024
1 parent 0e9bcc3 commit 5a73618
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 4 additions & 5 deletions e2e/commands/patient-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ export const deletePatient = async (api: APIRequestContext, uuid: string) => {
await api.delete(`rest/v1/patient/${uuid}`, { data: {} });
};

export const createImmunizations = async (api: APIRequestContext, uuid: string) => {
export const createImmunizations = async (api: APIRequestContext, uuid: string, visit: string) => {
const immunizationData = {
resourceType: 'Immunization',
status: 'completed',
vaccineCode: {
coding: [
{
code: '783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
display: 'Polio vaccination, oral',
display: 'Hepatitis B vaccination',
},
],
},
Expand All @@ -124,13 +124,13 @@ export const createImmunizations = async (api: APIRequestContext, uuid: string)
},
encounter: {
type: 'Encounter',
reference: 'Encounter/fca94b00-8b1f-4468-b006-68e77f438978',
reference: `Encounter/${visit}`,
},
occurrenceDateTime: '2024-06-10T13:50:00.000Z',
expirationDate: '2052-06-29T18:30:00.000Z',
location: {
type: 'Location',
reference: 'Location/44c3efb0-2583-4c80-a79e-1f756a03c0a1',
reference: `Location/${process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID}`,
},
performer: [
{
Expand All @@ -155,7 +155,6 @@ export const createImmunizations = async (api: APIRequestContext, uuid: string)
const immunizationRes = await api.post('fhir2/R4/Immunization?_summary=data', {
data: immunizationData,
});
console.log('Immunization response:', immunizationRes);
await expect(immunizationRes.ok()).toBeTruthy();
const immunization = await immunizationRes.json();
return immunization;
Expand Down
9 changes: 2 additions & 7 deletions e2e/specs/edit-immunizations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ let visit: Visit;

test.beforeEach(async ({ api }) => {
patient = await generateRandomPatient(api);
visit = await startVisit(api, patient.uuid);
const visit = await startVisit(api, patient.uuid);

await createImmunizations(api, patient.uuid);
await createImmunizations(api, patient.uuid, visit.uuid);
});

test('Edit an immunization', async ({ page }) => {
Expand All @@ -37,17 +37,12 @@ test('Edit an immunization', async ({ page }) => {
});

await test.step('And I set `Polio vaccination, oral` as the immunization', async () => {
await page.getByRole('combobox', { name: /immunization/i }).click();
await page.getByText(/polio vaccination, oral/i).click();
});

await test.step('And I click on the `Save` button', async () => {
await page.getByRole('button', { name: /save/i }).click();
});

await test.step('Then I should see a success toast notification', async () => {
await expect(page.getByText(/Vaccination saved successfully/i)).toBeVisible();
});
});

test.afterEach(async ({ api }) => {
Expand Down

0 comments on commit 5a73618

Please sign in to comment.