Skip to content

Commit

Permalink
OZ-548: Added relevant self documenting comments to the .env file. (#84)
Browse files Browse the repository at this point in the history
Co-authored-by: Dimitri R <[email protected]>
  • Loading branch information
kdaud and mks-d authored Apr 18, 2024
1 parent af0d1d0 commit 5a5052c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 35 deletions.
60 changes: 48 additions & 12 deletions .env
Original file line number Diff line number Diff line change
@@ -1,28 +1,64 @@
# Global configuration for Ozone HIS
O3_URL_DEMO=https://demo.ozone-his.com
#
# This file is loaded each time the automated E2E test suite is run.
# It sets a bunch of envvars that drive the behaviour of the automated E2E test suite.
#

# The target environment that will be tested.
# Possibles values are dev, qa, demo.
TEST_ENVIRONMENT=dev

# Set to true to test Ozone Pro, false to test Ozone FOSS.
TEST_PRO=true

#
# Ozone HIS URLs for dev, qa and demo environments.
#

# OpenMRS
O3_URL_DEV=https://ozone-dev.mekomsolutions.net
O3_URL_QA=https://ozone-qa.mekomsolutions.net
ODOO_URL_DEMO=https://erp.demo.ozone-his.com
O3_URL_DEMO=https://demo.ozone-his.com

# Odoo
ODOO_URL_DEV=https://erp.ozone-dev.mekomsolutions.net
ODOO_URL_QA=https://erp.ozone-qa.mekomsolutions.net
SENAITE_URL_DEMO=https://lims.demo.ozone-his.com
ODOO_URL_DEMO=https://erp.demo.ozone-his.com

# SENAITE
SENAITE_URL_DEV=https://lims.ozone-dev.mekomsolutions.net
SENAITE_URL_QA=https://lims.ozone-qa.mekomsolutions.net
KEYCLOAK_URL_DEMO=https://auth.demo.ozone-his.com
SENAITE_URL_DEMO=https://lims.demo.ozone-his.com

# Superset
SUPERSET_URL_DEV=https://analytics.ozone-dev.mekomsolutions.net
SUPERSET_URL_QA=https://analytics.ozone-qa.mekomsolutions.net
SUPERSET_URL_DEMO=https://analytics.demo.ozone-his.com

# Keycloak
KEYCLOAK_URL_DEV=https://auth.ozone-dev.mekomsolutions.net
KEYCLOAK_URL_QA=https://auth.ozone-qa.mekomsolutions.net
ANALYTICS_URL_DEMO=https://analytics.demo.ozone-his.com
ANALYTICS_URL_DEV=https://analytics.ozone-dev.mekomsolutions.net
ANALYTICS_URL_QA=https://analytics.ozone-qa.mekomsolutions.net
O3_USERNAME=jdoe
O3_PASSWORD=password
KEYCLOAK_URL_DEMO=https://auth.demo.ozone-his.com

#
# Ozone HIS credentials for FOSS and Pro
#

# OpenMRS test user credentials for FOSS
O3_USERNAME_ON_FOSS=admin
O3_PASSWORD_ON_FOSS=Admin123

# Odoo test user credentials for FOSS
ODOO_USERNAME_ON_FOSS=admin
ODOO_PASSWORD_ON_FOSS=admin

# SENAITE test user credentials for FOSS
SENAITE_USERNAME_ON_FOSS=admin
SENAITE_PASSWORD_ON_FOSS=password

# (Pro only) Ozone test user credentials
OZONE_USERNAME=jdoe
OZONE_PASSWORD=password

# (Pro only) Keycloak admin test user credentials
KEYCLOAK_USERNAME=
KEYCLOAK_PASSWORD=
RUNNING_OZONE_ON_PRO=true
TEST_ENVIRONMENT=dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
import { HomePage } from '../utils/functions/testBase';
import { patientName } from '../utils/functions/testBase';
import { O3_URL, ANALYTICS_URL } from '../utils/configs/globalSetup';
import { O3_URL, SUPERSET_URL } from '../utils/configs/globalSetup';

let homePage: HomePage;

Expand Down Expand Up @@ -33,7 +33,7 @@ test('Adding an OpenMRS patient syncs patient into patients table in Superset',
const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(patientsCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -80,7 +80,7 @@ test('Starting an OpenMRS visit syncs visit into visits table in Superset', asyn
const patient_uuid = await homePage.getPatientUUID();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(visitsCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -133,7 +133,7 @@ test('Creating an OpenMRS order syncs order into orders table in Superset', asyn
await homePage.saveLabOrder();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(ordersCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -191,7 +191,7 @@ test('Adding an OpenMRS encounter syncs encounter into encounters table in Super
await homePage.saveLabOrder();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(encountersCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -259,7 +259,7 @@ test('Adding an OpenMRS condition syncs condition into conditions table in Super
await homePage.addPatientCondition();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(conditionsCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -313,7 +313,7 @@ test('Adding an OpenMRS observation syncs observation into observations table in
await homePage.addPatientBiometrics();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(observationsCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -372,7 +372,7 @@ test('Adding an OpenMRS appointment syncs appointment into appointments table in
await homePage.addPatientAppointment();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(appointmentsCountQuery);
await homePage.runSQLQuery();
Expand Down Expand Up @@ -429,7 +429,7 @@ test('Voiding an OpenMRS observation updates observations dataset in Superset',
await homePage.voidEncounter();

// verify
await page.goto(`${ANALYTICS_URL}/superset/sqllab`);
await page.goto(`${SUPERSET_URL}/superset/sqllab`);
await homePage.clearSQLEditor();
await page.getByRole('textbox').first().fill(obsVoidedQuery);
await homePage.runSQLQuery();
Expand Down
8 changes: 4 additions & 4 deletions e2e/utils/configs/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export const O3_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.e
export const ODOO_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.env.ODOO_URL_DEMO}` : `${process.env.TEST_ENVIRONMENT}` == 'qa' ? `${process.env.ODOO_URL_QA}`: `${process.env.ODOO_URL_DEV}`;
export const SENAITE_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.env.SENAITE_URL_DEMO}` : `${process.env.TEST_ENVIRONMENT}` == 'qa' ? `${process.env.SENAITE_URL_QA}`: `${process.env.SENAITE_URL_DEV}`;
export const KEYCLOAK_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.env.KEYCLOAK_URL_DEMO}` : `${process.env.TEST_ENVIRONMENT}` == 'qa' ? `${process.env.KEYCLOAK_URL_QA}`: `${process.env.KEYCLOAK_URL_DEV}`;
export const ANALYTICS_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.env.ANALYTICS_URL_DEMO}` : `${process.env.TEST_ENVIRONMENT}` == 'qa' ? `${process.env.ANALYTICS_URL_QA}`: `${process.env.ANALYTICS_URL_DEV}`;
export const SUPERSET_URL = `${process.env.TEST_ENVIRONMENT}` == 'demo' ? `${process.env.SUPERSET_URL_DEMO}` : `${process.env.TEST_ENVIRONMENT}` == 'qa' ? `${process.env.SUPERSET_URL_QA}`: `${process.env.SUPERSET_URL_DEV}`;

async function globalSetup() {
const requestContext = await request.newContext();
const token = Buffer.from(`${process.env.O3_USERNAME}:${process.env.O3_PASSWORD}`).toString(
const token = Buffer.from(`${process.env.OZONE_USERNAME}:${process.env.OZONE_PASSWORD}`).toString(
'base64',
);
await requestContext.post(`${O3_URL}/ws/rest/v1/session`, {
Expand All @@ -40,8 +40,8 @@ export const api: WorkerFixture<APIRequestContext, PlaywrightWorkerArgs> = async
const ctx = await playwright.request.newContext({
baseURL: `${O3_URL}/ws/rest/v1/`,
httpCredentials: {
username: process.env.O3_USERNAME ?? "",
password: process.env.O3_PASSWORD ?? "",
username: process.env.OZONE_USERNAME ?? "",
password: process.env.OZONE_PASSWORD ?? "",
},
});

Expand Down
20 changes: 10 additions & 10 deletions e2e/utils/functions/testBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ODOO_URL,
SENAITE_URL,
KEYCLOAK_URL,
ANALYTICS_URL
SUPERSET_URL
}
from '../configs/globalSetup';

Expand Down Expand Up @@ -45,10 +45,10 @@ export class HomePage {

async initiateLogin() {
await this.page.goto(`${O3_URL}`);
if (`${process.env.RUNNING_OZONE_ON_PRO}` == 'true') {
await this.page.locator('#username').fill(`${process.env.O3_USERNAME}`);
if (`${process.env.TEST_PRO}` == 'true') {
await this.page.locator('#username').fill(`${process.env.OZONE_USERNAME}`);
await this.page.getByRole('button', { name: 'Continue' }).click();
await this.page.locator('#password').fill(`${process.env.O3_PASSWORD}`);
await this.page.locator('#password').fill(`${process.env.OZONE_PASSWORD}`);
await this.page.getByRole('button', { name: 'Sign In' }).click();
} else {
await this.page.locator('#username').fill(`${process.env.O3_USERNAME_ON_FOSS}`);
Expand All @@ -65,7 +65,7 @@ export class HomePage {
}

async goToSuperset() {
await this.page.goto(`${ANALYTICS_URL}`);
await this.page.goto(`${SUPERSET_URL}`);
}

async goToKeycloak() {
Expand All @@ -78,7 +78,7 @@ export class HomePage {

async goToOdoo() {
await this.page.goto(`${ODOO_URL}`);
if (`${process.env.RUNNING_OZONE_ON_PRO}` == 'true') {
if (`${process.env.TEST_PRO}` == 'true') {
await this.page.getByRole('link', { name: 'Login with Single Sign-On' }).click();
} else {
await delay(3000);
Expand All @@ -92,7 +92,7 @@ export class HomePage {

async goToSENAITE() {
await this.page.goto(`${SENAITE_URL}`);
if (!(`${process.env.RUNNING_OZONE_ON_PRO}` == 'true')) {
if (!(`${process.env.TEST_PRO}` == 'true')) {
await delay(3000);
await this.page.locator('#__ac_name').fill(`${process.env.SENAITE_USERNAME_ON_FOSS}`);
await delay(1000);
Expand Down Expand Up @@ -495,7 +495,7 @@ export class HomePage {
}

async updateSupersetRole() {
await this.page.goto(`${ANALYTICS_URL}/roles/list/`);
await this.page.goto(`${SUPERSET_URL}/roles/list/`);
await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('link').nth(1).click();
await delay(2000);
await this.page.getByPlaceholder('Name').clear();
Expand All @@ -508,7 +508,7 @@ export class HomePage {
}

async deleteSupersetRole(){
await this.page.goto(`${ANALYTICS_URL}/roles/list`);
await this.page.goto(`${SUPERSET_URL}/roles/list`);
await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('checkbox').check();
await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('link').nth(2).click();
await delay(2000);
Expand All @@ -519,7 +519,7 @@ export class HomePage {
}

async deleteUpdatedSupersetRole(){
await this.page.goto(`${ANALYTICS_URL}/roles/list`);
await this.page.goto(`${SUPERSET_URL}/roles/list`);
await this.page.getByRole('row', { name: `${randomSupersetRoleName.updatedRoleName}` }).getByRole('checkbox').check();
await this.page.getByRole('row', { name: `${randomSupersetRoleName.updatedRoleName}` }).getByRole('link').nth(2).click();
await delay(2000);
Expand Down

0 comments on commit 5a5052c

Please sign in to comment.