-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C2C-341: E2E test for diagnosis workflow
- Loading branch information
Showing
5 changed files
with
129 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
import { test, expect } from '@playwright/test'; | ||
import { Odoo } from '../utils/functions/odoo'; | ||
import { Bahmni } from '../utils/functions/bahmni'; | ||
|
||
let bahmni: Bahmni; | ||
let odoo: Odoo; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
bahmni = new Bahmni(page); | ||
odoo = new Odoo(page); | ||
|
||
await bahmni.login(); | ||
await expect(page.getByText(/registration/i)).toBeVisible(); | ||
await expect(page.getByText(/linical/i)).toBeVisible(); | ||
await expect(page.getByText(/admin/i)).toBeVisible(); | ||
await expect(page.getByText(/appointment scheduling/i)).toBeVisible(); | ||
await expect(page.getByText(/patient documents/i)).toBeVisible(); | ||
}); | ||
|
||
test('Create, revise and discontinue diagnosis.', async ({ page }) => { | ||
// setup | ||
await bahmni.registerPatient(); | ||
|
||
// replay | ||
await bahmni.goToDiagnosis(); | ||
await page.locator('#name-0').fill('Candidiasis (B37.9)'); | ||
await page.getByText('Candidiasis (B37.9)').click(); | ||
await page.locator('#order-0').getByRole('button', { name: /primary/i }).click(); | ||
await page.locator('#certainty-0').getByRole('button', { name: /confirmed/i }).click(); | ||
|
||
// await page.locator('#name-1').fill('Diphtheria (A36.9)'); | ||
// await page.getByText('Diphtheria (A36.9)').click(); | ||
// await page.locator('#order-1').getByRole('button', { name: /secondary/i }).click(); | ||
// await page.locator('#certainty-1').getByRole('button', { name: /presumed/i }).click(); | ||
await bahmni.saveOrder(); | ||
|
||
// verify creation | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
|
||
await expect(page.locator('#diagnosisName')).toContainText(/candidiasis/i); | ||
await expect(page.locator('#order')).toContainText(/primary/i); | ||
await expect(page.locator('#certainty')).toContainText(/confirmed/i); | ||
|
||
// verify revision | ||
await page.locator('#view-content :nth-child(1).btn--success').click(); | ||
await page.locator('#opd-tabs').getByText('Diagnosis').click(); | ||
await page.locator('i.fa.fa-edit').first().click(); | ||
const diagnosisOrder = await page.getByRole('button', { name: 'SECONDARY' }).nth(1); | ||
await diagnosisOrder.waitFor({ state: 'visible' }); // Wait for button to be visible | ||
await diagnosisOrder.focus(); | ||
await diagnosisOrder.click(); | ||
await bahmni.saveOrder(); | ||
// await page.locator('i.fa.fa-edit').nth(1).click(); | ||
// const button2 = await page.getByRole('button', { name: 'PRIMARY' }).nth(1); | ||
// await button2.waitFor({ state: 'visible' }); // Wait for button to be visible | ||
// await button2.focus(); | ||
// await button2.click(); | ||
// await bahmni.saveOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#diagnosisName')).toContainText(/candidiasis/i); | ||
await expect(page.locator('#order')).toContainText(/secondary/i); | ||
await expect(page.locator('#certainty')).toContainText(/confirmed/i); | ||
/* | ||
// verify cancellation | ||
await page.locator('#view-content :nth-child(1).btn--success').click(); | ||
await page.locator('#opd-tabs').getByText('Diagnosis').click(); | ||
await page.locator('#deleteDiagnosis-0').click(); | ||
page.once('dialog', dialog => { | ||
console.log(`Dialog message: ${dialog.message()}`); | ||
dialog.dismiss().catch(() => {}); | ||
}); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.getByText(/no diagnosis for this patient/i)).toBeVisible(); | ||
*/ | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await bahmni.voidPatient(); | ||
await page.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters