Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

OZ-336: Voiding an OpenMRS observation updates observations dataset in Superset #67

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
46 changes: 44 additions & 2 deletions e2e/tests/testAnalyticsIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ test('Adding an OpenMRS observation syncs observation into observations table in
// setup
const homePage = new HomePage(page);
await homePage.createPatient();
await homePage.searchOpenMRSPatientID();
const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent();
await homePage.startPatientVisit();
const patient_uuid = await homePage.getPatientUUID();
await homePage.goToSuperset();
Expand Down Expand Up @@ -409,6 +407,50 @@ test('Adding an OpenMRS appointment syncs appointment into appointments table in
await homePage.clearSQLEditor();
});

test('Voiding an OpenMRS observation updates observations dataset in Superset', async ({ page }) => {
// setup
const homePage = new HomePage(page);
await homePage.createPatient();
await homePage.startPatientVisit();
const patient_uuid = await homePage.getPatientUUID();
await homePage.addPatientBiometrics();

// replay
await homePage.goToSuperset();
await expect(page).toHaveURL(/.*superset/);
await homePage.selectDBSchema();
await homePage.clearSQLEditor();
let obsVoidedQuery = `SELECT obs_voided FROM Observations WHERE patient_uuid like '${patient_uuid}';`;

await page.getByRole('textbox').first().fill(obsVoidedQuery);
await homePage.runSQLQuery();

let firstObsVoidedState = await page.locator('div.virtual-table-cell:nth-child(1)');
let secondObsVoidedState = await page.locator('div.virtual-table-cell:nth-child(2)');
let thirdObsVoidedState = await page.locator('div.virtual-table-cell:nth-child(3)');
await expect(firstObsVoidedState).toContainText('false');
await expect(secondObsVoidedState).toContainText('false');
await expect(thirdObsVoidedState).toContainText('false');

await page.goto(`${E2E_BASE_URL}/openmrs/spa/home`);
await homePage.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await homePage.discontinueAnOpenMRSEncounter();

// verify
await page.goto(`${E2E_ANALYTICS_URL}/superset/sqllab`);
await homePage.clearSQLEditor();

await page.getByRole('textbox').first().fill(obsVoidedQuery);
await homePage.runSQLQuery();

await expect(firstObsVoidedState).toContainText('true');
await expect(secondObsVoidedState).toContainText('true');
await expect(thirdObsVoidedState).toContainText('true');

await page.getByRole('tab', { name: 'Results' }).click();
await homePage.clearSQLEditor();
});

test.afterEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.deletePatient();
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/testSenaiteIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test('Voiding a synced lab order cancels corresponding analysis request in SENAI
// replay
await page.goto(`${E2E_BASE_URL}`);
await homePage.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await homePage.discontinueLabOrder();
await homePage.discontinueAnOpenMRSEncounter();

// verify
await homePage.goToSENAITE();
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/functions/testBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class HomePage {
await delay(5000);
}

async discontinueLabOrder() {
async discontinueAnOpenMRSEncounter() {
kdaud marked this conversation as resolved.
Show resolved Hide resolved
await this.page.getByRole('link', { name: 'Visits' }).click();
await this.page.getByRole('tab', { name: 'All encounters' }).click();
await this.page.getByRole('button', { name: 'Options', exact: true }).click();
Expand Down