From 2cb246dfdb784c2ec270026d2d91ddc32faace75 Mon Sep 17 00:00:00 2001 From: Keith Lau <86580032+klaukl@users.noreply.github.com> Date: Mon, 13 Apr 2026 11:17:34 +1000 Subject: [PATCH 01/10] init(gha): playwright gha --- .github/workflows/test_e2e_be.yml | 172 ++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 .github/workflows/test_e2e_be.yml diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml new file mode 100644 index 0000000..8bab96b --- /dev/null +++ b/.github/workflows/test_e2e_be.yml @@ -0,0 +1,172 @@ +name: test_e2e_be + +on: + workflow_call: + inputs: + name: + description: Test suite name + type: string + required: false + default: "BE E2E" + id: + description: Test suite ID + type: string + required: false + default: "" + be_url: + description: The backend 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" + app: + type: string + default: 'backend' + test_type: + type: string + required: false + default: ':e2e:' + test_subtype: + type: string + required: false + default: '' + runner: + type: string + required: false + default: biggy-automated-testing + tag: + description: SDP testing Docker image tag + type: string + required: false + default: migration + slack_channel: + type: string + required: false + default: "sdp-test-report" + slack_notify: + description: When to send the Slack notifications + type: string + required: false + default: "release_only" + test_status: + type: boolean + default: false + +env: + # Test users + TEST_HTTP_AUTH_USER: ${{ secrets.TEST_HTTP_AUTH_USER }} + TEST_HTTP_AUTH_PASS: ${{ secrets.TEST_HTTP_AUTH_PASS }} + TEST_BE_ADMIN_USER: ${{ secrets.TEST_BE_ADMIN_USER }} + TEST_BE_ADMIN_PASS: ${{ secrets.TEST_BE_ADMIN_PASS }} + TEST_BE_SITE_ADMIN_USER: ${{ secrets.TEST_BE_SITE_ADMIN_USER }} + TEST_BE_SITE_ADMIN_PASS: ${{ secrets.TEST_BE_SITE_ADMIN_PASS }} + TEST_BE_EDITOR_USER: ${{ secrets.TEST_BE_EDITOR_USER }} + TEST_BE_EDITOR_PASS: ${{ secrets.TEST_BE_EDITOR_PASS }} + ##TODO: Add to secrets + # TEST_BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }} + # TEST_BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }} + # TEST_BE_DATAIMPORTER_USER: ${{ secrets.TEST_BE_DATAIMPORTER_USER }} + # TEST_BE_DATAIMPORTER_PASS: ${{ secrets.TEST_BE_DATAIMPORTER_PASS }} + TEST_BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }} + TEST_BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }} + TEST_BE_PREVIEWER_USER: ${{ secrets.TEST_BE_PREVIEWER_USER }} + TEST_BE_PREVIEWER_PASS: ${{ secrets.TEST_BE_PREVIEWER_PASS }} + TEST_BE_CONTRIBUTOR_USER: ${{ secrets.TEST_BE_CONTRIBUTOR_USER }} + TEST_BE_CONTRIBUTOR_PASS: ${{ secrets.TEST_BE_CONTRIBUTOR_PASS }} + TEST_APPLITOOLS_API_KEY: ${{ secrets.TEST_APPLITOOLS_API_KEY }} + # Project secrets + PREMIER_MAILGUN_DEV_TOKEN: ${{ secrets.TEST_PREMIER_MAILGUN_DEV_TOKEN }} + # Keys + FTP_JIRA_EMAIL: ${{ secrets.TEST_FTP_JIRA_EMAIL }} + FTP_JIRA_API_TOKEN: ${{ secrets.TEST_FTP_JIRA_API_TOKEN }} + BROWSERSTACK_USER: ${{ secrets.TEST_BROWSERSTACK_USER }} + BROWSERSTACK_KEY: ${{ secrets.TEST_BROWSERSTACK_KEY }} + # Settings + TESTID: ${{ inputs.test_id }} + NIGHTWATCH_HEADLESS: true + NIGHTWATCH_OUTPUT: true + + +jobs: + test_e2e_be: + name: test_e2e_be + runs-on: ${{ inputs.runner }} + defaults: + run: + working-directory: /app + container: + image: ghcr.io/${{ github.repository_owner }}/sdp-testing-playwright:${{ inputs.tag }} + credentials: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + steps: + - + name: Set up Environment variables + run: | + echo 'TEST_BE_BASE_URL=${{ inputs.be_url }}' >> $GITHUB_ENV + echo 'TEST_PROJECT=${{ inputs.project }}' >> $GITHUB_ENV + - + name: Check test environment urls + run: | + echo $TEST_BE_BASE_URL + echo $TEST_PROJECT + - + name: "Wait up servers in case they are idle" + run: | + curl ${TEST_BE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null; + - + name: Run Backend tests + run: | + npm run e2e:backend --max-failures=10 + npm run e2e:backend -- \ + --workers=6 \ + --max-failures=10 + - uses: actions/upload-artifact@v6 + if: ${{ !cancelled() }} + with: + name: playwright-report-backend + path: /app/playwright-report/ + retention-days: 30 + - name: Publish Test Report (summary-report) + uses: ctrf-io/github-test-reporter@v1 + with: + report-path: '/app/ctrf/*.json' + summary-report: true + if: always() + - name: Publish Test Report (file-report) + uses: ctrf-io/github-test-reporter@v1 + with: + report-path: '/app/ctrf/*.json' + file-report: true + if: always() + 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: [test_e2e_be] + secrets: inherit + with: + workflow_name: ${{ inputs.name }} + workflow_id: ${{ inputs.id }} + workflow_reusable_name: "test_e2e_be" + test_type: ${{ inputs.test_type }} + test_subtype: ${{ inputs.test_subtype }} + artifact_name: "test-reports-${{ inputs.name }}" + be_url: ${{ inputs.be_url }} + project: ${{ inputs.project }} + slack_channel: ${{ inputs.slack_channel }} \ No newline at end of file From c55d1eaf56dcb778fcea89f394d226c930de4278 Mon Sep 17 00:00:00 2001 From: Keith Lau <86580032+klaukl@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:48:33 +1000 Subject: [PATCH 02/10] fix --- .github/workflows/test_e2e_be.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 8bab96b..4d42743 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -125,7 +125,6 @@ jobs: - name: Run Backend tests run: | - npm run e2e:backend --max-failures=10 npm run e2e:backend -- \ --workers=6 \ --max-failures=10 From be10885065ae27049d206dac842ebff7740b85fa Mon Sep 17 00:00:00 2001 From: Keith Lau <86580032+klaukl@users.noreply.github.com> Date: Thu, 16 Apr 2026 11:17:49 +1000 Subject: [PATCH 03/10] fix --- .github/workflows/test_e2e_be.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 4d42743..126dcda 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -23,13 +23,6 @@ on: type: string required: true default: "" - browser: - description: Browser, default to headless Chrome. - type: string - default: "chrome" - app: - type: string - default: 'backend' test_type: type: string required: false From 3ff4f869dfa118f41495a2e4e816e2d4ed048c53 Mon Sep 17 00:00:00 2001 From: Keith Lau <86580032+klaukl@users.noreply.github.com> Date: Fri, 17 Apr 2026 11:14:20 +1000 Subject: [PATCH 04/10] test(workers): changed to 10 --- .github/workflows/test_e2e_be.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 126dcda..5415d59 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -119,7 +119,7 @@ jobs: name: Run Backend tests run: | npm run e2e:backend -- \ - --workers=6 \ + --workers=10 \ --max-failures=10 - uses: actions/upload-artifact@v6 if: ${{ !cancelled() }} From 0ef2bc805036d8b13cc8f25109adc52dc386983b Mon Sep 17 00:00:00 2001 From: Keith Lau <86580032+klaukl@users.noreply.github.com> Date: Fri, 17 Apr 2026 12:00:41 +1000 Subject: [PATCH 05/10] test(workers): changed back to 6 --- .github/workflows/test_e2e_be.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 5415d59..03dd300 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -86,6 +86,7 @@ env: TESTID: ${{ inputs.test_id }} NIGHTWATCH_HEADLESS: true NIGHTWATCH_OUTPUT: true + # PW Settings jobs: @@ -119,7 +120,7 @@ jobs: name: Run Backend tests run: | npm run e2e:backend -- \ - --workers=10 \ + --workers=6 \ --max-failures=10 - uses: actions/upload-artifact@v6 if: ${{ !cancelled() }} From 06f68858a7396c2683ea9a07e2478912c9f12031 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 21 Apr 2026 08:56:21 +1000 Subject: [PATCH 06/10] test(gha): slack compat --- .github/workflows/test_e2e_be.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 03dd300..2551d69 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -43,12 +43,12 @@ on: slack_channel: type: string required: false - default: "sdp-test-report" + default: "sdp-test-report-dev" slack_notify: description: When to send the Slack notifications type: string required: false - default: "release_only" + default: "always" test_status: type: boolean default: false @@ -64,8 +64,8 @@ env: TEST_BE_EDITOR_USER: ${{ secrets.TEST_BE_EDITOR_USER }} TEST_BE_EDITOR_PASS: ${{ secrets.TEST_BE_EDITOR_PASS }} ##TODO: Add to secrets - # TEST_BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }} - # TEST_BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }} + # TEST_BE_APPROVER_PLUS_USER: ${{ secrets.TEST_BE_APPROVER_PLUS_USER }} + # TEST_BE_APPROVER_PLUS_PASS: ${{ secrets.TEST_BE_APPROVER_PLUS_PASS }} # TEST_BE_DATAIMPORTER_USER: ${{ secrets.TEST_BE_DATAIMPORTER_USER }} # TEST_BE_DATAIMPORTER_PASS: ${{ secrets.TEST_BE_DATAIMPORTER_PASS }} TEST_BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }} @@ -83,10 +83,8 @@ env: BROWSERSTACK_USER: ${{ secrets.TEST_BROWSERSTACK_USER }} BROWSERSTACK_KEY: ${{ secrets.TEST_BROWSERSTACK_KEY }} # Settings - TESTID: ${{ inputs.test_id }} NIGHTWATCH_HEADLESS: true NIGHTWATCH_OUTPUT: true - # PW Settings jobs: From e4036153413681468ee64589bfc3ed0195f65328 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 21 Apr 2026 09:35:40 +1000 Subject: [PATCH 07/10] test(worker): worker 8 --- .github/workflows/test_e2e_be.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 2551d69..afecc75 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -118,7 +118,7 @@ jobs: name: Run Backend tests run: | npm run e2e:backend -- \ - --workers=6 \ + --workers=8 \ --max-failures=10 - uses: actions/upload-artifact@v6 if: ${{ !cancelled() }} From 18b039f8565942a91faf4c25cd3826fd20bebf89 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 21 Apr 2026 10:19:57 +1000 Subject: [PATCH 08/10] test(worker): worker 4 --- .github/workflows/notify_slack.yml | 2 +- .github/workflows/test_e2e_be.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/notify_slack.yml b/.github/workflows/notify_slack.yml index 25a8756..6fc718f 100644 --- a/.github/workflows/notify_slack.yml +++ b/.github/workflows/notify_slack.yml @@ -39,7 +39,7 @@ on: artifact_name: description: Name of the report file type: string - required: true + required: false state: description: Check state to set type: string diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index afecc75..01a87fe 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -118,7 +118,7 @@ jobs: name: Run Backend tests run: | npm run e2e:backend -- \ - --workers=8 \ + --workers=4 \ --max-failures=10 - uses: actions/upload-artifact@v6 if: ${{ !cancelled() }} From 20e891b1287b4ebe119b1bc39993b007e76dd621 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 21 Apr 2026 10:40:43 +1000 Subject: [PATCH 09/10] test(worker): worker 5 --- .github/workflows/test_e2e_be.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 01a87fe..8813f5c 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -118,7 +118,7 @@ jobs: name: Run Backend tests run: | npm run e2e:backend -- \ - --workers=4 \ + --workers=5 \ --max-failures=10 - uses: actions/upload-artifact@v6 if: ${{ !cancelled() }} From 31cd8c429e1f02bdcf7902c541b0ce83bf3423aa Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 21 Apr 2026 10:44:59 +1000 Subject: [PATCH 10/10] test(worker): worker 5 --- .github/workflows/test_e2e_be.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_be.yml b/.github/workflows/test_e2e_be.yml index 8813f5c..0d4eaea 100644 --- a/.github/workflows/test_e2e_be.yml +++ b/.github/workflows/test_e2e_be.yml @@ -157,7 +157,7 @@ jobs: workflow_reusable_name: "test_e2e_be" test_type: ${{ inputs.test_type }} test_subtype: ${{ inputs.test_subtype }} - artifact_name: "test-reports-${{ inputs.name }}" + artifact_name: "playwright-report-backend" be_url: ${{ inputs.be_url }} project: ${{ inputs.project }} slack_channel: ${{ inputs.slack_channel }} \ No newline at end of file