Skip to content

Commit ed7eca4

Browse files
authored
ci: use new e2e tests manifest (#131)
* ci: run tests on canary and skip none * DIsable one so script works * Use manifest v2 * Remove old filter step * Fix versions * Exclude invalid tests * Exclude more * Use junit * Set cwd for test report * Try massive concurrency * Fix concurrency * Use different test reporter * Adjust condiitons * Typo * Fix junit path * Disable more * fix: shim process in edge runtime * Switch reporter action * ci: fix artifact path * Disable very slow tests * Add test runner * Use md formatter * Add deno install step to task * Fix tool path * Disable test * Skip bad tests * Omit non-deploy test * Skip tests that are failing because of whitespace in headers * Continute on error in local tests * Skip a non-deploy test * Skip xff test * Skip tests that try to patch files * Checkout runtime in report step * DIsable more flaky tests * Fix script name * Log cast totals * Format better
1 parent bf63aa8 commit ed7eca4

File tree

5 files changed

+353
-81
lines changed

5 files changed

+353
-81
lines changed

.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dist/
22
demo/
33
tests/
4-
edge-runtime
4+
edge-runtime
5+
tools/deno

.github/workflows/test-e2e.yml

+40-80
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ on:
77
types: [opened, synchronize, reopened, labeled]
88

99
env:
10-
NODE_VERSION: 18.16.1
11-
PNPM_VERSION: 8.7.1
10+
NODE_VERSION: 18.17.1
11+
PNPM_VERSION: 8.9.0
1212
NEXT_REPO: netlify/next.js
13-
NEXT_VERSION: 13.5.1
1413
NEXT_TEST_MODE: deploy
15-
NEXT_TEST_JOB: true
14+
NEXT_JUNIT_TEST_REPORT: true
1615
TEST_CONCURRENCY: 8
1716
NEXT_E2E_TEST_TIMEOUT: 600000
1817
NEXT_TELEMETRY_DISABLED: 1
@@ -22,29 +21,22 @@ env:
2221
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
2322
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395
2423
NEXT_TEST_CONTINUE_ON_ERROR: 1
25-
24+
next-path: next.js
25+
runtime-path: next-runtime-minimal
2626
jobs:
2727
e2e:
2828
if:
2929
${{ github.event_name == ('workflow_dispatch' || 'workflow_call') ||
3030
contains(github.event.pull_request.labels.*.name, 'run-e2e-tests') }}
31-
name: test e2e
31+
name: Test group ${{ matrix.group }}/20
3232
runs-on: ubuntu-latest
3333
timeout-minutes: 120
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
group: [1, 2, 3, 4, 5, 6, 7, 8]
38-
env:
39-
next-path: next.js
40-
runtime-path: next-runtime-minimal
41-
skipped-tests: |
42-
test/e2e/app-dir/app-compilation/index.test.ts
43-
test/e2e/favicon-short-circuit/favicon-short-circuit.test.ts
37+
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
4438

4539
steps:
46-
- name: 'Setup jq'
47-
uses: dcarbone/[email protected]
4840
- name: get github token
4941
uses: navikt/github-app-token-generator@v1
5042
id: token
@@ -58,7 +50,6 @@ jobs:
5850
with:
5951
repository: ${{ env.NEXT_REPO }}
6052
token: ${{ steps.token.outputs.token }}
61-
ref: v${{ env.NEXT_VERSION }}-netlify
6253
path: ${{ env.next-path }}
6354

6455
- name: checkout runtime repo
@@ -131,73 +122,42 @@ jobs:
131122
run: npx playwright install
132123
working-directory: ${{ env.next-path }}
133124

134-
- name: set test filter
135-
run: |
136-
ls test/e2e/**/*.test.* > included_tests
137-
printf %s "${{ env.skipped-tests }}" > skipped_tests
138-
comm -23 included_tests skipped_tests > filtered_tests
139-
echo "{\"enabledTests\":[\"$(printf %s "$(< filtered_tests)" | sed -z "s/\n/\",\"/g")\"]}" > tests.json
140-
working-directory: ${{ env.next-path }}
141-
142125
- name: run tests
143126
env:
144127
NODE_ENV: production
145-
NEXT_EXTERNAL_TESTS_FILTERS: ./tests.json
146-
run: node run-tests.js -g ${{ matrix.group }}/8 -c ${TEST_CONCURRENCY} --type e2e
128+
NEXT_EXTERNAL_TESTS_FILTERS: ../next-runtime-minimal/tests/netlify-e2e.json
129+
run: node run-tests.js -g ${{ matrix.group }}/20 -c ${TEST_CONCURRENCY} --type e2e
147130
working-directory: ${{ env.next-path }}
148131

149-
- name: Test results
150-
working-directory: ${{ env.next-path }}
132+
- name: Upload Test Results
133+
if: success() || failure()
134+
uses: actions/upload-artifact@v3
135+
with:
136+
name: Test Results (${{ matrix.group }})
137+
path: ${{ env.next-path }}/test/test-junit-report/*.xml
138+
publish-test-results:
139+
name: 'E2E Test Summary'
140+
needs: e2e
141+
runs-on: ubuntu-latest
142+
permissions:
143+
checks: write
144+
contents: read
145+
issues: read
146+
if: success() || failure()
147+
148+
steps:
149+
- name: checkout runtime repo
150+
uses: actions/checkout@v4
151+
152+
- name: Install Deno
153+
uses: denoland/setup-deno@v1
154+
155+
- name: Download Artifacts
156+
uses: actions/download-artifact@v3
157+
with:
158+
path: artifacts
159+
160+
- name: Publish Test Report
161+
if: success() || failure()
151162
run: |
152-
for file in `ls test/e2e/**/*.results.json`; do
153-
test_name=$(echo $file | sed -e 's/test\/e2e\/\(.*\/.*\).results.json/\1/')
154-
155-
success=$(jq -r '.success' $file)
156-
if [ "$success" = "true" ] ; then
157-
test_result=":white_check_mark:"
158-
else
159-
test_result=":x:"
160-
fi
161-
162-
passed=$(jq -r '.numPassedTests' $file)
163-
passed_total=$((passed_total + passed))
164-
failed=$(jq -r '.numFailedTests' $file)
165-
failed_total=$((failed_total + failed))
166-
pending=$(jq -r '.numPendingTests' $file)
167-
pending_total=$((pending_total + pending))
168-
total=$(jq -r '.numTotalTests' $file)
169-
total_total=$((total_total + total))
170-
171-
message=$(jq -r '.testResults[].message' $file)
172-
173-
echo "<details>" >> test_summary
174-
echo "<summary>${test_result} <code>${test_name}</code></summary>" >> test_summary
175-
echo "<h4>Results</h4>" >> test_summary
176-
echo "<div>Passing tests: ${passed}</div>" >> test_summary
177-
echo "<div>Failing tests: ${failed}</div>" >> test_summary
178-
echo "<div>Pending tests: ${pending}</div>" >> test_summary
179-
echo "<div>Total tests: ${total}</div>" >> test_summary
180-
181-
if [ -n "${message}" ] ; then
182-
echo "<h4>Details</h4>" >> test_summary
183-
echo "<pre><code>" >> test_summary
184-
echo $message >> test_summary
185-
echo "</code></pre>" >> test_summary
186-
fi
187-
188-
echo "</details>" >> test_summary
189-
done
190-
191-
echo "<h3>Results</h3>" >> $GITHUB_STEP_SUMMARY
192-
echo "<div>Passing tests: ${passed_total}</div>" >> $GITHUB_STEP_SUMMARY
193-
echo "<div>Failing tests: ${failed_total}</div>" >> $GITHUB_STEP_SUMMARY
194-
echo "<div>Pending tests: ${pending_total}</div>" >> $GITHUB_STEP_SUMMARY
195-
echo "<div>Total tests: ${total_total}</div>" >> $GITHUB_STEP_SUMMARY
196-
197-
echo "<h3>Details</h3>" >> $GITHUB_STEP_SUMMARY
198-
cat test_summary >> $GITHUB_STEP_SUMMARY
199-
200-
if [ "$failed_total" -gt 0 ] ; then
201-
echo "Failed tests. Please see action summary for details."
202-
exit 1
203-
fi
163+
deno run -A tools/deno/junit2md.ts artifacts >> $GITHUB_STEP_SUMMARY

run-local-test.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
# Print usage if nothing is passed
4+
if [ -z "$1" ]; then
5+
echo "Usage: $0 <test-pattern>"
6+
exit 1
7+
fi
8+
# Check that the next.js directory exists
9+
if [ ! -d "../next.js" ]; then
10+
echo "Error: next.js repo needs to be in ../next.js"
11+
exit 1
12+
fi
13+
export NEXT_TEST_CONTINUE_ON_ERROR=1
14+
export NETLIFY_SITE_ID=1d5a5c76-d445-4ae5-b694-b0d3f2e2c395
15+
export NEXT_TEST_MODE=deploy
16+
cd ../next.js/
17+
node run-tests.js --type e2e --debug --test-pattern $1

tests/netlify-e2e.json

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{
2+
"version": 2,
3+
"suites": {
4+
"test/e2e/app-dir/app-static/app-static.test.ts": {
5+
"failed": [
6+
"app-dir static/dynamic handling usePathname should have values from canonical url on rewrite",
7+
"app-dir static/dynamic handling should have correct prerender-manifest entries",
8+
"app-dir static/dynamic handling should output HTML/RSC files for static paths",
9+
"app-dir static/dynamic handling should output debug info for static bailouts"
10+
]
11+
},
12+
"test/e2e/app-dir/app-client-cache/client-cache.test.ts": {
13+
"failed": [
14+
"app dir client cache semantics prefetch={undefined} - default should re-use the full cache for only 30 seconds",
15+
"app dir client cache semantics prefetch={undefined} - default should refetch below the fold after 30 seconds"
16+
]
17+
},
18+
"test/e2e/app-dir/headers-static-bailout/headers-static-bailout.test.ts": {
19+
"failed": [
20+
"headers-static-bailout it provides a helpful link in case static generation bailout is uncaught"
21+
]
22+
},
23+
"test/e2e/app-dir/parallel-routes-and-interception/parallel-routes-and-interception.test.ts": {
24+
"failed": [
25+
"parallel-routes-and-interception route intercepting should render modal when paired with parallel routes",
26+
"parallel-routes-and-interception route intercepting should support intercepting local dynamic sibling routes"
27+
]
28+
},
29+
"test/e2e/app-dir/error-boundary-navigation/override-node-env.test.ts": {
30+
"failed": [
31+
"app dir - not found navigation - with overridden node env should be able to navigate to other page from root not-found page"
32+
]
33+
},
34+
"test/e2e/opentelemetry/opentelemetry.test.ts": {
35+
"failed": [
36+
"opentelemetry root context app router should handle RSC with fetch",
37+
"opentelemetry incoming context propagation app router should handle RSC with fetch",
38+
"opentelemetry incoming context propagation app router should handle route handlers in app router"
39+
]
40+
},
41+
"test/e2e/app-dir/rsc-basic/rsc-basic.test.ts": {
42+
"failed": [
43+
"app dir - rsc basics should render initial styles of css-in-js in edge SSR correctly",
44+
"app dir - rsc basics should render initial styles of css-in-js in nodejs SSR correctly",
45+
"app dir - rsc basics should render server components correctly"
46+
],
47+
"flakey": [
48+
"app dir - rsc basics react@experimental should opt into the react@experimental when enabling ppr",
49+
"app dir - rsc basics react@experimental should opt into the react@experimental when enabling taint"
50+
]
51+
},
52+
"test/e2e/app-dir/navigation/navigation.test.ts": {
53+
"failed": [
54+
"app dir - navigation redirect status code should respond with 308 status code if permanent flag is set",
55+
"app dir - navigation redirect status code should respond with 307 status code in client component",
56+
"app dir - navigation redirect status code should respond with 307 status code in server component",
57+
"app dir - navigation bots should block rendering for bots and return 404 status",
58+
"app dir - navigation navigation between pages and app should not continously initiate a mpa navigation to the same URL when router state changes"
59+
]
60+
},
61+
"test/e2e/app-dir/app-static/app-static-custom-handler.test.ts": {
62+
"failed": [
63+
"app-dir static/dynamic handling should output debug info for static bailouts",
64+
"app-dir static/dynamic handling should have correct prerender-manifest entries",
65+
"app-dir static/dynamic handling should output HTML/RSC files for static paths"
66+
]
67+
},
68+
"test/production/app-dir/unexpected-error/unexpected-error.test.ts": {
69+
"failed": [
70+
"unexpected-error should set response status to 500 for unexpected errors in ssr app route",
71+
"unexpected-error should set response status to 500 for unexpected errors in isr app route"
72+
]
73+
},
74+
"test/e2e/skip-trailing-slash-redirect/index.test.ts": {
75+
"flakey": [
76+
"skip-trailing-slash-redirect should merge cookies from middleware and edge API routes correctly",
77+
"skip-trailing-slash-redirect should handle external rewrite correctly /chained-rewrite-ssr",
78+
"skip-trailing-slash-redirect should handle external rewrite correctly /chained-rewrite-static",
79+
"skip-trailing-slash-redirect should handle external rewrite correctly /chained-rewrite-ssg"
80+
]
81+
},
82+
"test/e2e/module-layer/index.test.ts": {
83+
"flakey": [
84+
"module layer no server-only in server targets should render routes marked with restriction marks without errors",
85+
"module layer with server-only in server targets should render routes marked with restriction marks without errors"
86+
]
87+
},
88+
"test/e2e/getserversideprops/test/index.test.ts": {
89+
"flakey": [
90+
"getServerSideProps should set default caching header",
91+
"getServerSideProps should respect custom caching header"
92+
]
93+
},
94+
"test/e2e/app-dir/metadata-dynamic-routes/index.test.ts": {
95+
"pending": [],
96+
"flakey": [
97+
"app dir - metadata dynamic routes text routes should handle robots.[ext] dynamic routes",
98+
"app dir - metadata dynamic routes text routes should handle sitemap.[ext] dynamic routes",
99+
"app dir - metadata dynamic routes social image routes should handle manifest.[ext] dynamic routes",
100+
"app dir - metadata dynamic routes social image routes should render og image with opengraph-image dynamic routes",
101+
"app dir - metadata dynamic routes social image routes should render og image with twitter-image dynamic routes",
102+
"app dir - metadata dynamic routes icon image routes should render icon with dynamic routes",
103+
"app dir - metadata dynamic routes icon image routes should render apple icon with dynamic routes",
104+
"app dir - metadata dynamic routes should inject dynamic metadata properly to head"
105+
]
106+
},
107+
"test/e2e/app-dir/metadata/metadata.test.ts": {
108+
"flakey": [
109+
"app dir - metadata opengraph should pick up opengraph-image and twitter-image as static metadata files",
110+
"app dir - metadata static routes should have /favicon.ico as route"
111+
]
112+
}
113+
},
114+
"rules": {
115+
"include": ["test/e2e/**/*.test.{t,j}s{,x}"],
116+
"exclude": [
117+
"test/e2e/app-dir/next-font/**/*",
118+
"test/e2e/app-dir/ppr/**/*",
119+
"test/e2e/app-dir/ppr-*/**/*",
120+
"test/e2e/app-dir/app-prefetch*/**/*",
121+
"test/e2e/app-dir/app-esm-js/index.test.ts",
122+
"test/e2e/app-dir/interception-middleware-rewrite/interception-middleware-rewrite.test.ts",
123+
"test/e2e/app-dir/searchparams-static-bailout/searchparams-static-bailout.test.ts",
124+
"test/e2e/app-dir/app-compilation/index.test.ts",
125+
"test/e2e/cancel-request/stream-cancel.test.ts",
126+
"test/e2e/favicon-short-circuit/favicon-short-circuit.test.ts",
127+
"test/e2e/edge-pages-support/edge-document.test.ts",
128+
"test/e2e/third-parties/index.test.ts",
129+
"test/e2e/swc-warnings/index.test.ts",
130+
"test/e2e/app-dir/externals/externals.test.ts",
131+
"test/e2e/app-dir/use-selected-layout-segment-s/use-selected-layout-segment-s.test.ts",
132+
"test/e2e/repeated-forward-slashes-error/repeated-forward-slashes-error.test.ts",
133+
"test/e2e/app-dir/with-exported-function-config/with-exported-function-config.test.ts",
134+
"test/e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts",
135+
"test/e2e/app-dir/third-parties/basic.test.ts"
136+
]
137+
}
138+
}

0 commit comments

Comments
 (0)