Skip to content

Commit

Permalink
(test) O3-3361: E2E test that data isn't lost when opening a workspac…
Browse files Browse the repository at this point in the history
…e from another workspace (#1886)
  • Loading branch information
chimanwadike authored Jul 8, 2024
1 parent 9e466e8 commit cef1867
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions e2e/specs/clinical-forms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ test('Fill a clinical form', async ({ page }) => {
await page.getByLabel(/plan/i).fill(plan);
});

await test.step('And I click the `Order basket` button on the siderail', async () => {
await page.getByRole('button', { name: /order basket/i, exact: true }).click();
});

await test.step('And I click the `Add +` button to order drugs', async () => {
await page.getByRole('button', { name: /add/i }).nth(1).click();
});

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 retained inputs in `Soap note template` form', async () => {
await expect(page.getByText(subjectiveFindings)).toBeVisible();
await expect(page.getByText(objectiveFindings)).toBeVisible();
await expect(page.getByText(assessment)).toBeVisible();
await expect(page.getByText(plan)).toBeVisible();
});

await test.step('And I click on the `Save and close` button', async () => {
await page.getByRole('button', { name: /save/i }).click();
});
Expand Down Expand Up @@ -100,6 +119,52 @@ test('Fill a clinical form', async ({ page }) => {
});
});

test('Form state is retained when moving between forms in the workspace', async ({ page }) => {
const chartPage = new ChartPage(page);

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 `Soap note template` listed in the clinical forms workspace', async () => {
await expect(page.getByRole('cell', { name: /soap note template/i, exact: true })).toBeVisible();
});

await test.step('When I click the `Soap note template` link to launch the form', async () => {
await page.getByText(/soap note template/i).click();
});

await test.step('Then I should see the `Soap note template` form launch in the workspace', async () => {
await expect(page.getByText(/soap note template/i)).toBeVisible();
});

await test.step('When I fill the `Subjective findings` and `Objective findings` questions', async () => {
await page.getByLabel(/subjective Findings/i).fill(subjectiveFindings);
await page.getByLabel(/objective findings/i).fill(objectiveFindings);
});

await test.step('And I click the `Order basket` button on the siderail', async () => {
await page.getByRole('button', { name: /order basket/i, exact: true }).click();
});

await test.step('And I click the `Add +` button to order drugs', async () => {
await page.getByRole('button', { name: /add/i }).nth(1).click();
});

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 retained inputs in `Soap note template` form', async () => {
await expect(page.getByText(subjectiveFindings)).toBeVisible();
await expect(page.getByText(objectiveFindings)).toBeVisible();
});
});

test.afterEach(async ({ api }) => {
await endVisit(api, visit.uuid);
await deletePatient(api, patient.uuid);
Expand Down

0 comments on commit cef1867

Please sign in to comment.