From bd2020f7f4f279b021e1ca99fb7e16f8103288cf Mon Sep 17 00:00:00 2001 From: Daud Kakumirizi Date: Tue, 20 Aug 2024 12:57:43 +0300 Subject: [PATCH] O3-3766: (test) Fill a form with a browser slightly ahead of time. (#1958) --------- Co-authored-by: Dennis Kigen Co-authored-by: Jayasanka Weerasinghe <33048395+jayasanka-sack@users.noreply.github.com> --- 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 46c343b921..a86454c4d5 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('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('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); + }); + + 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('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 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 }) => { const chartPage = new ChartPage(page);