Skip to content

Commit

Permalink
copy missing env vars to deploy tests & add blank manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Jun 10, 2024
1 parent 16caf41 commit 2e4676f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/test_e2e_deploy_scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
11 changes: 9 additions & 2 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -470,7 +476,8 @@ ${ENDGROUP}`)
RECORD_REPLAY: shouldRecordTestWithReplay,
// run tests in headless mode by default
HEADLESS: 'true',
TRACE_PLAYWRIGHT: 'true',
TRACE_PLAYWRIGHT:
process.env.NEXT_TEST_MODE === 'deploy' ? undefined : 'true',
NEXT_TELEMETRY_DISABLED: '1',
// unset CI env so CI behavior is only explicitly
// tested when enabled
Expand Down
11 changes: 11 additions & 0 deletions test/deploy-tests-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": 2,
"suites": {},
"rules": {
"include": [
"test/e2e/**/*.test.{t,j}s{,x}",
"test/production/**/*.test.{t,j}s{,x}"
],
"exclude": []
}
}
5 changes: 5 additions & 0 deletions test/get-test-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 2e4676f

Please sign in to comment.