Skip to content

Commit

Permalink
Merge branch 'main' into ft-show-dat-time-field-on-editing-active-visit
Browse files Browse the repository at this point in the history
  • Loading branch information
brandones authored Jun 28, 2024
2 parents f810ecf + beba218 commit 2dc07c6
Show file tree
Hide file tree
Showing 50 changed files with 1,998 additions and 1,054 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ dist
!.yarn/versions
~

# Yalc, used as a `yarn link` alternative
.yalc
yalc.lock

# i18next using moduleName as a namespace
moduleName/

Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"git-blame.gitWebUrl": "",
"angular.enable-strict-mode-prompt": false
"angular.enable-strict-mode-prompt": false,
"typescript.tsdk": "node_modules/typescript/lib"
}
47 changes: 24 additions & 23 deletions e2e/specs/clinical-forms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,76 +26,77 @@ test('Fill a clinical form', async ({ page }) => {
});

await test.step('And I click the `Clinical forms` button on the siderail', async () => {
await chartPage.page.getByLabel(/clinical forms/i, { exact: true }).click();
await page.getByLabel(/clinical forms/i, { exact: true }).click();
});

await test.step('Then I should see the clinical forms workspace', async () => {
const headerRow = chartPage.formsTable().locator('thead > tr');

await expect(chartPage.page.getByPlaceholder(/search this list/i)).toBeVisible();
await expect(page.getByPlaceholder(/search this list/i)).toBeVisible();
await expect(headerRow).toContainText(/form name \(a-z\)/i);
await expect(headerRow).toContainText(/last completed/i);

await expect(chartPage.page.getByRole('cell', { name: /covid 19/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /laboratory test results/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /soap note template/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /surgical operation/i })).toBeVisible();
await expect(page.getByRole('cell', { name: 'Covid 19', exact: true })).toBeVisible();
await expect(page.getByRole('cell', { name: /laboratory test results/i, exact: true })).toBeVisible();
await expect(page.getByRole('cell', { name: /soap note template/i, exact: true })).toBeVisible();
await expect(page.getByRole('cell', { name: /surgical operation/i, exact: true })).toBeVisible();
});

await test.step('When I click the `Soap note template` link to launch the form', async () => {
await chartPage.page.getByText(/soap note template/i).click();
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(chartPage.page.getByText(/soap note template/i)).toBeVisible();
await expect(page.getByText(/soap note template/i)).toBeVisible();
});

await test.step('When I fill the `Subjective findings` question', async () => {
await chartPage.page.locator('#SOAPSubjectiveFindingsid').fill(subjectiveFindings);
await page.getByLabel(/subjective Findings/i).fill(subjectiveFindings);
});

await test.step('And I fill the `Objective findings` question', async () => {
await chartPage.page.locator('#SOAPObjectiveFindingsid').fill(objectiveFindings);
await page.getByLabel(/objective findings/i).fill(objectiveFindings);
});

await test.step('And I fill the `Assessment` question', async () => {
await chartPage.page.locator('#SOAPAssessmentid').fill(assessment);
await page.getByLabel(/assessment/i).fill(assessment);
});

await test.step('And I fill the `Plan` question', async () => {
await chartPage.page.locator('#SOAPPlanid').fill(plan);
await page.getByLabel(/plan/i).fill(plan);
});

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

await test.step('Then I should see a success notification', async () => {
await expect(chartPage.page.getByText(/the form has been submitted successfully/i)).toBeVisible();
await expect(page.getByText(/record created/i, { exact: true })).toBeVisible();
await expect(page.getByText(/a new encounter was created/i, { exact: true })).toBeVisible();
});

await test.step('And if I navigate to the visits dashboard', async () => {
await visitsPage.goTo(patient.uuid);
});

await test.step('Then I should see the newly filled form in the encounters table', async () => {
await expect(visitsPage.page.getByRole('tab', { name: /visit summaries/i })).toBeVisible();
await expect(visitsPage.page.getByRole('tab', { name: /all encounters/i })).toBeVisible();
await expect(page.getByRole('tab', { name: /visit summaries/i })).toBeVisible();
await expect(page.getByRole('tab', { name: /all encounters/i })).toBeVisible();

await visitsPage.page.getByRole('tab', { name: /^encounters$/i }).click();
await page.getByRole('tab', { name: /^encounters$/i }).click();

const headerRow = visitsPage.page.getByRole('table').locator('thead > tr');
const headerRow = page.getByRole('table').locator('thead > tr');

await expect(headerRow).toContainText(/date & time/i);
await expect(headerRow).toContainText(/encounter type/i);
await expect(headerRow).toContainText(/provider/i);

await visitsPage.page.getByRole('table').locator('th#expand').click();
await page.getByRole('table').locator('th#expand').click();

await expect(visitsPage.page.getByText(subjectiveFindings)).toBeVisible();
await expect(visitsPage.page.getByText(objectiveFindings)).toBeVisible();
await expect(visitsPage.page.getByText(assessment)).toBeVisible();
await expect(visitsPage.page.getByText(plan)).toBeVisible();
await expect(page.getByText(subjectiveFindings)).toBeVisible();
await expect(page.getByText(objectiveFindings)).toBeVisible();
await expect(page.getByText(assessment)).toBeVisible();
await expect(page.getByText(plan)).toBeVisible();
});
});

Expand Down
76 changes: 39 additions & 37 deletions e2e/specs/drug-orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ test.beforeEach(async ({ api }) => {

test('Record, edit and discontinue a drug order', async ({ page }) => {
const medicationsPage = new MedicationsPage(page);
const form = page.locator('#drugOrderForm');
const orderBasket = page.locator('[data-extension-slot-name="order-basket-slot"]');

await test.step('When I visit the medications page', async () => {
await medicationsPage.goTo(patient.uuid);
Expand Down Expand Up @@ -51,37 +53,37 @@ test('Record, edit and discontinue a drug order', async ({ page }) => {
});

await test.step('When I set the dose to `1` tablet', async () => {
await page.getByLabel(/^dose$/i).clear();
await page.getByLabel(/^dose$/i).fill('1');
await form.getByLabel(/^dose$/i).clear();
await form.getByLabel(/^dose$/i).fill('1');
});

await test.step('And I set the route to `Oral`', async () => {
await page.getByPlaceholder(/route/i).click();
await page.getByText('Oral', { exact: true }).click();
await form.getByPlaceholder(/route/i).click();
await form.getByText('Oral', { exact: true }).click();
});

await test.step('And I set the frequency to `Once daily`', async () => {
await page.getByPlaceholder(/frequency/i).click();
await page.getByText('Once daily', { exact: true }).click();
await form.getByPlaceholder(/frequency/i).click();
await form.getByText('Once daily', { exact: true }).click();
});

await test.step('And I set duration to `3` days', async () => {
await page.getByLabel(/^duration$/i).clear();
await page.getByLabel(/^duration$/i).fill('3');
await form.getByLabel(/^duration$/i).clear();
await form.getByLabel(/^duration$/i).fill('3');
});

await test.step('And I set the indication to `Headache`', async () => {
await page.getByLabel(/indication/i).clear();
await page.getByLabel(/indication/i).fill('Headache');
await form.getByLabel(/indication/i).clear();
await form.getByLabel(/indication/i).fill('Headache');
});

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

await test.step('Then the order status should be changed to `New`', async () => {
await expect(page.getByText(/incomplete/i)).not.toBeVisible();
await expect(page.getByText(/new/i)).toBeVisible();
await expect(orderBasket.getByText(/incomplete/i)).not.toBeVisible();
await expect(orderBasket.getByText(/new/i)).toBeVisible();
});

await test.step('When I click on the `Sign and close` button', async () => {
Expand Down Expand Up @@ -118,59 +120,59 @@ test('Record, edit and discontinue a drug order', async ({ page }) => {
});

await test.step('Then I should see the medication launch in the workspace in edit mode', async () => {
await expect(page.getByText('Aspirin 81mg (81mg)')).toBeVisible();
await expect(form.getByText('Aspirin 81mg (81mg)')).toBeVisible();
});

await test.step('When I change the dose to `2` tablets', async () => {
await page.getByLabel(/^dose$/i).clear();
await page.getByLabel(/^dose$/i).fill('2');
await form.getByLabel(/^dose$/i).clear();
await form.getByLabel(/^dose$/i).fill('2');
});

await test.step('And I change the duration to `5` days', async () => {
await page.getByLabel(/^duration$/i).clear();
await page.getByLabel(/^duration$/i).fill('5');
await form.getByLabel(/^duration$/i).clear();
await form.getByLabel(/^duration$/i).fill('5');
});

await test.step('And I change the route to `Inhalation`', async () => {
await page.getByPlaceholder(/route/i).click();
await page.getByText('Inhalation', { exact: true }).click();
await form.getByPlaceholder(/route/i).click();
await form.getByText('Inhalation', { exact: true }).click();
});

await test.step('And I change the frequency to `Twice daily`', async () => {
await page.getByPlaceholder(/frequency/i).clear();
await page.getByText('Twice daily', { exact: true }).click();
await form.getByPlaceholder(/frequency/i).clear();
await form.getByText('Twice daily', { exact: true }).click();
});

await test.step('And I set the frequency to `q12`', async () => {
await page.getByPlaceholder(/frequency/i).clear();
await page.getByPlaceholder(/frequency/i).fill('q12');
await page.getByText('Every twelve hours', { exact: true }).click();
await form.getByPlaceholder(/frequency/i).clear();
await form.getByPlaceholder(/frequency/i).fill('q12');
await form.getByText('Every twelve hours', { exact: true }).click();
});

await test.step('And I set the frequency to `od`', async () => {
await page.getByPlaceholder(/frequency/i).clear();
await page.getByPlaceholder(/frequency/i).fill('od');
await page.getByText('Once daily', { exact: true }).click();
await form.getByPlaceholder(/frequency/i).clear();
await form.getByPlaceholder(/frequency/i).fill('od');
await form.getByText('Once daily', { exact: true }).click();
});

await test.step('And I set the frequency to `bd`', async () => {
await page.getByPlaceholder(/frequency/i).clear();
await page.getByPlaceholder(/frequency/i).fill('bd');
await page.getByText('Twice daily', { exact: true }).click();
await form.getByPlaceholder(/frequency/i).clear();
await form.getByPlaceholder(/frequency/i).fill('bd');
await form.getByText('Twice daily', { exact: true }).click();
});

await test.step('And I change the indication to `Hypertension`', async () => {
await page.getByLabel(/indication/i).clear();
await page.getByLabel(/indication/i).fill('Hypertension');
await form.getByLabel(/indication/i).clear();
await form.getByLabel(/indication/i).fill('Hypertension');
});

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

await test.step('Then the order status should be changed to `Modify`', async () => {
await expect(page.getByText(/new/i)).not.toBeVisible();
await expect(page.getByText(/modify/i)).toBeVisible();
await expect(orderBasket.getByText(/new/i)).not.toBeVisible();
await expect(orderBasket.getByText(/modify/i)).toBeVisible();
});

await test.step('When I click on the `Sign and close` button', async () => {
Expand Down Expand Up @@ -212,7 +214,7 @@ test('Record, edit and discontinue a drug order', async ({ page }) => {
});

await test.step('Then the order status should be changed to `Discontinue`', async () => {
await expect(page.getByText(/discontinue/i)).toBeVisible();
await expect(orderBasket.getByText(/discontinue/i)).toBeVisible();
});

await test.step('And I click on the `Sign and close` button', async () => {
Expand Down
Loading

0 comments on commit 2dc07c6

Please sign in to comment.