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-715: Introducing test profiles + renamed "goTo" to "navigateTo" routines. #112

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
84 changes: 84 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: E2E Test Profile

on:
workflow_dispatch:

inputs:
o3_url:
description: 'O3 URL'
required: true
odoo_url:
description: 'Odoo URL'
required: false
senaite_url:
description: 'SENAITE URL'
required: false
superset_url:
description: 'Superset URL'
required: false
test_pro:
description: 'Running Ozone Pro?'
required: true
default: 'true'
type: choice
options:
- true
- false
test_profile:
description: 'Choose test profile'
VaishSiddharth marked this conversation as resolved.
Show resolved Hide resolved
required: true
default: 'ozone-pro'
type: choice
options:
- ozone-pro
- ozone-foss
- openmrs-distro-his
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn install

- name: Install Playwright browsers
run: npx playwright install chromium
VaishSiddharth marked this conversation as resolved.
Show resolved Hide resolved

- name: Run E2E tests
id: jobStatusPretty
env:
O3_URL_DEV: '${{ github.event.inputs.o3_url }}'
ODOO_URL_DEV: '${{ github.event.inputs.odoo_url }}'
SENAITE_URL_DEV: '${{ github.event.inputs.senaite_url }}'
SUPERSET_URL_DEV: '${{ github.event.inputs.superset_url }}'
TEST_PRO: '${{ github.event.inputs.test_pro }}'
TEST_ENVIRONMENT: '${{ github.event.inputs.environment }}'
TEST_PROFILE: '${{ github.event.inputs.test_profile }}'

run: |
npm run $TEST_PROFILE

- name: Upload report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7
57 changes: 0 additions & 57 deletions .github/workflows/foss.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
KEYCLOAK_USERNAME: '${{ secrets.KEYCLOAK_USERNAME }}'
KEYCLOAK_PASSWORD: '${{ secrets.KEYCLOAK_PASSWORD }}'
run: |
npm run e2e-tests-pro
npm run ozone-pro

if: ${{ github.event_name != 'pull_request' }}
if [[ ${{ job.status }} == "success" ]]; then
Expand Down Expand Up @@ -123,4 +123,4 @@ jobs:
with:
name: playwright-report
path: playwright-report/
retention-days: 30
retention-days: 7
40 changes: 20 additions & 20 deletions e2e/tests/erpnext-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test.beforeEach(async ({ page }) => {

test('Ordering a lab test for an OpenMRS patient creates the corresponding ERPNext customer.', async ({ page }) => {
// replay
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();

// verify
Expand All @@ -31,8 +31,8 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding ERPNe

test('Ordering a drug for an OpenMRS patient creates the corresponding ERPNext customer with a filled quotation.', async ({ page }) => {
// replay
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();

Expand All @@ -50,8 +50,8 @@ test('Ordering a drug for an OpenMRS patient creates the corresponding ERPNext c

test('Editing the details of an OpenMRS patient with a synced lab order edits the corresponding ERPNext customer details.', async ({ page }) => {
// setup
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();
await erpnext.open();
await erpnext.searchCustomer();
Expand All @@ -72,8 +72,8 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th

test('Editing the details of an OpenMRS patient with a synced drug order edits the corresponding ERPNext customer details.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await erpnext.open();
Expand All @@ -95,8 +95,8 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t

test('Ending an OpenMRS patient visit with a synced drug order updates the corresponding ERPNext draft quotation to an open state.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await erpnext.open();
Expand All @@ -117,10 +117,10 @@ test('Ending an OpenMRS patient visit with a synced drug order updates the corre
await erpnext.deleteQuotation();
});

test('Revising a synced OpenMRS drug order edits the corresponding ERPNext quotation item.', async ({ page }) => {
test('Revising details of a synced OpenMRS drug order modifies the corresponding ERPNext quotation item.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await erpnext.open();
Expand All @@ -131,7 +131,7 @@ test('Revising a synced OpenMRS drug order edits the corresponding ERPNext quota
// replay
await page.goto(`${O3_URL}`);
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.editDrugOrder();
await openmrs.modifyDrugOrderDescription();

// verify
await page.goto(`${ERPNEXT_URL}/app/home`);
Expand Down Expand Up @@ -162,8 +162,8 @@ test('Ordering a drug with a free text medication dosage for an OpenMRS patient

test('Discontinuing a synced OpenMRS drug order for an ERPNext customer with a single quotation line removes the corresponding quotation.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await erpnext.open();
Expand All @@ -185,8 +185,8 @@ test('Discontinuing a synced OpenMRS drug order for an ERPNext customer with a s

test('Ordering a drug for an OpenMRS patient within a visit creates the corresponding ERPNext customer with a filled quotation linked to the visit.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await erpnext.open();
Expand All @@ -198,8 +198,8 @@ test('Ordering a drug for an OpenMRS patient within a visit creates the correspo
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.endPatientVisit();
await openmrs.startPatientVisit();
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 81mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 81mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();

Expand Down
44 changes: 24 additions & 20 deletions e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test.beforeEach(async ({ page }) => {

test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// replay
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();

// verify
Expand All @@ -27,12 +27,13 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo
await odoo.searchCustomer();
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`);
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation');
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(7) span')).toHaveText('$ 27.50');
});

test('Editing the details of an OpenMRS patient with a synced lab order edits the corresponding Odoo customer details.', async ({ page }) => {
// setup
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();
await odoo.open();
await odoo.navigateToSales();
Expand All @@ -55,8 +56,8 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th

test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// replay
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();

Expand All @@ -66,12 +67,13 @@ test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo cust
await odoo.searchCustomer();
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`);
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation');
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(7) span')).toHaveText('$ 14.88');
});

test('Editing the details of an OpenMRS patient with a synced drug order edits the corresponding Odoo customer details.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await odoo.open();
Expand All @@ -93,10 +95,10 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation');
});

test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotation line.', async ({ page }) => {
test('Revising details of a synced OpenMRS drug order modifies the corresponding Odoo quotation line.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await odoo.open();
Expand All @@ -107,11 +109,12 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio
const drugOrderItem = await page.locator('table tbody td.o_data_cell:nth-child(3) span');
await expect(drugOrderItem).toContainText('4.0 Tablet');
await expect(drugOrderItem).toContainText('Twice daily - 5 day');
await expect(page.locator('td.o_data_cell:nth-child(9) span')).toHaveText('$ 14.88');

// replay
await page.goto(`${O3_URL}`);
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.editDrugOrder();
await openmrs.modifyDrugOrderDescription();

// verify
await page.goto(`${ODOO_URL}`);
Expand All @@ -120,12 +123,13 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
await expect(drugOrderItem).toContainText('8.0 Tablet');
await expect(drugOrderItem).toContainText('Thrice daily - 6 day');
await expect(page.locator('td.o_data_cell:nth-child(9) span')).toHaveText('$ 9.92');
});

test('Discontinuing a synced OpenMRS drug order for an Odoo customer with a single quotation line removes the corresponding quotation.', async ({ page }) => {
// setup
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await odoo.open();
Expand Down Expand Up @@ -153,12 +157,12 @@ test('Discontinuing a synced OpenMRS drug order for an Odoo customer with a sing

test('Discontinuing a synced OpenMRS drug order for an Odoo customer with multiple quotation lines removes the corresponding quoatation.', async ({ page }) => {
// setup
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.goToDrugOrderForm();
await page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await openmrs.navigateToDrugOrderForm();
await page.getByRole('searchbox').fill('Aspirin 325mg');
await openmrs.fillDrugOrderForm();
await openmrs.saveDrugOrder();
await odoo.open();
Expand Down Expand Up @@ -198,8 +202,8 @@ test('Ordering a drug with a free text medication dosage for an OpenMRS patient

test('Discontinuing a synced OpenMRS lab order for an Odoo customer with a single quotation line cancels the corresponding quotation.', async ({ page }) => {
// setup
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();
await odoo.open();
await odoo.navigateToSales();
Expand Down
Loading