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 :
771 description : ' Tests to run (leave blank to run all tests!)'
872 required : false
973 default : ' '
74+ cross_service_tests :
75+ description : ' Include imms api and reporting tests'
76+ required : false
77+ default : ' true'
78+ type : choice
79+ options :
80+ - true
81+ - false
1082 device :
1183 description : ' Device to test'
1284 required : true
73145 description : ' (If enabled above) Additional feature flags to set. api, basic_auth, dev_tools will be set by default'
74146 required : false
75147 default : ' '
76- pull_request :
77148
78149jobs :
79150 test :
96167 [sandbox-alpha]="https://sandbox-alpha.mavistesting.com"
97168 [sandbox-beta]="https://sandbox-beta.mavistesting.com"
98169 )
99- if [ "${{ github.event_name }}" = "pull_request " ]; then
170+ if [ "${{ github.event_name }}" = "push " ]; then
100171 echo "tests=" >> $GITHUB_OUTPUT
172+ echo "cross_service_tests=true" >> $GITHUB_OUTPUT
101173 echo "device=Desktop Chrome" >> $GITHUB_OUTPUT
102174 echo "environment=${env_map[qa]}" >> $GITHUB_OUTPUT
103175 echo "programmes=FLU,HPV,MENACWY,MMR,TD_IPV" >> $GITHUB_OUTPUT
@@ -108,23 +180,32 @@ jobs:
108180 echo "enable_reruns=true" >> $GITHUB_OUTPUT
109181 echo "test_workers=4" >> $GITHUB_OUTPUT
110182 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
183+ echo "tests=${{ inputs.tests }}" >> $GITHUB_OUTPUT
184+ echo "cross_service_tests=${{ inputs.cross_service_tests }}" >> $GITHUB_OUTPUT
185+ echo "device=${{ inputs.device }}" >> $GITHUB_OUTPUT
186+
187+ input_env="${{ inputs.environment }}"
188+ if [ -n "$input_env" ]; then
189+ url="${env_map[$input_env]:-${env_map[qa]}}"
190+ echo "environment=$url" >> $GITHUB_OUTPUT
191+ else
192+ echo "environment=${{ inputs.endpoint }}" >> $GITHUB_OUTPUT
193+ fi
117194
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
195+ echo "programmes=${{ inputs.programmes }}" >> $GITHUB_OUTPUT
196+ echo "set_feature_flags=${{ inputs.set_feature_flags }}" >> $GITHUB_OUTPUT
197+ echo "additional_feature_flags=${{ inputs.additional_feature_flags }}" >> $GITHUB_OUTPUT
121198 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
199+ echo "screenshot_all_steps=${{ inputs.screenshot_all_steps }}" >> $GITHUB_OUTPUT
200+ echo "enable_reruns=${{ inputs.enable_reruns }}" >> $GITHUB_OUTPUT
201+ echo "test_workers=${{ inputs.test_workers }}" >> $GITHUB_OUTPUT
125202 fi
126203
127- - uses : actions/checkout@v6
204+ - name : Checkout repository
205+ uses : actions/checkout@v6
206+ with :
207+ repository : NHSDigital/manage-vaccinations-in-schools-testing
208+ ref : ${{ inputs.github_ref || github.head_ref }}
128209
129210 - name : Cache Playwright browsers
130211 uses : actions/cache@v4
@@ -137,6 +218,9 @@ jobs:
137218 uses : ./.github/actions/run-functional-tests
138219 with :
139220 tests : ${{ steps.set-variables.outputs.tests }}
221+ imms_api_tests : ${{ steps.set-variables.outputs.cross_service_tests }}
222+ reporting_tests : ${{ steps.set-variables.outputs.cross_service_tests }}
223+ github_ref : ${{ inputs.github_ref || github.head_ref }}
140224 device : ${{ steps.set-variables.outputs.device }}
141225 base_url : ${{ steps.set-variables.outputs.environment }}
142226 programmes_enabled : ${{ steps.set-variables.outputs.programmes }}
@@ -160,4 +244,5 @@ jobs:
160244 device : ${{ steps.set-variables.outputs.device }}
161245 environment : ${{ github.event.inputs.environment }}
162246 env :
163- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
247+ GITHUB_TOKEN : ${{ secrets.MAVIS_TESTING_REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
248+
0 commit comments