Skip to content
New issue

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

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

Already on GitHub? # to your account

(test) Amend E2E test for retained inputs in clinical forms workspace #1959

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Changes from 4 commits
Commits
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
41 changes: 16 additions & 25 deletions e2e/specs/clinical-forms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ test('Form state is retained when minimizing a form in the workspace', 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 test.step('Then I should see the `Laboratory Test Results` form listed in the clinical forms workspace', async () => {
await expect(page.getByRole('cell', { name: /laboratory test results/i, exact: true })).toBeVisible();
});

Expand All @@ -189,38 +189,29 @@ test('Form state is retained when minimizing a form in the workspace', async ({
});

await test.step('And I maximize the form', async () => {
await page.getByLabel('maximize').click();
await page.getByRole('button', { name: /maximize/i }).click();
});

await test.step('And I fill the `White Blood Cells (WBC)` result as `5000', async () => {
await page.locator('#ManualInputWhiteBloodCells').fill('5000');
await test.step('And I fill in values for the `White Blood Cells (WBC)`, `Platelets`, and `Neutrophils` questions', async () => {
await page.locator('#ManualInputWhiteBloodCells').waitFor();
Copy link
Member

@kdaud kdaud Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denniskigen waiting for the locator of White Blood Count to load before filling it out seems to prevent data loss.

Copy link
Member

@kdaud kdaud Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve run the GA 4 times, and the test passed each time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Looks like that did the trick! I've run it a couple more times too. Thanks, @kdaud. We should probably document this somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, the same behaviour occurs non-deterministically in the results viewer spec.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably document this somewhere.

Not sure where to document this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, I'll sort it out. Mind approving the PR?

await page.getByRole('spinbutton', { name: /white blood cells/i }).fill('5000');
await page.getByRole('spinbutton', { name: /platelets/i }).fill('180000');
await page.getByRole('spinbutton', { name: /neutrophils/i }).fill('35');
});

await test.step('And I fill the `Platelets` result as `180000`', async () => {
await page.locator('#ManualEntryPlatelets').fill('180000');
await test.step('Then I minimize the form in the workspace', async () => {
await page.getByRole('button', { name: /minimize/i }).click();
});

await test.step('And I fill the `Neutrophils` result as `35`', async () => {
await page.locator('#ManualEntryNeutrophilsMicroscopic').fill('35');
await test.step('And then I maximize the form in the workspace', async () => {
await page.getByRole('button', { name: /maximize/i }).click();
});

await test.step('When I minimize the form in the workspace', async () => {
await page.getByLabel('Minimize').click();
});

await test.step('And then maximize the form in the workspace', async () => {
await page.getByLabel('Maximize').click();
});

await test.step('Then I should see the entered data retained in the form', async () => {
const whiteBloodCells = await page.locator('#ManualInputWhiteBloodCells');
await expect(whiteBloodCells).toHaveValue('5000');

const platelets = await page.locator('#ManualEntryPlatelets');
await expect(platelets).toHaveValue('180000');

const neutrophils = page.locator('#ManualEntryNeutrophilsMicroscopic');
await expect(neutrophils).toHaveValue('35');
await test.step('And I should see the original form state retained', async () => {
// await expect(page.getByText(/loading/i)).not.toBeVisible();
await expect(page.getByLabel(/white blood cells/i)).toHaveValue('5000');
await expect(page.getByLabel(/platelets/i)).toHaveValue('180000');
await expect(page.getByLabel(/neutrophils/i)).toHaveValue('35');
});

await test.step('When I click on the `Save` button', async () => {
Expand Down