Skip to content

Commit

Permalink
Create e2e test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosie-Brigham committed Jan 31, 2025
1 parent b504e84 commit 1d61fc2
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: run-e2e-tests

on: [workflow_dispatch]

jobs:
cas1_e2e_tests:
runs-on: [self-hosted, hmpps-github-actions-runner]
steps:
- uses: qoomon/actions--context@v1
id: context
- name: Clone E2E repo
run: |
git clone https://github.com/ministryofjustice/hmpps-approved-premises-ui.git .
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Update npm
run: npm install -g [email protected]

- name: Install Playwright
run: npx playwright install
- name: E2E Check
run: |
SHARD="$((${CIRCLE_NODE_INDEX}+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=${SHARD}/${CIRCLE_NODE_TOTAL}
- name: Store Playwright report
uses: actions/upload-artifact@v2
with:
name: playwright-report
path: playwright-report
- name: Store test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results
# - name: Notify Slack on failure - TODO
# if: failure()
# uses: slackapi/[email protected]
# with:
# channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
# slack-message: 'E2E tests failed. Check the logs for more details.'
# bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
cas2_e2e_tests:
runs-on: [self-hosted, hmpps-github-actions-runner]
steps:
- name: Clone E2E repo
run: |
git clone https://github.com/ministryofjustice/hmpps-community-accommodation-tier-2-ui.git .
- uses: qoomon/actions--context@v1
id: context
- name: Update npm
run: npm install -g [email protected]
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- run:
- name: Install Playwright
run: npx playwright install
- name: Run E2E tests
run: npm run test:e2e
- name: Store Playwright report
uses: actions/upload-artifact@v2
with:
name: playwright-report
path: e2e-tests/playwright-report
# - name: Notify Slack on failure - TODO
# if: failure()
# uses: slackapi/[email protected]
# with:
# channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
# slack-message: 'E2E tests failed. Check the logs for more details.'
# bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
# cas3_e2e_tests: - TODO, work out how to grab cypres env vars from circle ci
# runs-on: [self-hosted, hmpps-github-actions-runner]
# steps:
# - uses: qoomon/actions--context@v1
# id: context
# - name: Checkout e2e repo
# run: |
# git clone https://github.com/ministryofjustice/hmpps-temporary-accommodation-ui.git .
# - name: Install xz-utils
# run: apt-get install xz-utils
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18.x
# - name: Update npm
# run: npm install -g [email protected]
# - name: E2E Check - ${{ steps.context.outputs.environment }}
# run: |
# TESTS=$(find "${{ github.workspace }}/e2e/tests" -name "*.feature" | paste -sd ',')
# npm run test:e2e:ci -- \
# --env "assessor_username=${{ env.CYPRESS_ASSESSOR_USERNAME}}_${{ steps.context.outputs.environment }},assessor_password=${{ env.CYPRESS_ASSESSOR_PASSWORD}}_${{ steps.context.outputs.environment }},referrer_username=${{ env.CYPRESS_REFERRER_USERNAME}}_${{ steps.context.outputs.environment }},referrer_password=${{ env.CYPRESS_REFERRER_PASSWORD}}_${{ steps.context.outputs.environment }},acting_user_probation_region_id=${{ env.CYPRESS_ACTING_USER_PROBATION_REGION_ID}}_${{ steps.context.outputs.environment }},acting_user_probation_region_name=${{ env.CYPRESS_ACTING_USER_PROBATION_REGION_NAME}}_${{ steps.context.outputs.environment }},environment=${{ env.CYPRESS_ENVIRONMENT}}_${{ steps.context.outputs.environment }}" \
# --config baseUrl=https://temporary-accommodation-${{ steps.context.outputs.environment }}.hmpps.service.justice.gov.uk \
# --spec $TESTS
# - name: Store screenshots
# uses: actions/upload-artifact@v2
# with:
# name: screenshots
# path: e2e/screenshots
# - name: Store videos
# uses: actions/upload-artifact@v2
# with:
# name: videos
# path: e2e/videos

0 comments on commit 1d61fc2

Please sign in to comment.