Skip to content

Commit dfeb667

Browse files
taty2010serhalp
andauthored
chore: map gh issues to failures (#532)
* gh issues to failure list * add token * add based on file name or test name * add comments * Update tools/deno/ghIssues2json.ts Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com> * return empty arr if no match * allow for multi test names * add schedule * fix multi name setup * Update tools/deno/ghIssues2json.ts Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com> * Update tools/deno/ghIssues2json.ts Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com> * chore: format with prettier --------- Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com> Co-authored-by: taty2010 <taty2010@users.noreply.github.com>
1 parent 9278d6e commit dfeb667

File tree

5 files changed

+49
-191
lines changed

5 files changed

+49
-191
lines changed

.github/workflows/e2e-report.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: 'Deploy e2e test page'
22
on:
3+
schedule:
4+
- cron: '0 3 * * 3' # Run every Wednesday at 3am UTC
35
workflow_dispatch:
46
inputs:
57
use-branch:

.github/workflows/test-e2e.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ env:
3838
NEXT_TEST_CONTINUE_ON_ERROR: 1
3939
next-path: next.js
4040
runtime-path: next-runtime-minimal
41+
GH_TOKEN: ${{ github.token }}
4142
jobs:
4243
setup:
4344
runs-on: ubuntu-latest
@@ -237,6 +238,12 @@ jobs:
237238
pattern: test-result-${{matrix.version_spec.selector}}-*
238239
path: artifacts
239240

241+
- name: Get and format Github issues
242+
if: success() || failure()
243+
run: |
244+
gh issue list --label "Next.js e2e test failure" --json number,body > report/issues.json
245+
deno run -A tools/deno/ghIssues2json.ts tests/test-config.json report/issues.json
246+
240247
- name: Publish Test Report
241248
id: publish-test-results
242249
if: success() || failure()

tests/test-config.json

Lines changed: 0 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -338,195 +338,5 @@
338338
"reason": "Test is incompatible with serverless because it relies on shared state between requests",
339339
"tests": ["should refresh the correct page when a server action triggers a redirect"]
340340
}
341-
],
342-
"failures": [
343-
{
344-
"name": "Middleware Runtime without i18n should trigger middleware for data requests",
345-
"reason": "Requests for page data on pages router sites with middleware return HTML unless x-nextjs-data header is set",
346-
"link": "https://github.com/netlify/next-runtime-minimal/issues/380"
347-
},
348-
{
349-
"name": "Middleware Runtime with i18n should trigger middleware for data requests",
350-
"reason": "Requests for page data on pages router sites with middleware return HTML unless x-nextjs-data header is set",
351-
"link": "https://github.com/netlify/next-runtime-minimal/issues/380"
352-
},
353-
{
354-
"name": "app dir - basic bootstrap scripts should successfully bootstrap even when using CSP",
355-
"reason": "Nonce not automatically set in script tags when using CSP",
356-
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
357-
},
358-
{
359-
"name": "app dir - basic next/script should pass `nonce`",
360-
"reason": "Nonce not automatically set in script tags when using CSP",
361-
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
362-
},
363-
{
364-
"name": "app dir - basic next/script should pass nonce when using next/font",
365-
"reason": "Nonce not automatically set in script tags when using CSP",
366-
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
367-
},
368-
{
369-
"name": "Middleware Runtime with i18n should validate & parse request url from a dynamic route with params",
370-
"reason": "Middleware in sites with i18n generating incorrect request.url pathname",
371-
"link": "https://github.com/netlify/next-runtime-minimal/issues/382"
372-
},
373-
{
374-
"name": "Middleware Runtime with i18n should validate & parse request url from a dynamic route with params and no query",
375-
"reason": "Middleware in sites with i18n generating incorrect request.url pathname",
376-
"link": "https://github.com/netlify/next-runtime-minimal/issues/382"
377-
},
378-
{
379-
"name": "i18n-ignore-rewrite-source-locale with basepath get public file by skipping locale in rewrite, locale: ",
380-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
381-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
382-
},
383-
{
384-
"name": "i18n-ignore-rewrite-source-locale with basepath get public file by skipping locale in rewrite, locale: /en",
385-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
386-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
387-
},
388-
{
389-
"name": "i18n-ignore-rewrite-source-locale with basepath get public file by skipping locale in rewrite, locale: /nl",
390-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
391-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
392-
},
393-
{
394-
"name": "i18n-ignore-rewrite-source-locale with basepath get public file by skipping locale in rewrite, locale: /sv",
395-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
396-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
397-
},
398-
{
399-
"name": "i18n-ignore-rewrite-source-locale get public file by skipping locale in rewrite, locale: ",
400-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
401-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
402-
},
403-
{
404-
"name": "i18n-ignore-rewrite-source-locale get public file by skipping locale in rewrite, locale: /en",
405-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
406-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
407-
},
408-
{
409-
"name": "i18n-ignore-rewrite-source-locale get public file by skipping locale in rewrite, locale: /nl",
410-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
411-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
412-
},
413-
{
414-
"name": "i18n-ignore-rewrite-source-locale get public file by skipping locale in rewrite, locale: /sv",
415-
"reason": "Middleware on sites with i18n cannot rewrite to static files",
416-
"link": "https://github.com/netlify/next-runtime-minimal/issues/383"
417-
},
418-
{
419-
"name": "Middleware Runtime trailing slash should keep non data requests in their original shape",
420-
"reason": "Middleware should not add trailing slashes to non-data requests in static dir",
421-
"link": "https://github.com/netlify/next-runtime-minimal/issues/385"
422-
},
423-
{
424-
"name": "Middleware Redirect should implement internal redirects",
425-
"reason": "Pages router middleware should return 302 status for redirected data requests",
426-
"link": "https://github.com/netlify/next-runtime-minimal/issues/386"
427-
},
428-
{
429-
"name": "Middleware Redirect /fr should implement internal redirects",
430-
"reason": "Pages router middleware should return 302 status for redirected data requests",
431-
"link": "https://github.com/netlify/next-runtime-minimal/issues/386"
432-
},
433-
{
434-
"name": "Middleware Redirect should redirect to api route with locale",
435-
"reason": "Pages router middleware should return 302 status for redirected data requests",
436-
"link": "https://github.com/netlify/next-runtime-minimal/issues/386"
437-
},
438-
{
439-
"name": "Middleware Redirect /fr should redirect to api route with locale",
440-
"reason": "Pages router middleware should return 302 status for redirected data requests",
441-
"link": "https://github.com/netlify/next-runtime-minimal/issues/386"
442-
},
443-
{
444-
"name": "getServerSideProps should handle throw ENOENT correctly",
445-
"reason": "Server error pages return encoded data without content-encoding header if accept-encoding is gzip",
446-
"link": "https://github.com/netlify/next-runtime-minimal/issues/387"
447-
},
448-
{
449-
"name": "app-custom-routes works with generateStaticParams correctly responds correctly on /static/three/data.json",
450-
"reason": "First request for generateStaticParams fallback route handler returns base64-encoded content",
451-
"link": "https://github.com/netlify/next-runtime-minimal/issues/388"
452-
},
453-
{
454-
"name": "app-custom-routes works with generateStaticParams correctly revalidates correctly on /revalidate-1/three/data.json",
455-
"reason": "First request for generateStaticParams fallback route handler returns base64-encoded content",
456-
"link": "https://github.com/netlify/next-runtime-minimal/issues/388"
457-
},
458-
{
459-
"name": "app-dir action handling fetch actions should store revalidation data in the prefetch cache",
460-
"reason": "Fetch action prefetch cache test is flakey",
461-
"link": "https://github.com/netlify/next-runtime-minimal/issues/444"
462-
},
463-
{
464-
"name": "parallel-routes-and-interception parallel routes should support parallel route tab bars",
465-
"reason": "Some parallel routes returning 404",
466-
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
467-
},
468-
{
469-
"name": "parallel-routes-and-interception parallel routes should throw a 404 when no matching parallel route is found",
470-
"reason": "Some parallel routes returning 404",
471-
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
472-
},
473-
{
474-
"name": "parallel-routes-and-interception parallel routes should only scroll to the parallel route that was navigated to",
475-
"reason": "Some parallel routes returning 404",
476-
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
477-
},
478-
{
479-
"name": "Middleware Responses should respond appending headers headers",
480-
"reason": "Appending set-cookie header in middleware leads to duplicate header",
481-
"link": "https://github.com/netlify/next-runtime-minimal/issues/447"
482-
},
483-
{
484-
"name": "Middleware Responses /fr should respond appending headers headers",
485-
"reason": "Appending set-cookie header in middleware leads to duplicate header",
486-
"link": "https://github.com/netlify/next-runtime-minimal/issues/447"
487-
},
488-
{
489-
"name": "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-path",
490-
"reason": "Not a fail: race condition when testing revalidation"
491-
},
492-
{
493-
"name": "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-tag",
494-
"reason": "Not a fail: race condition when testing revalidation"
495-
},
496-
{
497-
"name": "Middleware base tests router.query must exist when Link clicked page routing",
498-
"reason": "Pages router data requests returning 404 when middleware is used",
499-
"link": "https://github.com/netlify/next-runtime-minimal/issues/450"
500-
},
501-
{
502-
"name": "Middleware Rewrite should handle catch-all rewrite correctly",
503-
"reason": "TODO: correct behaviour is unclear. See link for implementation",
504-
"link": "https://github.com/vercel/next.js/pull/63254"
505-
},
506-
{
507-
"name": "Middleware Rewrite should allow to rewrite keeping the locale in pathname",
508-
"reason": "Middleware rewrites should keep the locale in the pathname",
509-
"link": "https://github.com/netlify/next-runtime-minimal/issues/451"
510-
},
511-
{
512-
"name": "parallel-routes-revalidation should submit the action and revalidate the page data",
513-
"reason": "Parallel route revalidation actions are intermittently failing",
514-
"link": "https://github.com/netlify/next-runtime-minimal/issues/452"
515-
},
516-
{
517-
"name": "Middleware custom matchers i18n should not match",
518-
"reason": "Middleware matching is too broad when using i18n",
519-
"link": "https://github.com/netlify/next-runtime-minimal/issues/453"
520-
},
521-
{
522-
"name": "using a single matcher with i18n and basePath adds the header for a matched path",
523-
"reason": "Middleware does not match when using basePath and default locale",
524-
"link": "https://github.com/netlify/next-runtime-minimal/issues/454"
525-
},
526-
{
527-
"name": "using a single matcher with i18n and basePath and trailingSlash adds the header for a matched path",
528-
"reason": "Middleware does not match when using basePath and default locale",
529-
"link": "https://github.com/netlify/next-runtime-minimal/issues/454"
530-
}
531341
]
532342
}

tools/deno/ghIssues2json.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
interface Annotation {
2+
link: string
3+
name: string
4+
reason: string
5+
}
6+
7+
async function writeToConfig(
8+
filePath: string,
9+
failures: { link: string; name: string; reason: string }[],
10+
) {
11+
const testConfig = JSON.parse(await Deno.readTextFile(filePath))
12+
testConfig.failures = failures
13+
await Deno.writeTextFile(filePath, JSON.stringify(testConfig))
14+
}
15+
16+
async function formatIssues(file: string) {
17+
const issues = JSON.parse(await Deno.readTextFile(file))
18+
const annotations: Annotation[] = []
19+
20+
issues.forEach((issue: { body: string; number: number }) => {
21+
const name = issue.body.match(/^test: (.+)$/m) || []
22+
const reason = issue.body.match(/^reason: (.+)$/m) || []
23+
const testNames = name[1]?.split(',')
24+
25+
testNames?.forEach((name) => {
26+
annotations.push({
27+
link: `https://github.com/netlify/next-runtime-minimal/issues/${issue.number}`,
28+
reason: reason[1],
29+
name: name.trim(),
30+
})
31+
})
32+
})
33+
34+
writeToConfig(Deno.args[0], annotations)
35+
}
36+
37+
formatIssues(Deno.args[1])

tools/deno/junit2json.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ function junitToJson(xmlData: {
109109
status,
110110
}
111111
if (status === 'failed') {
112-
const failure = testConfig.failures.find((conf) => conf.name === test.name)
112+
const failure = testConfig.failures.find(
113+
(conf) => conf.name === test.name || conf.name === testSuite.file,
114+
)
113115
if (failure) {
114116
test.reason = failure.reason
115117
test.link = failure.link

0 commit comments

Comments
 (0)