|
| 1 | +name: Run E2E Tests on Release PRs |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + patient_management_ref: ${{steps.refs.outputs.patient_management}} |
| 14 | + patient_chart_ref: ${{steps.refs.outputs.patient_chart}} |
| 15 | + esm_core_ref: ${{steps.refs.outputs.esm_core}} |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Build and Run Containers |
| 23 | + run: docker-compose -f distro/e2e_test_support_files/docker-compose-build.yml up -d |
| 24 | + |
| 25 | + - name: Wait for the backend to start |
| 26 | + run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost/openmrs/login.htm)" != "200" ]]; do sleep 10; done |
| 27 | + |
| 28 | + - name: Commit and export Containers |
| 29 | + run: sh distro/e2e_test_support_files/commit_and_export_images.sh |
| 30 | + |
| 31 | + - name: Upload artifact |
| 32 | + uses: actions/upload-artifact@v3 |
| 33 | + with: |
| 34 | + name: e2e_release_env_images |
| 35 | + path: e2e_release_env_images.tar.gz |
| 36 | + retention-days: 1 |
| 37 | + |
| 38 | + run-patient-management-e2e-tests: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: build |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Create Temporary Directory to Download Docker Images |
| 45 | + id: tempdir |
| 46 | + run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT" |
| 47 | + |
| 48 | + - name: Download Docker Images |
| 49 | + uses: actions/download-artifact@v3 |
| 50 | + with: |
| 51 | + name: e2e_release_env_images |
| 52 | + path: ${{ steps.tempdir.outputs.tmpdir }} |
| 53 | + |
| 54 | + - name: Load Docker Images |
| 55 | + run: | |
| 56 | + gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz |
| 57 | + docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar |
| 58 | + docker image ls -a |
| 59 | +
|
| 60 | + - name: Spin up an OpenMRS Instance |
| 61 | + run: docker-compose up -d |
| 62 | + working-directory: distro/e2e_test_support_files |
| 63 | + |
| 64 | + - name: Checkout to the Repo's Tag |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + repository: openmrs/openmrs-esm-patient-management |
| 68 | + ref: ${{ needs.build.outputs.patient_management_ref }} |
| 69 | + path: e2e_repo |
| 70 | + |
| 71 | + - name: Copy test environment variables |
| 72 | + run: cp example.env .env |
| 73 | + working-directory: e2e_repo |
| 74 | + |
| 75 | + - name: Install dependencies |
| 76 | + if: steps.cache.outputs.cache-hit != 'true' |
| 77 | + run: yarn install --immutable |
| 78 | + working-directory: e2e_repo |
| 79 | + |
| 80 | + - name: Install Playwright Browsers |
| 81 | + run: npx playwright install chromium --with-deps |
| 82 | + working-directory: e2e_repo |
| 83 | + |
| 84 | + - name: Wait for the OpenMRS instance to start |
| 85 | + run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done |
| 86 | + |
| 87 | + - name: Run E2E tests |
| 88 | + run: yarn playwright test |
| 89 | + working-directory: e2e_repo |
| 90 | + |
| 91 | + - name: Upload Report |
| 92 | + uses: actions/upload-artifact@v3 |
| 93 | + if: always() |
| 94 | + with: |
| 95 | + name: report-patient-management |
| 96 | + path: e2e_repo/playwright-report/ |
| 97 | + retention-days: 30 |
| 98 | + |
| 99 | + run-patient-chart-e2e-tests: |
| 100 | + runs-on: ubuntu-latest |
| 101 | + needs: build |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Create Temporary Directory to Download Docker Images |
| 106 | + id: tempdir |
| 107 | + run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT" |
| 108 | + |
| 109 | + - name: Download Docker Images |
| 110 | + uses: actions/download-artifact@v3 |
| 111 | + with: |
| 112 | + name: e2e_release_env_images |
| 113 | + path: ${{ steps.tempdir.outputs.tmpdir }} |
| 114 | + |
| 115 | + - name: Load Docker Images |
| 116 | + run: | |
| 117 | + gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz |
| 118 | + docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar |
| 119 | + docker image ls -a |
| 120 | +
|
| 121 | + - name: Spin up an OpenMRS Instance |
| 122 | + run: docker-compose up -d |
| 123 | + working-directory: distro/e2e_test_support_files |
| 124 | + |
| 125 | + - name: Checkout to the Repo's Tag |
| 126 | + uses: actions/checkout@v4 |
| 127 | + with: |
| 128 | + repository: openmrs/openmrs-esm-patient-chart |
| 129 | + ref: ${{ needs.build.outputs.patient_chart_ref }} |
| 130 | + path: e2e_repo |
| 131 | + |
| 132 | + - name: Copy test environment variables |
| 133 | + run: cp example.env .env |
| 134 | + working-directory: e2e_repo |
| 135 | + |
| 136 | + - name: Install dependencies |
| 137 | + if: steps.cache.outputs.cache-hit != 'true' |
| 138 | + run: yarn install --immutable |
| 139 | + working-directory: e2e_repo |
| 140 | + |
| 141 | + - name: Install Playwright Browsers |
| 142 | + run: npx playwright install chromium --with-deps |
| 143 | + working-directory: e2e_repo |
| 144 | + |
| 145 | + - name: Wait for the OpenMRS instance to start |
| 146 | + run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done |
| 147 | + |
| 148 | + - name: Run E2E tests |
| 149 | + run: yarn playwright test |
| 150 | + working-directory: e2e_repo |
| 151 | + |
| 152 | + - name: Upload Report |
| 153 | + uses: actions/upload-artifact@v3 |
| 154 | + if: always() |
| 155 | + with: |
| 156 | + name: report-patient-chart |
| 157 | + path: e2e_repo/playwright-report/ |
| 158 | + retention-days: 30 |
0 commit comments