Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: streamline E2E report #2489

Merged
merged 10 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions e2e-report/app/badge/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ImageResponse } from 'next/og'
import testData from '@/utils/data'
import { badgeSettings, badgeSize } from '@/utils/consts'

export const dynamic = 'force-static'

const labelStyle = {
background: 'linear-gradient(#2e51ed, #316bf4)',
color: 'white',
}

const bgStyles = {
ok: { background: 'linear-gradient(to bottom, #22c55e, #86efac)' },
warning: { background: 'linear-gradient(to bottom, #ca8a04, #fef08a)' },
error: { background: 'linear-gradient(to bottom, #dc2626, #f87171)', color: 'white' },
}

// Generate an SVG badge with test status and target Next.js version
export async function GET(request) {
const valueStyle =
bgStyles[testData.failed === 0 ? 'ok' : testData.unknownFailuresCount > 0 ? 'error' : 'warning']

const badge = (
<Badge
label={badgeSettings.label}
labelStyle={labelStyle}
value={testData.nextVersion}
valueStyle={valueStyle}
/>
)
return new ImageResponse(badge, {
...badgeSettings.imageSize,
})
}

function Badge({ label, labelStyle, value, valueStyle }) {
return (
<div tw="flex items-center w-full h-full text-[26px] rounded-md overflow-hidden bg-transparent">
<span tw="items-center h-full p-3.5" style={labelStyle}>
{label}
</span>
<span tw="items-center h-full flex-grow justify-center" style={valueStyle}>
{value}
</span>
</div>
)
}
33 changes: 33 additions & 0 deletions e2e-report/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
@font-face {
font-family: Mulish;
src: url(/MulishVar-latin.woff2) format('woff2');
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,
U+D7, U+2019, U+201C, U+201D;
font-weight: 200 900;
font-display: swap;
}
}

@layer components {
.table.issues-table :where(td) {
@apply py-1.5;
}

.table.issues-table :where(td:nth-last-child(-n + 4)) {
@apply text-center p-1 md:p-4;
}

.table.issues-table :where(td:nth-last-child(-n + 3)) {
@apply text-neutral-content;
}

.stat-value {
@apply font-bold;
@apply text-3xl;
}
}
Loading
Loading