8181 runs-on : ${{ github.event.inputs.RUNNER == 'mac' && fromJSON('["self-hosted", "macOS"]') || fromJSON('["self-hosted", "linux", "X64", "qa-android"]') }}
8282 env :
8383 PLATFORM : ' android'
84- EMULATOR_COUNT : ${{ github.event.inputs.RUNNER == 'mac' && '6' || '4' }}
84+ EMULATOR_COUNT : ${{ github.event.inputs.RUNNER == 'mac' && '6' || '4' }} # macOS runner can support 6 emulators, linux runner only 4
85+ WORKERS_1_DEVICE : ${{ github.event.inputs.RUNNER == 'mac' && '6' || '4' }} # 6 or 4 workers, 1 device each
86+ WORKERS_2_DEVICE : ${{ github.event.inputs.RUNNER == 'mac' && '3' || '2' }} # 3 or 2 workers, 2 devices each
87+ WORKERS_3_DEVICE : ${{ github.event.inputs.RUNNER == 'mac' && '2' || '1' }} # 2 or 1 worker(s), 3 devices each
8588 APK_URL : ${{ github.event.inputs.APK_URL }}
8689 BUILD_NUMBER : ${{ github.event.inputs.BUILD_NUMBER }}
8790 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -202,47 +205,42 @@ jobs:
202205 PLATFORM : ${{ env.PLATFORM }}
203206 RISK : ${{ github.event.inputs.RISK }}
204207
205- - name : Run the 1-devices tests with 4 workers
206- continue-on-error : true
207- id : devices-1-test-run
208- env :
209- PLAYWRIGHT_WORKERS_COUNT : ${{ env.EMULATOR_COUNT }} # 6 on mac, 4 on linux
210- DEVICES_PER_TEST_COUNT : 1
211- run : |
212- pwd
213- TESTING=${{ github.event.inputs.HIDE_WEBDRIVER_LOGS }} npx playwright test --grep "(?=.*@${PLATFORM})(?=.*@${DEVICES_PER_TEST_COUNT}-devices)(?=.*@${{ github.event.inputs.RISK }})" #Note: this has to be double quotes
214-
215- - name : Upload results of this run
216- uses : ./github/actions/upload-test-results
208+ - name : Run 1-device tests
209+ uses : ./github/actions/run-playwright-tests
217210 with :
218211 PLATFORM : ${{ env.PLATFORM }}
212+ RISK : ${{ github.event.inputs.RISK }}
213+ WORKERS_COUNT : ${{ env.WORKERS_1_DEVICE }}
214+ DEVICES_PER_TEST : ' 1'
215+ TEST_NAME : ' 1-device'
216+ GREP_INCLUDE : ' @1-devices'
217+ HIDE_WEBDRIVER_LOGS : ${{ env.HIDE_WEBDRIVER_LOGS }}
219218 UPLOAD_IDENTIFIER : ' devices-1-test-run'
220219
221- - name : Run the 2-devices tests with 2 workers
222- continue-on-error : true
223- id : devices-2-test-run
224- env :
225- PLAYWRIGHT_WORKERS_COUNT : ${{ github.event.inputs.RUNNER == 'mac' && '3' || '2' }}
226- DEVICES_PER_TEST_COUNT : 2
227- run : |
228- pwd
229- _TESTING=${{ github.event.inputs.HIDE_WEBDRIVER_LOGS }} npx playwright test --grep "(?=.*@${PLATFORM})(?=.*@${DEVICES_PER_TEST_COUNT}-devices)(?=.*@${{ github.event.inputs.RISK }})" #Note: this has to be double quotes
230-
231- - name : Upload results of this run
232- uses : ./github/actions/upload-test-results
220+ - name : Run 2-device tests
221+ uses : ./github/actions/run-playwright-tests
233222 with :
234223 PLATFORM : ${{ env.PLATFORM }}
224+ RISK : ${{ github.event.inputs.RISK }}
225+ WORKERS_COUNT : ${{ env.WORKERS_2_DEVICE }}
226+ DEVICES_PER_TEST : ' 2'
227+ TEST_NAME : ' 2-device'
228+ GREP_INCLUDE : ' @2-devices'
229+ HIDE_WEBDRIVER_LOGS : ${{ env.HIDE_WEBDRIVER_LOGS }}
235230 UPLOAD_IDENTIFIER : ' devices-2-test-run'
236231
237- - name : Run the tests other tests with 1 worker
238- continue-on-error : true
239- id : other-devices-test-run
240- env :
241- PLAYWRIGHT_WORKERS_COUNT : ${{ github.event.inputs.RUNNER == 'mac' && '2' || '1' }}
242- DEVICES_PER_TEST_COUNT : 3
243- run : |
244- pwd
245- _TESTING=${{ github.event.inputs.HIDE_WEBDRIVER_LOGS }} npx playwright test --grep "(?=.*@${PLATFORM})(?=.*@${{ github.event.inputs.RISK }})" --grep-invert "@1-devices|@2-devices" #Note: this has to be double quotes
232+ - name : Run 3-device tests
233+ uses : ./github/actions/run-playwright-tests
234+ with :
235+ PLATFORM : ${{ env.PLATFORM }}
236+ RISK : ${{ github.event.inputs.RISK }}
237+ WORKERS_COUNT : ${{ env.WORKERS_3_DEVICE }}
238+ DEVICES_PER_TEST : ' 3'
239+ TEST_NAME : ' 3-device'
240+ GREP_INCLUDE : ' @3-devices'
241+ HIDE_WEBDRIVER_LOGS : ${{ env.HIDE_WEBDRIVER_LOGS }}
242+ UPLOAD_IDENTIFIER : ' devices-3-test-run'
243+
246244
247245 - name : Generate and publish test report
248246 uses : ./github/actions/generate-publish-test-report
@@ -256,21 +254,12 @@ jobs:
256254 GITHUB_RUN_NUMBER : ${{ github.run_number }}
257255 GITHUB_RUN_ATTEMPT : ${{ github.run_attempt }}
258256
259- - name : Upload results of this run
260- uses : ./github/actions/upload-test-results
261- with :
262- PLATFORM : ${{ env.PLATFORM }}
263- UPLOAD_IDENTIFIER : ' devices-other-test-run'
264-
265257 - name : Upload csv of this whole run
266258 uses : ./github/actions/upload-csv-test-results
267259 if : always()
268260 with :
269261 PLATFORM : ${{ env.PLATFORM }}
270262
271- - name : Check if any tests failed
272- if : steps.devices-1-test-run != 'success' || steps.devices-2-test-run != 'success' || steps.other-devices-test-run.outcome != 'success'
273- run : echo 'Some test failed, see above'; exit 1
274263
275264 - name : Stop emulators
276265 if : always()
0 commit comments