Skip to content

Commit 628e560

Browse files
BCSS-20351: Test Runner POC Amendments (#43)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> This covers making some additional changes to the workflow to support executing the Playwright tests against a BCSS test environment using secrets and stored variables. > NOTE: This currently will not work as intended because GitHub native runners are hosted outside of the UK, so when attempting to run the WAF on our test environments they block the traffic and produce a 403 forbidden response. Some work is underway elsewhere to create our own hosted runners for BCSS in our infrastructure which will resolve this issue. ## Context <!-- Why is this change required? What problem does it solve? --> Allows us to run tests from GitHub eventually. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [x] Refactoring (non-breaking change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes (where appropriate) - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent abef415 commit 628e560

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

.github/actions/run-playwright-tests/action.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
required: true
99
type: string
1010
marker_to_use:
11-
description: "The test marker to use when running tests (e.g. smokescreen)"
11+
description: "The test marker to use when running tests (e.g. smoke)"
1212
required: true
1313
type: string
1414

@@ -29,13 +29,10 @@ runs:
2929
run: python -m playwright install --with-deps
3030
- name: Run specified tests
3131
shell: bash
32-
run: pytest -m ${{ inputs.marker_to_use }} --base-url=$URL_TO_USE --ignore=tests_utils/
33-
env:
34-
BCSS_PASS: ${{ secrets.BCSS_PASS }}
35-
ORACLE_DB: ${ ${{ secrets.ORACLE_DB }}/<REPLACE>/${{ inputs.bcss_cloud_environment }} }
36-
ORACLE_USERNAME: ${{ secrets.ORACLE_USERNAME }}
37-
ORACLE_PASS: ${{ secrets.ORACLE_PASS }}
38-
URL_TO_USE: ${ ${{ vars.CLOUD_ENV_URL }}/<REPLACE>/${{ inputs.bcss_cloud_environment }} }
32+
run: |
33+
URL_TO_USE="${URL_TO_USE_DEFAULT//<REPLACE>/${{ inputs.bcss_cloud_environment }}}"
34+
ORACLE_DB="${ORACLE_DB_DEFAULT//<REPLACE>/${{ inputs.bcss_cloud_environment }}}"
35+
pytest -m ${{ inputs.marker_to_use }} --base-url=https://$URL_TO_USE --ignore=tests_utils/
3936
- uses: actions/upload-artifact@v4
4037
if: ${{ !cancelled() }}
4138
with:

.github/workflows/execute-tests.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: "Test Runner"
22

3+
# This workflow is triggered manually and allows the user to specify the environment and test marker to run.
4+
# It is functional, however will not work against BCSS test environments until we configure some self-hosted
5+
# GitHub runners, as the GitHub-hosted runners are based outside of the UK so get blocked by the WAF on the
6+
# environments.
7+
38
on:
49
workflow_dispatch:
510
inputs:
@@ -17,12 +22,19 @@ jobs:
1722
run-tests:
1823
name: "Run Specified Tests"
1924
runs-on: ubuntu-latest
20-
timeout-minutes: 3
25+
timeout-minutes: 10
2126
steps:
2227
- name: "Checkout code"
2328
uses: actions/checkout@v4
2429
- name: "Run Tests"
30+
id: run-tests
2531
uses: ./.github/actions/run-playwright-tests
2632
with:
2733
bcss_cloud_environment: "${{ inputs.bcss_cloud_environment }}"
2834
marker_to_use: "${{ inputs.marker_to_use }}"
35+
env:
36+
BCSS_PASS: ${{ secrets.BCSS_PASS }}
37+
ORACLE_DB_DEFAULT: ${{ secrets.ORACLE_DB }}
38+
ORACLE_USERNAME: ${{ secrets.ORACLE_USERNAME }}
39+
ORACLE_PASS: ${{ secrets.ORACLE_PASS }}
40+
URL_TO_USE_DEFAULT: ${{ vars.CLOUD_ENV_URL }}

0 commit comments

Comments
 (0)