Skip to content

Commit 72e2b85

Browse files
BCSS-20351: Test Runner Workflow (POC) (#31)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> This adds a proof-of-concept test runner to allow for the execution of tests via GitHub actions. ## Context <!-- Why is this change required? What problem does it solve? --> This provides a method of demonstrating how tests can execute via GitHub Actions and will allow for future developments. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [ ] Refactoring (non-breaking change) - [x] 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 870ac35 commit 72e2b85

File tree

2 files changed

+49
-13
lines changed

2 files changed

+49
-13
lines changed

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
name: "Run Util & Example Tests"
1+
name: "Run Playwright Tests"
22
runs-on: ubuntu-latest
3-
timeout-minutes: 3
3+
timeout-minutes: 10
4+
5+
inputs:
6+
bcss_cloud_environment:
7+
description: "The environment to run against in lower case (e.g. bcss-1234)"
8+
required: true
9+
type: string
10+
marker_to_use:
11+
description: "The test marker to use when running tests (e.g. smokescreen)"
12+
required: true
13+
type: string
14+
415
runs:
516
using: "composite"
617
steps:
@@ -16,18 +27,15 @@ runs:
1627
- name: Ensure browsers are installed
1728
shell: bash
1829
run: python -m playwright install --with-deps
19-
- name: Run util tests
30+
- name: Run specified tests
2031
shell: bash
21-
run: pytest -m "utils" --ignore=tests/
22-
- uses: actions/upload-artifact@v4
23-
if: ${{ !cancelled() }}
24-
with:
25-
name: result-output-utils
26-
path: test-results/
27-
retention-days: 3
28-
- name: Run example tests
29-
shell: bash
30-
run: pytest --ignore=tests_utils/
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 }} }
3139
- uses: actions/upload-artifact@v4
3240
if: ${{ !cancelled() }}
3341
with:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Test Runner"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
bcss_cloud_environment:
7+
description: "The environment to run against in lower case (e.g. bcss-1234)"
8+
required: true
9+
type: string
10+
default: "bcss-18680"
11+
marker_to_use:
12+
description: "The test marker to use when running tests (e.g. smokescreen)"
13+
required: true
14+
type: string
15+
16+
jobs:
17+
run-tests:
18+
name: "Run Specified Tests"
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 3
21+
steps:
22+
- name: "Checkout code"
23+
uses: actions/checkout@v4
24+
- name: "Run Tests"
25+
uses: ./.github/actions/run-playwright-tests
26+
with:
27+
bcss_cloud_environment: "${{ inputs.bcss_cloud_environment }}"
28+
marker_to_use: "${{ inputs.marker_to_use }}"

0 commit comments

Comments
 (0)