From 929d733e9fce4d0ff9e6a24b65b82cf6d3943148 Mon Sep 17 00:00:00 2001 From: Daud Kakumirizi <dkakumirizii@gmail.com> Date: Fri, 9 Aug 2024 12:36:27 +0300 Subject: [PATCH 1/3] O3-3766: (test) Clinical form should save inputs even if the encounter time is after the current time --- e2e/specs/clinical-forms.spec.ts | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/e2e/specs/clinical-forms.spec.ts b/e2e/specs/clinical-forms.spec.ts index 419b5c0e7b..6f8183f7d2 100644 --- a/e2e/specs/clinical-forms.spec.ts +++ b/e2e/specs/clinical-forms.spec.ts @@ -119,6 +119,57 @@ test('Fill a clinical form', async ({ page }) => { }); }); +test('Clinical form should save inputs even if the encounter time is after the current time', async ({ page }) => { + const chartPage = new ChartPage(page); + const visitsPage = new VisitsPage(page); + await page.clock.fastForward('00:01'); // Advances the time by 1 minute in the testing environment. + + await test.step('When I visit the chart summary page', async () => { + await chartPage.goTo(patient.uuid); + }); + + await test.step('And I click the `Clinical forms` button on the siderail', async () => { + await page.getByLabel(/clinical forms/i, { exact: true }).click(); + }); + + await test.step('Then I should see `Laboratory Test Results` listed in the clinical forms workspace', async () => { + await expect(page.getByRole('cell', { name: /laboratory test results/i, exact: true })).toBeVisible(); + }); + + await test.step('When I click the `Laboratory Test Results` link to launch the form', async () => { + await page.getByText(/laboratory test results/i).click(); + }); + + await test.step('Then I should see the `Laboratory Test Results` form launch in the workspace', async () => { + await expect(page.getByText(/laboratory test results/i)).toBeVisible(); + }); + + await test.step('And when I fill the `White Blood Cells (WBC)` result as `5000', async () => { + await page.locator('#ManualInputWhiteBloodCells').fill('5500'); + }); + + await test.step('And I fill the `Neutrophils` result as `35`', async () => { + await page.locator('#ManualEntryNeutrophilsMicroscopic').fill('35'); + }); + + await test.step('And I fill the `Hematocrit` result as `18`', async () => { + await page.locator('#ManualEntryHematocrit').fill('18'); + }); + + 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 not see any error messages', async () => { + await expect(page.getByText('error')).not.toBeVisible(); + }); + + await test.step('And I should see a success notification', async () => { + await expect(page.getByText(/record created/i)).toBeVisible(); + await expect(page.getByText(/a new encounter was created/i)).toBeVisible(); + }); +}); + test('Form state is retained when moving between forms in the workspace', async ({ page }) => { const chartPage = new ChartPage(page); From 89fd4a028231b83bfd8826bea7416d551ffa7516 Mon Sep 17 00:00:00 2001 From: Daud Kakumirizi <dkakumirizii@gmail.com> Date: Tue, 20 Aug 2024 11:55:58 +0300 Subject: [PATCH 2/3] Address reviews --- e2e/specs/clinical-forms.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/specs/clinical-forms.spec.ts b/e2e/specs/clinical-forms.spec.ts index 68550c9881..9febed4827 100644 --- a/e2e/specs/clinical-forms.spec.ts +++ b/e2e/specs/clinical-forms.spec.ts @@ -119,10 +119,10 @@ test('Fill a clinical form', async ({ page }) => { }); }); -test('Clinical form should save inputs even if the encounter time is after the current time', async ({ page }) => { +test('Fill a form with a browser slightly ahead of time', async ({ page }) => { const chartPage = new ChartPage(page); const visitsPage = new VisitsPage(page); - await page.clock.fastForward('00:01'); // Advances the time by 1 minute in the testing environment. + await page.clock.fastForward('01:00'); // Advances the time by 1 minute in the testing environment. await test.step('When I visit the chart summary page', async () => { await chartPage.goTo(patient.uuid); @@ -160,14 +160,14 @@ test('Clinical form should save inputs even if the encounter time is after the c await page.getByRole('button', { name: /save/i }).click(); }); - await test.step('Then I should not see any error messages', async () => { - await expect(page.getByText('error')).not.toBeVisible(); - }); - - await test.step('And I should see a success notification', async () => { + await test.step('Then I should see a success notification', async () => { await expect(page.getByText(/record created/i)).toBeVisible(); await expect(page.getByText(/a new encounter was created/i)).toBeVisible(); }); + + await test.step('And I should not see any error messages', async () => { + await expect(page.getByText('error')).not.toBeVisible(); + }); }); test('Form state is retained when moving between forms in the workspace', async ({ page }) => { From 4002b082fa196d89b19060109bd615f1862fbe4a Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe <33048395+jayasanka-sack@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:57:12 +0100 Subject: [PATCH 3/3] Update e2e/specs/clinical-forms.spec.ts --- e2e/specs/clinical-forms.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/specs/clinical-forms.spec.ts b/e2e/specs/clinical-forms.spec.ts index 9febed4827..29f7776671 100644 --- a/e2e/specs/clinical-forms.spec.ts +++ b/e2e/specs/clinical-forms.spec.ts @@ -144,7 +144,7 @@ test('Fill a form with a browser slightly ahead of time', async ({ page }) => { await expect(page.getByText(/laboratory test results/i)).toBeVisible(); }); - await test.step('And when I fill the `White Blood Cells (WBC)` result as `5000', async () => { + await test.step('When I fill the `White Blood Cells (WBC)` result as `5000', async () => { await page.locator('#ManualInputWhiteBloodCells').fill('5500'); });