11name : Functional tests
22
33on :
4+ workflow_call :
5+ inputs :
6+ tests :
7+ description : ' Tests to run (leave blank to run all tests!)'
8+ required : false
9+ default : ' '
10+ type : string
11+ cross_service_tests :
12+ description : ' Include imms api and reporting tests'
13+ required : false
14+ default : false
15+ type : boolean
16+ github_ref :
17+ description : ' Github reference to get tests from'
18+ required : false
19+ default : ' main'
20+ type : string
21+ device :
22+ description : ' Device to test'
23+ required : false
24+ default : ' Desktop Chrome'
25+ type : string
26+ programmes :
27+ description : Programmes to use (FLU, HPV, MENACWY, MMR or TD_IPV)
28+ required : false
29+ default : FLU,HPV,MENACWY,MMR,TD_IPV
30+ type : string
31+ endpoint :
32+ description : ' Environment to run tests against'
33+ required : false
34+ default : ' https://qa.mavistesting.com'
35+ type : string
36+ screenshot_all_steps :
37+ description : ' Take screenshots for all steps (in addition to failures)'
38+ required : false
39+ default : false
40+ type : boolean
41+ enable_reruns :
42+ description : ' Enable test reruns on failure (up to 3 attempts)'
43+ required : false
44+ default : true
45+ type : boolean
46+ test_workers :
47+ description : ' Number of parallel test workers to use'
48+ required : false
49+ default : ' 4'
50+ type : string
51+ set_feature_flags :
52+ description : ' Set feature flags in the flipper page before running tests (affects all users of the environment being tested!)'
53+ required : false
54+ default : false
55+ type : boolean
56+ additional_feature_flags :
57+ description : ' (If enabled above) Additional feature flags to set. api, basic_auth, dev_tools will be set by default'
58+ required : false
59+ default : ' '
60+ type : string
61+ secrets :
62+ HTTP_AUTH_TOKEN_FOR_TESTS :
63+ description : ' HTTP Basic Auth token for the environment under test'
64+ required : true
65+ MAVIS_TESTING_REPO_ACCESS_TOKEN :
66+ description : ' Git token with access to the mavis testing repo'
67+ required : false
468 workflow_dispatch :
569 inputs :
670 tests :
96160 [sandbox-alpha]="https://sandbox-alpha.mavistesting.com"
97161 [sandbox-beta]="https://sandbox-beta.mavistesting.com"
98162 )
99- if [ "${{ github.event_name }}" = "pull_request " ]; then
163+ if [ "${{ github.event_name }}" = "push " ]; then
100164 echo "tests=" >> $GITHUB_OUTPUT
101165 echo "device=Desktop Chrome" >> $GITHUB_OUTPUT
102166 echo "environment=${env_map[qa]}" >> $GITHUB_OUTPUT
@@ -108,23 +172,32 @@ jobs:
108172 echo "enable_reruns=true" >> $GITHUB_OUTPUT
109173 echo "test_workers=4" >> $GITHUB_OUTPUT
110174 else
111- echo "tests=${{ github.event.inputs.tests }}" >> $GITHUB_OUTPUT
112- echo "device=${{ github.event.inputs.device }}" >> $GITHUB_OUTPUT
113-
114- input_env="${{ github.event.inputs.environment }}"
115- url="${env_map[$input_env]:-${env_map[qa]}}"
116- echo "environment=$url" >> $GITHUB_OUTPUT
175+ echo "tests=${{ inputs.tests }}" >> $GITHUB_OUTPUT
176+ echo "cross_service_tests=${{ inputs.cross_service_tests }}" >> $GITHUB_OUTPUT
177+ echo "device=${{ inputs.device }}" >> $GITHUB_OUTPUT
178+
179+ input_env="${{ inputs.environment }}"
180+ if [ -n "$input_env" ]; then
181+ url="${env_map[$input_env]:-${env_map[qa]}}"
182+ echo "environment=$url" >> $GITHUB_OUTPUT
183+ else
184+ echo "environment=${{ inputs.endpoint }}" >> $GITHUB_OUTPUT
185+ fi
117186
118- echo "programmes=${{ github.event. inputs.programmes }}" >> $GITHUB_OUTPUT
119- echo "set_feature_flags=${{ github.event. inputs.set_feature_flags }}" >> $GITHUB_OUTPUT
120- echo "additional_feature_flags=${{ github.event. inputs.additional_feature_flags }}" >> $GITHUB_OUTPUT
187+ echo "programmes=${{ inputs.programmes }}" >> $GITHUB_OUTPUT
188+ echo "set_feature_flags=${{ inputs.set_feature_flags }}" >> $GITHUB_OUTPUT
189+ echo "additional_feature_flags=${{ inputs.additional_feature_flags }}" >> $GITHUB_OUTPUT
121190 echo "deploy_report=true" >> $GITHUB_OUTPUT
122- echo "screenshot_all_steps=${{ github.event. inputs.screenshot_all_steps }}" >> $GITHUB_OUTPUT
123- echo "enable_reruns=${{ github.event. inputs.enable_reruns }}" >> $GITHUB_OUTPUT
124- echo "test_workers=${{ github.event. inputs.test_workers }}" >> $GITHUB_OUTPUT
191+ echo "screenshot_all_steps=${{ inputs.screenshot_all_steps }}" >> $GITHUB_OUTPUT
192+ echo "enable_reruns=${{ inputs.enable_reruns }}" >> $GITHUB_OUTPUT
193+ echo "test_workers=${{ inputs.test_workers }}" >> $GITHUB_OUTPUT
125194 fi
126195
127- - uses : actions/checkout@v6
196+ - name : Checkout repository
197+ uses : actions/checkout@v6
198+ with :
199+ repository : NHSDigital/manage-vaccinations-in-schools-testing
200+ ref : ${{ inputs.github_ref || github.head_ref }}
128201
129202 - name : Cache Playwright browsers
130203 uses : actions/cache@v4
@@ -160,4 +233,5 @@ jobs:
160233 device : ${{ steps.set-variables.outputs.device }}
161234 environment : ${{ github.event.inputs.environment }}
162235 env :
163- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
236+ GITHUB_TOKEN : ${{ secrets.MAVIS_TESTING_REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
237+
0 commit comments