@@ -528,14 +528,45 @@ commands:
528
528
browser : <<parameters.browser>>
529
529
- run :
530
530
command : |
531
- cmd=$([[ <<parameters.percy>> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true
532
- DEBUG=<<parameters.debug>> \
533
- CYPRESS_KONFIG_ENV=production \
534
- CYPRESS_RECORD_KEY=${TEST_LAUNCHPAD_RECORD_KEY:-$MAIN_RECORD_KEY} \
535
- PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \
536
- PERCY_ENABLE=${PERCY_TOKEN:-0} \
537
- PERCY_PARALLEL_TOTAL=-1 \
538
- $cmd yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --record --parallel --group <<parameters.package>>-<<parameters.type>>
531
+ echo Current working directory is $PWD
532
+ echo Total containers $CIRCLE_NODE_TOTAL
533
+
534
+ if [[ -v MAIN_RECORD_KEY ]]; then
535
+ # internal PR
536
+ cmd=$([[ <<parameters.percy>> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true
537
+ DEBUG=<<parameters.debug>> \
538
+ CYPRESS_KONFIG_ENV=production \
539
+ CYPRESS_RECORD_KEY=${TEST_LAUNCHPAD_RECORD_KEY:-$MAIN_RECORD_KEY} \
540
+ PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \
541
+ PERCY_ENABLE=${PERCY_TOKEN:-0} \
542
+ PERCY_PARALLEL_TOTAL=-1 \
543
+ $cmd yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --record --parallel --group <<parameters.package>>-<<parameters.type>>
544
+ else
545
+ # external PR
546
+
547
+ # To make `circleci tests` work correctly, we need to step into the package folder.
548
+ cd packages/<<parameters.package>>
549
+
550
+ GLOB="cypress/e2e/**/*cy.*"
551
+
552
+ if [[ <<parameters.type>> == 'ct' ]]; then
553
+ # component tests are located side by side with the source codes.
554
+ GLOB="src/**/*cy.*"
555
+ fi
556
+
557
+ TESTFILES=$(circleci tests glob "$GLOB" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
558
+ echo "Test files for this machine are $TESTFILES"
559
+
560
+ # To run the `yarn` command, we need to walk out of the package folder.
561
+ cd ../..
562
+
563
+ DEBUG=<<parameters.debug>> \
564
+ CYPRESS_KONFIG_ENV=production \
565
+ PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \
566
+ PERCY_ENABLE=${PERCY_TOKEN:-0} \
567
+ PERCY_PARALLEL_TOTAL=-1 \
568
+ yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --spec $TESTFILES
569
+ fi
539
570
- run :
540
571
command : |
541
572
if [[ <<parameters.package>> == 'app' && <<parameters.percy>> == 'true' && -d "packages/app/cypress/screenshots/runner/screenshot/screenshot.cy.tsx/percy" ]]; then
0 commit comments