Skip to content

Commit cf3bb44

Browse files
eladrozserhalp
andauthored
chore: streamline E2E report (#2489)
* Streamline & simplify E2E report * chore: format with prettier * chore: SVG badge, responsive design, data util * chore: format with prettier * chore: add copy badge button * chore: badge - consts, smaller, get host name * chore: review notes + tweaks * nicer shortening of long test names/reasons * show tooltip for long text * Update stats.js --------- Co-authored-by: Philippe Serhal <[email protected]>
1 parent 98ebf2c commit cf3bb44

29 files changed

+1497
-4009
lines changed

Diff for: e2e-report/app/badge/route.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { ImageResponse } from 'next/og'
2+
import testData from '@/utils/data'
3+
import { badgeSettings, badgeSize } from '@/utils/consts'
4+
5+
export const dynamic = 'force-static'
6+
7+
const labelStyle = {
8+
background: 'linear-gradient(#2e51ed, #316bf4)',
9+
color: 'white',
10+
}
11+
12+
const bgStyles = {
13+
ok: { background: 'linear-gradient(to bottom, #22c55e, #86efac)' },
14+
warning: { background: 'linear-gradient(to bottom, #ca8a04, #fef08a)' },
15+
error: { background: 'linear-gradient(to bottom, #dc2626, #f87171)', color: 'white' },
16+
}
17+
18+
// Generate an SVG badge with test status and target Next.js version
19+
export async function GET(request) {
20+
const valueStyle =
21+
bgStyles[testData.failed === 0 ? 'ok' : testData.unknownFailuresCount > 0 ? 'error' : 'warning']
22+
23+
const badge = (
24+
<Badge
25+
label={badgeSettings.label}
26+
labelStyle={labelStyle}
27+
value={testData.nextVersion}
28+
valueStyle={valueStyle}
29+
/>
30+
)
31+
return new ImageResponse(badge, {
32+
...badgeSettings.imageSize,
33+
})
34+
}
35+
36+
function Badge({ label, labelStyle, value, valueStyle }) {
37+
return (
38+
<div tw="flex items-center w-full h-full text-[26px] rounded-md overflow-hidden bg-transparent">
39+
<span tw="items-center h-full p-3.5" style={labelStyle}>
40+
{label}
41+
</span>
42+
<span tw="items-center h-full flex-grow justify-center" style={valueStyle}>
43+
{value}
44+
</span>
45+
</div>
46+
)
47+
}

Diff for: e2e-report/app/globals.css

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
@layer base {
6+
@font-face {
7+
font-family: Mulish;
8+
src: url(/MulishVar-latin.woff2) format('woff2');
9+
unicode-range: U+5, U+20, U+21, U+24, U+25, U+26, U+27, U+2B-2E, U+30-3A, U+3F, U+41-5A, U+61-7A,
10+
U+D7, U+2019, U+201C, U+201D;
11+
font-weight: 200 900;
12+
font-display: swap;
13+
}
14+
}
15+
16+
@layer components {
17+
.table.issues-table :where(td) {
18+
@apply py-1.5;
19+
}
20+
21+
.table.issues-table :where(td:nth-last-child(-n + 4)) {
22+
@apply text-center p-1 md:p-4;
23+
}
24+
25+
.table.issues-table :where(td:nth-last-child(-n + 3)) {
26+
@apply text-neutral-content;
27+
}
28+
29+
.stat-value {
30+
@apply font-bold;
31+
@apply text-3xl;
32+
}
33+
}

0 commit comments

Comments
 (0)