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: Added E2E tests beyond data count in Superset tables #40

Merged
merged 4 commits into from
Oct 24, 2023
Merged

Conversation

kdaud
Copy link
Contributor

@kdaud kdaud commented Sep 21, 2023

Ticket → OZ-336

Description → This PR adds E2E tests beyond data count in Superset tables verifying that;

  • Adding an OpenMRS patient syncs patient into patients table in Superset
  • Starting an OpenMRS visit syncs visit into visits table in Superset
  • Creating an OpenMRS order syncs order into orders table in Superset
  • Adding an OpenMRS encounter syncs encounter into encounters table in Superset
  • Adding an OpenMRS patient condition syncs condition into conditions table in Superset
  • Adding an OpenMRS observation syncs observation into observations table in Superset
  • Adding an OpenMRS patient appointment syncs appointment into appointments table in Superset

@kdaud kdaud changed the title OZ-336: Test Superset data beyond counts OZ-336: Verify that OpenMRS patient and visit sync into patients table and visits table respectively in Superset Oct 18, 2023
@kdaud kdaud changed the title OZ-336: Verify that OpenMRS patient and visit sync into patients table and visits table respectively in Superset OZ-336: Verify that creating OpenMRS patient and visit sync into patients table and visits table respectively in Superset Oct 18, 2023
@kdaud kdaud changed the title OZ-336: Verify that creating OpenMRS patient and visit sync into patients table and visits table respectively in Superset OZ-336: Verify that creating OpenMRS patient, visit syncs patient, visit into patients table and visits table respectively in Superset Oct 18, 2023
@kdaud kdaud requested a review from Ruhanga October 18, 2023 14:18
@kdaud kdaud changed the title OZ-336: Verify that creating OpenMRS patient, visit syncs patient, visit into patients table and visits table respectively in Superset OZ-336: Creating OpenMRS patient, visit syncs patient, visit into patients table and visits table respectively in Superset Oct 18, 2023
@kdaud kdaud changed the title OZ-336: Creating OpenMRS patient, visit syncs patient, visit into patients table and visits table respectively in Superset OZ-336: Add E2E tests for Superset beyond count Oct 20, 2023
@kdaud kdaud force-pushed the OZ-336 branch 3 times, most recently from eff286c to 3946e9a Compare October 23, 2023 06:45
@kdaud kdaud changed the title OZ-336: Add E2E tests for Superset beyond count OZ-336: Added E2E tests beyond count for data in Superset tables Oct 23, 2023
@kdaud kdaud changed the title OZ-336: Added E2E tests beyond count for data in Superset tables OZ-336: Added E2E tests beyond data count in Superset tables Oct 23, 2023
@kdaud
Copy link
Contributor Author

kdaud commented Oct 23, 2023

@Ruhanga, this PR is ready for review.

@kdaud kdaud changed the title OZ-336: Added E2E tests beyond data count in Superset tables OZ-336: Added E2E tests beyond data count in Superset tables + Updated Superset test file name. Oct 23, 2023
@kdaud kdaud changed the title OZ-336: Added E2E tests beyond data count in Superset tables + Updated Superset test file name. OZ-336: Added E2E tests beyond data count in Superset tables + Updating Superset test file name. Oct 23, 2023
Copy link
Contributor

@Ruhanga Ruhanga left a comment

Choose a reason for hiding this comment

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

I'd leave the file name as is testAnalyticsIntegration.spec.ts since this is basically an analytics integration and superset is simply a way to visualise the data. A few other comments to address.


await page.getByRole('tab', { name: 'Query history' }).click();
await homePage.clearSQLEditor();
let sqlQuerry2 = `SELECT * FROM patients WHERE given_name like '${patientName.firstName}' AND family_name like '${patientName.givenName}';`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd name this variable sqlQuery or explicitly patientQuery


await page.getByRole('tab', { name: 'Query history' }).click();
await homePage.clearSQLEditor();
let sqlQuery2 = `SELECT patient_id FROM patients WHERE given_name like '${patientName.firstName}' AND family_name like '${patientName.givenName}';`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here..


await page.getByRole('tab', { name: 'Query history' }).click();
await homePage.clearSQLEditor();
let sqlQuery2 = `SELECT patient_id FROM patients WHERE given_name like '${patientName.firstName}' AND family_name like '${patientName.givenName}';`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, or more explicitly patientIdQuery.

const patientIdValue = Number(patientId);
await page.getByRole('tab', { name: 'Results' }).click();
await homePage.clearSQLEditor();
let sqlQuery3 = `SELECT * FROM _orders WHERE patient_id=${patientIdValue};`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename this to orderQuery.

const updatedNumberOfPatients = await page.getByRole('gridcell', { name: ' ' }).nth(0).textContent();
let updatedPatientCount = Number(updatedNumberOfPatients);

await expect(updatedPatientCount).toBeGreaterThan(initialPatientCount);
Copy link
Contributor

Choose a reason for hiding this comment

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

For patient you should actually check that it's a +1.

@kdaud kdaud requested a review from Ruhanga October 23, 2023 14:38
@kdaud kdaud changed the title OZ-336: Added E2E tests beyond data count in Superset tables + Updating Superset test file name. OZ-336: Added E2E tests beyond data count in Superset tables Oct 23, 2023
@kdaud
Copy link
Contributor Author

kdaud commented Oct 23, 2023

@Ruhanga I've adapted the Superset tests to retrieve test patient from patients table using OpenMRS ID.

await page.getByRole('textbox').first().clear();
await page.getByRole('textbox').fill('SELECT COUNT (*) FROM visits;');
await homePage.clearSQLEditor();
let visitCountsQuery = `SELECT COUNT (*) FROM visits;`
Copy link
Contributor

Choose a reason for hiding this comment

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

visitCountsQueryvisitsCountQuery

const patientIdValue = Number(patientId);
await page.getByRole('tab', { name: 'Results' }).click();
await homePage.clearSQLEditor();
let visitQuery = `SELECT * FROM visits WHERE patient_id=${patientIdValue};`;
Copy link
Contributor

Choose a reason for hiding this comment

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

visitQuerypatientVisitQuery

await page.getByRole('textbox').first().clear();
await page.getByRole('textbox').fill('SELECT COUNT(*) FROM _orders;');
await homePage.clearSQLEditor();
let orderCountsQuery = `SELECT COUNT(*) FROM _orders;`
Copy link
Contributor

Choose a reason for hiding this comment

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

orderCountsQueryordersCountQuery

await page.getByRole('textbox').first().clear();
await page.getByRole('textbox').fill('SELECT COUNT(*) FROM encounters;');
await homePage.clearSQLEditor();
let encounterCountsQuery = `SELECT COUNT(*) FROM encounters;`
Copy link
Contributor

Choose a reason for hiding this comment

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

encounterCountsQueryencountersCountQuery

await page.getByRole('textbox').first().clear();
await page.getByRole('textbox').fill('SELECT COUNT (*) FROM _conditions;');
await homePage.clearSQLEditor();
let conditionCountsQuery = `SELECT COUNT (*) FROM _conditions;`
Copy link
Contributor

Choose a reason for hiding this comment

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

conditionCountsQueryconditionsCountQuery

@kdaud kdaud requested a review from Ruhanga October 24, 2023 07:50
@Ruhanga Ruhanga merged commit 8d1ce37 into main Oct 24, 2023
@kdaud kdaud deleted the OZ-336 branch October 24, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants