Skip to content

Commit 9101a90

Browse files
sainthkhryanthemanuellmiller1990
authored
fix: distribute files to machines for external contributors. (#22326)
* fix: distribute files to machines for external contributors. * fix path * fix * fix glob * fix * fix glob pattern spec->cy. * fix * echo things. * test * use cd. * fix component tests. * test * test * fix * refactor * test distribut-step fix error fix fix test TEST * Revert "test distribut-step" This reverts commit 15c3606. * Revert "refactor" This reverts commit 21a8ad9. * reduce flake by increasing viewport height Co-authored-by: Ryan Manuel <[email protected]> Co-authored-by: Lachlan Miller <[email protected]>
1 parent 4726ea9 commit 9101a90

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

circle.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,45 @@ commands:
528528
browser: <<parameters.browser>>
529529
- run:
530530
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
539570
- run:
540571
command: |
541572
if [[ <<parameters.package>> == 'app' && <<parameters.percy>> == 'true' && -d "packages/app/cypress/screenshots/runner/screenshot/screenshot.cy.tsx/percy" ]]; then

packages/app/cypress/e2e/specs.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('App: Specs', () => {
9595

9696
const expectedScaffoldPathsForPlatform = expectedScaffoldPaths.map(getPathForPlatform)
9797

98-
it('scaffolds example files when card is clicked', () => {
98+
it('scaffolds example files when card is clicked', { viewportHeight: 1200 }, () => {
9999
cy.get('@ScaffoldCard').click()
100100

101101
cy.findByRole('dialog', {

0 commit comments

Comments
 (0)