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: run_e2e_fe | |
on: | |
workflow_call: | |
inputs: | |
name: | |
description: Test suite name | |
type: string | |
required: false | |
default: "FE E2E" | |
tags: | |
description: Cucumber test tags | |
type: string | |
required: true | |
default: "" | |
be_url: | |
description: The backend URL for testing | |
type: string | |
required: true | |
default: "" | |
fe_url: | |
description: The frontend URL for testing | |
type: string | |
required: true | |
default: "" | |
project: | |
description: Lagoon project name | |
type: string | |
required: true | |
default: "" | |
browser: | |
description: Browser, default to headless Chrome. | |
type: string | |
default: "chrome" | |
retry: | |
description: Cucumber-js retry option | |
type: number | |
default: 2 | |
parallel: | |
description: Cucumber-js parallel option | |
type: number | |
default: 4 | |
eyes_appname: | |
description: The appname used to compare against in Appltiools | |
type: string | |
default: "sdp-core-v1" | |
app: | |
type: string | |
default: 'frontend' | |
failfast: | |
type: string | |
default: '' | |
test_id: | |
type: string | |
required: true | |
test_type: | |
type: string | |
required: false | |
default: ':e2e:' | |
test_subtype: | |
type: string | |
required: false | |
default: '' | |
runner: | |
type: string | |
required: false | |
default: biggy | |
tag: | |
description: SDP testing Docker image tag | |
type: string | |
required: false | |
default: migration | |
slack_channel: | |
type: string | |
required: false | |
default: "sdp-test-report-dev" | |
slack_notify: | |
description: When to send the Slack notifications | |
type: string | |
required: false | |
default: "release_only" | |
env: | |
# Test users | |
BE_ADMIN_USER: ${{ secrets.TEST_BE_ADMIN_USER }} | |
BE_ADMIN_PASS: ${{ secrets.TEST_BE_ADMIN_PASS }} | |
BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }} | |
BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }} | |
BE_EDITOR_USER: ${{ secrets.TEST_BE_EDITOR_USER }} | |
BE_EDITOR_PASS: ${{ secrets.TEST_BE_EDITOR_PASS }} | |
# Keys | |
BROWSERSTACK_USER: ${{ secrets.TEST_BROWSERSTACK_USER }} | |
BROWSERSTACK_KEY: ${{ secrets.TEST_BROWSERSTACK_KEY }} | |
APPLITOOLS_API_KEY: ${{ secrets.TEST_APPLITOOLS_API_KEY }} | |
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.TEST_CUCUMBER_PUBLISH_TOKEN }} | |
# Settings | |
TESTID: ${{ inputs.test_id }} | |
NIGHTWATCH_OUTPUT: true | |
CIRCLE_BRANCH: ${{ github.event.pull_request && github.head_ref || github.ref_name }} | |
EYES_APPNAME: ${{ inputs.eyes_appname }} | |
jobs: | |
run_e2e_fe: | |
name: run_e2e_fe | |
runs-on: ${{ inputs.runner }} | |
container: | |
image: docker://sdptestautomation/e2e:${{ inputs.tag }} | |
credentials: | |
username: ${{ secrets.E2E_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.E2E_DOCKERHUB_PASSWORD }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get repo name | |
id: repo_name | |
run: echo "::set-output name=REPO_NAME::$(echo ${GITHUB_REPOSITORY#*/})" | |
- | |
name: Check browsers | |
run: | | |
node --version | |
google-chrome --version | |
printenv | |
- | |
name: Set up Environment variables | |
run: | | |
echo 'BE_BASE_URL=${{ inputs.be_url }}' >> $GITHUB_ENV | |
echo 'FE_BASE_URL=${{ inputs.fe_url }}' >> $GITHUB_ENV | |
echo 'PROJECT=${{ inputs.project }}' >> $GITHUB_ENV | |
echo 'EYES_APPNAME=${{ inputs.eyes_appname }}' >> $GITHUB_ENV | |
- | |
name: Check test environment urls | |
run: | | |
echo $BE_BASE_URL | |
echo $FE_BASE_URL | |
echo $PROJECT | |
echo $CIRCLE_BRANCH | |
- | |
name: "Wait up servers in case they are idle" | |
run: | | |
curl ${BE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null; | |
curl ${FE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null; | |
- | |
name: run e2e test | |
run: | | |
cd /app | |
Xvfb :99 -screen 0 1920x1080x24 & | |
NIGHTWATCH_BROWSER="${{ inputs.browser }}" npm run cucumber:${{ inputs.app }} -- --tags "${{ inputs.tags }}" --retry "${{ inputs.retry }}" --parallel "${{ inputs.parallel }}" | |
- | |
name: Report test results | |
if: always() | |
uses: dpc-sdp/sdp-testing/actions/test-report | |
with: | |
report_name: 'test-reports-${{ inputs.name }}' | |
- | |
name: Store Cucumber Cloud test report URL | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: ${{ inputs.name }}-report-url | |
path: /app/reports/report-url.txt | |
notify_slack: | |
uses: ./.github/workflows/notify_slack.yml | |
if: | | |
always() && | |
( inputs.slack_notify == 'always' || | |
( inputs.slack_notify == 'release_only' && | |
( startsWith(github.ref_name, 'release/') || | |
contains(fromJSON('["uat", "master", "standby", "production"]'), github.ref_name) | |
) | |
) | |
) | |
needs: [run_e2e_fe] | |
secrets: inherit | |
with: | |
workflow_name: ${{ inputs.name }} | |
test_type: ${{ inputs.test_type }} | |
test_subtype: ${{ inputs.test_subtype }} | |
artifact_name: "${{ inputs.name }}-report-url" | |
fe_url: ${{ inputs.fe_url }} | |
be_url: ${{ inputs.be_url }} | |
project: ${{ inputs.project }} | |
slack_channel: ${{ inputs.slack_channel }} |