Elffuss BraidHub

utopia-ia/elffuss-code public

Tests: run against the tree they live in

- reanuda.mjs served web/ from a fixed path to another checkout of the repo,
  imported Playwright from another project and launched the installed Chrome:
  it never tested the model-store.js next to it. It serves its own tree's web/
  and uses the tests' own Playwright.
- edit-bateria, goalfail, retry-test and run-bateria could only run against
  production. They still default to it, and take BASE=<url> to run against a
  local tree before a deploy.
Changeset178a8a01c6e95d3fe6bf2fa3e23ca75c7c691536bfbc6efe0fe44ee70ae605f9
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00
Parents144b741f2d62

Browse the files at this changeset

5 files changed

modified tests/edit-bateria.mjs +3 −1
@@ -113,7 +113,9 @@
113113
114114 const b = await chromium.launch({ channel: 'chrome', headless: true });
115115 const p = await (await b.newContext()).newPage();
116-await p.goto('https://code.elffuss.com/', { waitUntil: 'domcontentloaded' });
116+// Por defecto contra producción, como siempre; BASE=… la corre contra otro
117+// servidor (un árbol local), que es lo que hace falta antes de desplegar.
118+await p.goto((process.env.BASE || 'https://code.elffuss.com') + '/', { waitUntil: 'domcontentloaded' });
117119 await p.waitForTimeout(1200);
118120
119121 const res = await p.evaluate(async (CASOS) => {
modified tests/goalfail.mjs +3 −1
@@ -4,7 +4,9 @@
44 const b = await chromium.launch({ channel: 'chrome', headless: true });
55 const p = await (await b.newContext()).newPage();
66 const errs = []; p.on('pageerror', e => errs.push(e.message.slice(0, 80)));
7-await p.goto('https://code.elffuss.com/', { waitUntil: 'domcontentloaded' });
7+// Por defecto contra producción, como siempre; BASE=… la corre contra otro
8+// servidor (un árbol local), que es lo que hace falta antes de desplegar.
9+await p.goto((process.env.BASE || 'https://code.elffuss.com') + '/', { waitUntil: 'domcontentloaded' });
810 await p.waitForTimeout(1500);
911
1012 const r = await p.evaluate(async () => {
modified tests/reanuda.mjs +12 −11
@@ -14,10 +14,12 @@
1414 // Se usa un fichero pequeño servido en local, no el modelo de 7 GB: lo que se
1515 // prueba es la lógica de reanudación, y para eso da igual el tamaño.
1616 import { createServer } from 'node:http';
17-import { existsSync, readFileSync, writeFileSync, mkdtempSync } from 'node:fs';
18-import { join } from 'node:path';
19-import { homedir, tmpdir } from 'node:os';
17+import { existsSync, readFileSync, mkdtempSync } from 'node:fs';
18+import { join, dirname } from 'node:path';
19+import { tmpdir } from 'node:os';
20+import { fileURLToPath } from 'node:url';
2021 import { createHash } from 'node:crypto';
22+import { chromium } from 'playwright';
2123
2224 let fails = 0;
2325 const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; };
@@ -69,8 +71,10 @@
6971 const BASE = `http://127.0.0.1:${PUERTO}`;
7072
7173 // La página tiene que servirse por HTTP para tener OPFS: se sirve desde el
72-// mismo servidor una página mínima que importa el almacén de verdad.
73-const RAIZ = join(homedir(), 'work2026/elffuss-code/web');
74+// mismo servidor una página mínima que importa el almacén de verdad — el de
75+// ESTE árbol. Antes se servía una ruta fija a otra copia del repo, así que la
76+// prueba no probaba el model-store.js que tenía al lado.
77+const RAIZ = join(dirname(fileURLToPath(import.meta.url)), '..', 'web');
7478 const srv2 = createServer((req, res) => {
7579 const ruta = req.url.split('?')[0];
7680 if (ruta === '/') {
@@ -85,13 +89,10 @@
8589 await new Promise(r => srv2.listen(0, '127.0.0.1', r));
8690 const APP = `http://127.0.0.1:${srv2.address().port}`;
8791
88-const rutas = [join(homedir(), 'work2026/elffuss-claw/tests/node_modules/playwright-core/index.mjs'),
89- join(homedir(), '.claude/skills/browser-post/node_modules/playwright-core/index.mjs')];
90-const { chromium } = await import(rutas.find(existsSync));
92+// Playwright y su navegador, los de estas pruebas (antes se buscaban en otros
93+// proyectos y se lanzaba el Chrome instalado).
9194 const perfil = mkdtempSync(join(tmpdir(), 'reanuda-'));
92-const ctx = await chromium.launchPersistentContext(perfil, {
93- channel: 'chrome', ignoreDefaultArgs: ['--use-mock-keychain'],
94-});
95+const ctx = await chromium.launchPersistentContext(perfil, {});
9596 const p = await ctx.newPage();
9697 p.on('pageerror', e => console.log('· PAGEERROR: ' + e.message.slice(0, 120)));
9798
modified tests/retry-test.mjs +3 −1
@@ -4,7 +4,9 @@
44 import { chromium } from 'playwright';
55 const b = await chromium.launch({ channel: 'chrome', headless: true });
66 const p = await (await b.newContext()).newPage();
7-await p.goto('https://code.elffuss.com/', { waitUntil: 'domcontentloaded' });
7+// Por defecto contra producción, como siempre; BASE=… la corre contra otro
8+// servidor (un árbol local), que es lo que hace falta antes de desplegar.
9+await p.goto((process.env.BASE || 'https://code.elffuss.com') + '/', { waitUntil: 'domcontentloaded' });
810 await p.waitForTimeout(1200);
911 const r = await p.evaluate(async () => {
1012 const { Agent } = await import('/js/agent.js?v=' + Date.now());
modified tests/run-bateria.mjs +3 −1
@@ -56,7 +56,9 @@
5656
5757 const b = await chromium.launch({ channel: 'chrome', headless: true });
5858 const p = await (await b.newContext()).newPage();
59-await p.goto('https://code.elffuss.com/', { waitUntil: 'domcontentloaded' });
59+// Por defecto contra producción, como siempre; BASE=… la corre contra otro
60+// servidor (un árbol local), que es lo que hace falta antes de desplegar.
61+await p.goto((process.env.BASE || 'https://code.elffuss.com') + '/', { waitUntil: 'domcontentloaded' });
6062 await p.waitForTimeout(1200);
6163
6264 const res = await p.evaluate(async (CASOS) => {