@@ -326,6 +326,20 @@ commands:
326326 environment :
327327 NODE_ENV : test
328328
329+ check-playwright-test-count :
330+ parameters :
331+ project :
332+ type : string
333+ steps :
334+ - run :
335+ name : Checking Playwright Test Count
336+ command : |
337+ TEST_COUNT=$(echo $TEST_FILES | circleci tests run --command="xargs yarn playwright test --project=<< parameters.project >> $GREP --list" | wc -l)
338+ if [[ "$TEST_COUNT" -eq 0 ]]; then
339+ echo "No functional tests targeted to run! Exiting early."
340+ circleci-agent step halt
341+ fi
342+
329343 run-playwright-tests :
330344 parameters :
331345 project :
@@ -338,14 +352,24 @@ commands:
338352 name : Running Playwright tests
339353 # Supports 'Re-run failed tests only'. See this for more info: https://circleci.com/docs/rerun-failed-tests-only/
340354 command : |
355+ if [[ "<< parameters.project >>" == "production" ]]; then
356+ GREP="--grep=\"severity-1\""
357+ elif [[ "<< parameters.project >>" == "stage" ]]; then
358+ GREP="--grep=\"severity-(1|2)\""
359+ else
360+ GREP=""
361+ fi
362+ echo "targeting project << parameters.project >> $GREP"
363+ npx nx build fxa-auth-client
341364 cd packages/functional-tests/tests
342365 TEST_FILES=$(circleci tests glob "./**/*.spec.ts")
343366 cd ..
344- printf '%s\n' $TEST_FILES | circleci tests run \
367+
368+ echo $TEST_FILES | circleci tests run \
369+ --command="xargs yarn playwright test --project=<< parameters.project >> $GREP" \
345370 --verbose \
346371 --split-by=timings \
347- --timings-type=classname \
348- --command="~/project/.circleci/run-playwright.sh << parameters.project >>"
372+ --timings-type=classname
349373 environment :
350374 NODE_OPTIONS : --dns-result-order=ipv4first
351375 ACCOUNTS_DOMAIN : << pipeline.parameters.accounts-domain >>
@@ -359,10 +383,10 @@ commands:
359383 steps :
360384 - run :
361385 name : Ensure directories
362- command : mkdir -p ~/project/ artifacts/tests && mkdir -p ~/.pm2/logs && mkdir -p ~/screenshots
386+ command : mkdir -p artifacts/tests && mkdir -p ~/.pm2/logs && mkdir -p ~/screenshots
363387 when : always
364388 - store_artifacts :
365- path : ~/project/ artifacts
389+ path : artifacts
366390 when : always
367391 - store_artifacts :
368392 path : ~/screenshots
@@ -371,7 +395,7 @@ commands:
371395 path : ~/.pm2/logs
372396 when : always
373397 - store_test_results :
374- path : ~/project/ artifacts/tests
398+ path : artifacts/tests
375399 when : always
376400
377401 build :
@@ -739,6 +763,8 @@ jobs:
739763 steps :
740764 - git-checkout
741765 - provision
766+ - check-playwright-test-count :
767+ project : production
742768 - run-playwright-tests :
743769 project : production
744770 - store-artifacts
@@ -762,6 +788,8 @@ jobs:
762788 - git-checkout
763789 - gcp-cli/setup
764790 - provision
791+ - check-playwright-test-count :
792+ project : << parameters.project >>
765793 - run-playwright-tests :
766794 project : << parameters.project >>
767795 fail_fast : << parameters.fail_fast >>
@@ -788,6 +816,8 @@ jobs:
788816 - git-checkout
789817 - restore-workspace
790818 - gcp-cli/setup
819+ - check-playwright-test-count :
820+ project : local
791821 - run :
792822 name : Add localhost
793823 command : |
0 commit comments