OZ-715: Adapted E2E test suite to run test profiles + renamed goToDru… #107
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ozone E2E Tests | |
on: | |
schedule: | |
- cron: '0 0 * * 1,3,5' | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
o3_url: | |
description: 'O3 URL' | |
required: false | |
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 on Pro?' | |
required: true | |
default: 'true' | |
type: choice | |
options: | |
- true | |
- false | |
environment: | |
description: 'Choose test environment' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- qa | |
- demo | |
test_profile: | |
description: 'Choose test profile' | |
required: true | |
default: 'ozone-pro' | |
type: choice | |
options: | |
- ozone-pro | |
- ozone-foss | |
- openmrs-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 | |
- name: Select environment variables | |
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 }}' | |
KEYCLOAK_USERNAME: '${{ secrets.KEYCLOAK_USERNAME }}' | |
KEYCLOAK_PASSWORD: '${{ secrets.KEYCLOAK_PASSWORD }}' | |
- name: Run E2E tests | |
id: jobStatusPretty | |
run: | | |
case $TEST_PROFILE in | |
"ozone-pro") | |
npm run e2e-tests-pro | |
;; | |
"ozone-foss") | |
npm run e2e-tests-foss | |
;; | |
"openmrs-his") | |
npm run e2e-tests-openmrs-his | |
;; | |
*) | |
exit 1 | |
;; | |
esac | |
if: ${{ github.event_name != 'pull_request' }} | |
if [[ ${{ job.status }} == "success" ]]; then | |
jobStatusPretty="✅ Passing" | |
else | |
jobStatusPretty="❌ Failing" | |
fi | |
echo "jobStatusPretty=$jobStatusPretty" >> "$GITHUB_ENV" | |
- name: Notify Slack | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "rich_text", | |
"elements": [ | |
{ | |
"type": "rich_text_section", | |
"elements": [ | |
{ | |
"type": "text", | |
"text": "GitHub Actions report from " | |
}, | |
{ | |
"type": "link", | |
"url": "https://github.com/ozone-his/ozone-e2e", | |
"text": "${{ github.repository }}", | |
"style": { | |
"bold": false | |
} | |
}, | |
{ | |
"type": "text", | |
"text": ":\n" | |
} | |
] | |
}, | |
{ | |
"type": "rich_text_quote", | |
"elements": [ | |
{ | |
"type": "link", | |
"url": "https://ozone-dev.mekomsolutions.net", | |
"text": "Ozone Dev" | |
}, | |
{ | |
"type": "text", | |
"text": " server QA status: ${{ env.jobStatusPretty }}" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Upload report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |