Skip to content

Commit ae04253

Browse files
committed
im tried boss
1 parent a62a2f3 commit ae04253

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

playground/src/RootLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ export function RootLayout() {
9494
<h1><a href="https://rbby.dev/gnata-sqlite/" style={{ color: 'inherit', textDecoration: 'none' }}><span>gnata-sqlite</span></a></h1>
9595
<div className="mode-tabs">
9696
<Link
97-
to="/sqlite"
97+
to="/sqlite/"
9898
className={'mode-tab' + (mode === 'sqlite' ? ' active' : '')}
9999
>
100100
SQLite
101101
</Link>
102102
<Link
103-
to="/gnata"
103+
to="/gnata/"
104104
className={'mode-tab' + (mode === 'gnata' ? ' active' : '')}
105105
>
106106
gnata

playground/test-prod.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
import { chromium } from '@playwright/test';
3+
4+
const LOCAL = 'http://localhost:5173';
5+
const REMOTE = 'https://rbby.dev/gnata-sqlite/playground';
6+
const ROUTES = ['/sqlite', '/gnata'];
7+
8+
async function test(base, label) {
9+
const browser = await chromium.launch();
10+
const page = await browser.newPage();
11+
const errors = [];
12+
page.on('pageerror', e => errors.push(e.message));
13+
page.on('response', r => { if (r.status() >= 400) errors.push(`[${r.status()}] ${r.url()}`); });
14+
15+
for (const route of ROUTES) {
16+
const url = base + route;
17+
try {
18+
await page.goto(url, { waitUntil: 'load', timeout: 20000 });
19+
await page.waitForTimeout(4000);
20+
} catch (e) {
21+
errors.push(`[navigate] ${url}: ${e.message}`);
22+
}
23+
}
24+
await browser.close();
25+
const pass = errors.length === 0;
26+
console.log(`${pass ? 'PASS' : 'FAIL'} ${label} (${errors.length} errors)`);
27+
if (!pass) errors.forEach(e => console.log(` - ${e}`));
28+
return pass;
29+
}
30+
31+
const target = process.argv[2] || 'remote';
32+
let ok = true;
33+
if (target === 'local' || target === 'both') ok = await test(LOCAL, 'LOCAL') && ok;
34+
if (target === 'remote' || target === 'both') ok = await test(REMOTE, 'REMOTE') && ok;
35+
process.exit(ok ? 0 : 1);

0 commit comments

Comments
 (0)