From ba28e8173526ae1b9b31124be10c63be981aed05 Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:43:02 -0700 Subject: [PATCH] copy missing env vars to deploy tests & add blank manifest --- .../workflows/test_e2e_deploy_scheduled.yml | 25 +++++++++++-------- run-tests.js | 8 +++++- test/deploy-tests-manifest.json | 11 ++++++++ test/get-test-filter.js | 5 ++++ 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 test/deploy-tests-manifest.json diff --git a/.github/workflows/test_e2e_deploy_scheduled.yml b/.github/workflows/test_e2e_deploy_scheduled.yml index 02729a8c4a7ce6..eda3efb3529035 100644 --- a/.github/workflows/test_e2e_deploy_scheduled.yml +++ b/.github/workflows/test_e2e_deploy_scheduled.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - group: [1, 2] + group: [1/5, 2/5, 3/5, 4/5, 5/5] steps: - name: Setup Node.js @@ -60,17 +60,20 @@ jobs: - name: Run tests run: | docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.41.2-jammy /bin/bash -c "cd /work && \ - NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && \ + NODE_VERSION=${NODE_LTS_VERSION} ./scripts/setup-node.sh && \ corepack enable > /dev/null && \ - NEXT_JUNIT_TEST_REPORT=${{ env.NEXT_JUNIT_TEST_REPORT }} \ - DATADOG_API_KEY=${{ env.DATADOG_API_KEY }} \ - DD_ENV=${{ env.DD_ENV }} \ - VERCEL_TEST_TOKEN=${{ env.VERCEL_TEST_TOKEN }} \ - VERCEL_TEST_TEAM=${{ env.VERCEL_TEST_TEAM }} \ - NEXT_TEST_JOB=${{ env.NEXT_TEST_JOB }} \ - NEXT_TEST_MODE=${{ env.NEXT_TEST_MODE }} \ - TEST_TIMINGS_TOKEN=${{ env.TEST_TIMINGS_TOKEN }} \ - xvfb-run node run-tests.js --type e2e --timings -g ${{ matrix.group }}/2 -c 1 >> /proc/1/fd/1" + NEXT_JUNIT_TEST_REPORT=${NEXT_JUNIT_TEST_REPORT} \ + NEXT_TELEMETRY_DISABLED=${NEXT_TELEMETRY_DISABLED} \ + DATADOG_API_KEY=${DATADOG_API_KEY} \ + DD_ENV=${DD_ENV} \ + VERCEL_TEST_TOKEN=${VERCEL_TEST_TOKEN} \ + VERCEL_TEST_TEAM=${VERCEL_TEST_TEAM} \ + NEXT_TEST_JOB=${NEXT_TEST_JOB} \ + NEXT_TEST_MODE=${NEXT_TEST_MODE} \ + TEST_TIMINGS_TOKEN=${TEST_TIMINGS_TOKEN} \ + NEXT_TEST_CONTINUE_ON_ERROR=${NEXT_TEST_CONTINUE_ON_ERROR} \ + NEXT_EXTERNAL_TESTS_FILTERS=./test/deploy-tests-manifest.json \ + xvfb-run node run-tests.js --type e2e --timings -g ${{ matrix.group }} -c 1 >> /proc/1/fd/1" - name: Save test report as artifacts if: always() diff --git a/run-tests.js b/run-tests.js index 98dd35e5de1203..1fbfa1d5be2753 100644 --- a/run-tests.js +++ b/run-tests.js @@ -227,7 +227,12 @@ async function main() { } } - console.log('Running tests with concurrency:', options.concurrency) + console.log( + 'Running tests with concurrency:', + options.concurrency, + 'in test mode', + process.env.NEXT_TEST_MODE + ) /** @type TestFile[] */ let tests = argv._.filter((arg) => @@ -315,6 +320,7 @@ async function main() { // If there are external manifest contains list of tests, apply it to the test lists. if (externalTestsFilter) { + console.log() tests = externalTestsFilter(tests) } diff --git a/test/deploy-tests-manifest.json b/test/deploy-tests-manifest.json new file mode 100644 index 00000000000000..4eb82c58a026a2 --- /dev/null +++ b/test/deploy-tests-manifest.json @@ -0,0 +1,11 @@ +{ + "version": 2, + "suites": {}, + "rules": { + "include": [ + "test/e2e/**/*.test.{t,j}s{,x}", + "test/production/**/*.test.{t,j}s{,x}" + ], + "exclude": [] + } +} diff --git a/test/get-test-filter.js b/test/get-test-filter.js index 76840e2e6dcc82..bf6cc218524b1a 100644 --- a/test/get-test-filter.js +++ b/test/get-test-filter.js @@ -7,6 +7,11 @@ function getTestFilter() { : null if (!manifest) return null + console.log( + 'Filtering tests using manifest:', + process.env.NEXT_EXTERNAL_TESTS_FILTERS + ) + // For the legacy manifest without a version, we assume it's a complete list // of all the tests. if (!manifest.version || typeof manifest.version !== 'number') {