Update e2e_tests.yml #18
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: Run E2E tests | |
on: | |
push: | |
branches: | |
# - main | |
- 'CHORE/**' # only for now... | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'The Github branch to run tests against' | |
required: true | |
jobs: | |
cas1_e2e_tests: | |
runs-on: [self-hosted, hmpps-github-actions-runner] | |
strategy: | |
matrix: | |
shard: [0, 1, 2, 3] | |
fail-fast: false | |
defaults: | |
run: | |
working-directory: hmpps-approved-premises-ui | |
steps: | |
- uses: qoomon/actions--context@v2 | |
id: context | |
with: | |
workflow-context: cas1_e2e_tests, ${{ toJSON(matrix) }}, ${{ github.event.inputs.workflow-context }} | |
- name: Remove existing directory if it already exists | |
run: rm -rf $GITHUB_WORKSPACE/hmpps-approved-premises-ui | |
working-directory: $GITHUB_WORKSPACE | |
- name: Clone E2E repo | |
run: git clone https://github.com/ministryofjustice/hmpps-approved-premises-ui.git | |
working-directory: $GITHUB_WORKSPACE | |
# - name: Checkout branch | |
# run: git checkout ${{ github.event.inputs.branch }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Update npm | |
run: npm install -g npm@9.8.1 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright | |
run: npx playwright install --with-deps | |
- name: E2E Check | |
run: | | |
SHARD=$(( ${{ matrix.shard }} + 1 )) | |
username="HMPPS_AUTH_USERNAME_$SHARD" | |
password="HMPPS_AUTH_PASSWORD_$SHARD" | |
email="HMPPS_AUTH_EMAIL_$SHARD" | |
name="HMPPS_AUTH_NAME_$SHARD" | |
HMPPS_AUTH_USERNAME="${!username}" | |
HMPPS_AUTH_PASSWORD="${!password}" | |
HMPPS_AUTH_EMAIL="${!email}" | |
HMPPS_AUTH_NAME="${!name}" | |
npm run test:e2e:ci -- --shard=${{ matrix.shard }}/4 | |
- name: Store Playwright report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report-shard-${{ matrix.shard }} | |
path: playwright-report | |
retention-days: 30 | |
- name: Store test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-shard-${{ matrix.shard }} | |
path: test-results | |
retention-days: 30 | |