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-437: Added ability to run Ozone PRO tests on a preferred environment via GitHub Actions #63

Merged
merged 5 commits into from
Dec 8, 2023
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
21 changes: 16 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Global configuration for Ozone HIS
E2E_BASE_URL=https://ozone-dev.mekomsolutions.net
E2E_ODOO_URL=https://erp.ozone-dev.mekomsolutions.net
E2E_SENAITE_URL=https://lims.ozone-dev.mekomsolutions.net
E2E_KEYCLOAK_URL=https://auth.ozone-dev.mekomsolutions.net
E2E_ANALYTICS_URL=https://analytics.ozone-dev.mekomsolutions.net
E2E_BASE_URL_DEMO=https://demo.ozone-his.com
E2E_BASE_URL_DEV=https://ozone-dev.mekomsolutions.net
E2E_BASE_URL_QA=https://ozone-qa.mekomsolutions.net
E2E_ODOO_URL_DEMO=https://erp.demo.ozone-his.com
E2E_ODOO_URL_DEV=https://erp.ozone-dev.mekomsolutions.net
E2E_ODOO_URL_QA=https://erp.ozone-qa.mekomsolutions.net
E2E_SENAITE_URL_DEMO=https://lims.demo.ozone-his.com
E2E_SENAITE_URL_DEV=https://lims.ozone-dev.mekomsolutions.net
E2E_SENAITE_URL_QA=https://lims.ozone-qa.mekomsolutions.net
E2E_KEYCLOAK_URL_DEMO=https://auth.demo.ozone-his.com
E2E_KEYCLOAK_URL_DEV=https://auth.ozone-dev.mekomsolutions.net
E2E_KEYCLOAK_URL_QA=https://auth.ozone-qa.mekomsolutions.net
E2E_ANALYTICS_URL_DEMO=https://analytics.demo.ozone-his.com
E2E_ANALYTICS_URL_DEV=https://analytics.ozone-dev.mekomsolutions.net
E2E_ANALYTICS_URL_QA=https://analytics.ozone-qa.mekomsolutions.net
E2E_USER_ADMIN_USERNAME=jdoe
E2E_USER_ADMIN_PASSWORD=password
FOSS_E2E_USER_ADMIN_USERNAME=admin
FOSS_E2E_USER_ADMIN_PASSWORD=Admin123
E2E_RUNNING_ON_OZONE_PRO=true
E2E_TEST_ENVIRONMENT=dev
10 changes: 5 additions & 5 deletions .github/workflows/foss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
description: 'O3 URL'
required: true
e2e_odoo_url_input:
description: 'ODOO URL'
description: 'Odoo URL'
required: true
e2e_senaite_url_input:
description: 'SENAITE URL'
Expand Down Expand Up @@ -38,13 +38,13 @@ jobs:
run: yarn install

- name: Install Playwright browsers
run: npx playwright install webkit --with-deps
run: npx playwright install chromium --with-deps

- name: Run E2E tests
env:
E2E_BASE_URL: '${{ github.event.inputs.e2e_base_url_input }}'
E2E_ODOO_URL: '${{ github.event.inputs.e2e_odoo_url_input }}'
E2E_SENAITE_URL: '${{ github.event.inputs.e2e_senaite_url_input }}'
E2E_BASE_URL_DEV: '${{ github.event.inputs.e2e_base_url_input }}'
E2E_ODOO_URL_DEV: '${{ github.event.inputs.e2e_odoo_url_input }}'
E2E_SENAITE_URL_DEV: '${{ github.event.inputs.e2e_senaite_url_input }}'
E2E_RUNNING_ON_OZONE_PRO: 'false'
run: npm run fossE2ETests

Expand Down
47 changes: 5 additions & 42 deletions .github/workflows/pro.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ozone PRO E2E Tests
name: Ozone E2E Tests

on:
schedule:
Expand All @@ -10,8 +10,7 @@ on:

workflow_dispatch:
jobs:
testOnPR:
if: ${{ github.event_name == 'pull_request' }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -35,51 +34,14 @@ jobs:
run: yarn install

- name: Install Playwright browsers
run: npx playwright install webkit --with-deps

- name: Run E2E tests
run: npm run proE2ETests

- name: Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

testOnPush:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

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

- name: Install dependencies
run: yarn install

- name: Install Playwright browsers
run: npx playwright install webkit --with-deps
run: npx playwright install chromium --with-deps

- name: Run E2E tests
id: jobStatusPretty
run: |
npm run proE2ETests

if: ${{ github.event_name != 'pull_request' }}
if [[ ${{ job.status }} == "success" ]]; then
jobStatusPretty="✅ Passing"
else
Expand All @@ -88,6 +50,7 @@ jobs:
echo "jobStatusPretty=$jobStatusPretty" >> "$GITHUB_ENV"

- name: Notify Slack
if: ${{ github.event_name != 'pull_request' }}
id: slack
uses: slackapi/[email protected]
with:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/runOzoneTestsOnSpecifiedEnv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Ozone E2E Tests On Specified Environment

on:

workflow_dispatch:
inputs:
environment:
description: 'Choose test environment'
required: true
default: 'dev'
type: choice
options:
- dev
- qa
- demo
Ruhanga marked this conversation as resolved.
Show resolved Hide resolved
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache dependencies
id: cache
uses: actions/cache@v3
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 --with-deps

- name: Run E2E tests
env:
E2E_TEST_ENVIRONMENT: '${{ github.event.inputs.environment }}'
run: npm run proE2ETests

- name: Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ozone E2E Test Suite

[![Ozone PRO E2E Tests](https://github.com/ozone-his/ozone-e2e-pro/actions/workflows/pro.yml/badge.svg)](https://github.com/ozone-his/ozone-e2e-pro/actions/workflows/pro.yml)
[![Ozone E2E Tests](https://github.com/ozone-his/ozone-e2e-pro/actions/workflows/pro.yml/badge.svg)](https://github.com/ozone-his/ozone-e2e-pro/actions/workflows/pro.yml)

Welcome to Ozone automated test suite.

Expand Down Expand Up @@ -75,3 +75,7 @@ The pro.yml workflow is split into two jobs, one that runs upon _Git pull reques
The foss.yml workflow contains one job that runs Ozone FOSS specific tests. Note: You need to provide O3, Odoo and SENAITE base URLs at runtime.

<img src="readme/user_inputs.png" alt="User Inputs" width="1000"/>

The runOzoneTestsOnSpecifiedEnv.yml workflow contains one job that runs Ozone tests. Note: You need to choose test environment at runtime.

<img src="readme/choose_test_environment.png" alt="Choose Test Environment" width="1000"/>
Loading