Skip to content
Open
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
106 changes: 106 additions & 0 deletions .github/workflows/analytics-e2e-tests-triggered-by-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: 'e2e-prod'

on:
workflow_call:
inputs:
should_record:
required: false
type: boolean
default: false
spec-group:
required: false
type: string
api_base_url:
required: true
type: string
app_url:
required: true
type: string
dhis2_version:
required: true
type: string
secrets:
username:
required: true
password:
required: true
recordkey:
required: true
reportportal_api_key:
required: false
reportportal_endpoint:
required: false
reportportal_project:
required: false

concurrency:
group: e2e-prod-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-prod:
runs-on: ubuntu-latest
env:
CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PR_TITLE: ${{ github.event.pull_request.title }}
DHIS2_VERSION: ${{ inputs.dhis2_version }}
strategy:
fail-fast: false
matrix:
spec-group: ${{ fromJson(inputs.spec-group) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV

- name: Debug spec-group and should_record
run: |
echo "spec-group: ${{ toJson(matrix.spec-group) }}"
echo "should_record: ${{ inputs.should_record }}"

- name: Debug Test Parameters
run: |
echo "Record: ${{ inputs.should_record }}"
echo "Parallel: ${{ inputs.should_record }}"
echo "Specs: ${{ join(matrix.spec-group.tests, ',') }}"
echo "Group: ${{ inputs.should_record && format('e2e-chrome-parallel-{0}', matrix.spec-group.id) || '' }}"
echo "CI Build ID: ${{ inputs.should_record && github.run_id || '' }}"

- name: Run e2e tests
uses: cypress-io/github-action@v6
with:
config: pageLoadTimeout=100000,baseUrl=${{ inputs.app_url }}
wait-on: ${{ inputs.api_base_url }}
wait-on-timeout: 300
record: ${{ inputs.should_record }}
parallel: ${{ inputs.should_record }}
browser: chrome
spec: ${{ join(matrix.spec-group.tests, ',') }}
group: ${{ inputs.should_record && format('e2e-chrome-parallel-{0}', matrix.spec-group.id) || '' }}
ci-build-id: ${{ inputs.should_record && github.run_id || '' }}
env:
CI: true
CYPRESS_RECORD_KEY: ${{ secrets.recordkey }}
CYPRESS_dhis2BaseUrl: ${{ inputs.api_base_url }}
CYPRESS_dhis2InstanceVersion: ${{ inputs.dhis2_version }}
CYPRESS_dhis2Username: ${{ secrets.username }}
CYPRESS_dhis2Password: ${{ secrets.password }}
CYPRESS_networkMode: live
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPORTPORTAL_API_KEY: ${{ secrets.reportportal_api_key }}
REPORTPORTAL_ENDPOINT: ${{ secrets.reportportal_endpoint }}
REPORTPORTAL_PROJECT: ${{ secrets.reportportal_project }}

e2e-tests-success:
needs: e2e-prod
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- run: if [ "${{ needs.e2e-prod.result }}" != 'success' ]; then exit 1; fi;