Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

screenshot-app-next + webhooks-replicate test tweaks

nirholas11bb97cfce40
diff --git a/scripts/_snap-modals.tmp.mjs b/scripts/_snap-modals.tmp.mjs
deleted file mode 100644
index 1e07ac61f..000000000
--- a/scripts/_snap-modals.tmp.mjs
+++ /dev/null
@@ -1,63 +0,0 @@
-import { chromium } from 'playwright';
-import { readFile } from 'node:fs/promises';
-
-const glb = await readFile('/workspaces/three.ws/public/avatars/default.glb');
-const browser = await chromium.launch();
-const ctx = await browser.newContext({ viewport: { width: 1440, height: 1100 }, deviceScaleFactor: 2 });
-const page = await ctx.newPage();
-page.on('pageerror', (e) => console.error('PE:', e.message));
-
-const b64 = Buffer.from(glb).toString('base64');
-await page.addInitScript((b64) => {
- if (location.pathname !== '/create-review') return;
- window.__seed = (async () => {
- const bin = atob(b64), bytes = new Uint8Array(bin.length);
- for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
- const blob = new Blob([bytes], { type: 'model/gltf-binary' });
- const id = '19b160abcdef';
- const db = await new Promise((res, rej) => {
- const r = indexedDB.open('three-ws-guest', 1);
- r.onupgradeneeded = () => { if (!r.result.objectStoreNames.contains('avatars')) r.result.createObjectStore('avatars'); };
- r.onsuccess = () => res(r.result); r.onerror = () => rej(r.error);
- });
- await new Promise((res, rej) => {
- const tx = db.transaction('avatars', 'readwrite');
- tx.objectStore('avatars').put({ blob, meta: { source: 'avaturn' }, id, name: `Avatar #${id.slice(0,6)}`, size: blob.size, createdAt: Date.now() }, 'pending');
- tx.oncomplete = res; tx.onerror = () => rej(tx.error);
- });
- db.close();
- return true;
- })();
-}, b64);
-
-await page.goto('http://localhost:3000/create-review', { waitUntil: 'load' });
-try { await page.evaluate(() => window.__seed); } catch {}
-await page.waitForTimeout(1500);
-await page.reload({ waitUntil: 'load' });
-
-await page.waitForSelector('#mv-container canvas', { timeout: 20000 });
-await page.waitForFunction(() => document.getElementById('viewer-loading')?.classList.contains('is-hidden'));
-await page.waitForTimeout(3500);
-
-await page.fill('#f-name', 'Nicholas');
-
-async function shot(feat, file, dwell = 700) {
- await page.click(`[data-feature="${feat}"]`);
- await page.waitForSelector('.fm-backdrop');
- await page.waitForTimeout(dwell);
- const b = await page.locator('.fm-dialog').boundingBox();
- await page.screenshot({ path: file, clip: { x: Math.max(0, b.x - 24), y: Math.max(0, b.y - 24), width: b.width + 48, height: b.height + 48 } });
- await page.keyboard.press('Escape');
- await page.waitForSelector('.fm-backdrop', { state: 'detached' });
-}
-
-await shot('identity', '/tmp/cr-final-identity.png', 1000);
-await shot('paid', '/tmp/cr-final-paid.png');
-await shot('embed', '/tmp/cr-final-embed.png', 1000);
-await shot('reputation', '/tmp/cr-final-reputation.png');
-await shot('download', '/tmp/cr-final-download.png');
-
-await page.screenshot({ path: '/tmp/cr-final-page.png' });
-
-await browser.close();
-console.log('saved');
diff --git a/scripts/screenshot-app-next.mjs b/scripts/screenshot-app-next.mjs
index 60a295d3b..831175373 100644
--- a/scripts/screenshot-app-next.mjs
+++ b/scripts/screenshot-app-next.mjs
@@ -5,9 +5,11 @@ const browser = await chromium.launch({
});
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
-page.on('pageerror', (e) => console.log('PAGEERROR:', e.message.slice(0, 200)));
+page.on('pageerror', (e) => console.log('PAGEERROR:', e.message.slice(0, 400), '\n', (e.stack || '').slice(0, 400)));
page.on('console', (m) => {
- if (m.type() === 'error') console.log('[err]', m.text().slice(0, 200));
+ const t = m.type();
+ if (t === 'error') console.log('[err]', m.text().slice(0, 300));
+ else if (t === 'warning') console.log('[warn]', m.text().slice(0, 200));
});
const baseUrl = process.argv[2] || 'http://localhost:3000/app-next';
diff --git a/tests/api/webhooks-replicate.test.js b/tests/api/webhooks-replicate.test.js
index b70ebdd57..1cf410a16 100644
--- a/tests/api/webhooks-replicate.test.js
+++ b/tests/api/webhooks-replicate.test.js
@@ -3,7 +3,7 @@
// public endpoint that mutates avatar_regen_jobs rows, so signature handling
// is the highest-priority thing to test.
-import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { createHmac, randomUUID } from 'node:crypto';
import { Readable } from 'node:stream';
@@ -118,8 +118,9 @@ beforeEach(() => {
else process.env.REPLICATE_WEBHOOK_SIGNING_KEY = ORIGINAL_SIGNING_KEY;
});
-afterEach();
-function afterEach() { /* placeholder to keep linter calm */ }
+afterEach(() => {
+ globalThis.fetch = ORIGINAL_FETCH;
+});
describe('POST /api/webhooks/replicate', () => {
it('accepts unsigned webhook when no signing key is configured (dev)', async () => {