v0.7.2 Package Runners + CI Gate

Five package-level test runners validating extension API contracts:
- notes-runner: CRUD, folders, tags, search, backlinks (12 tests)
- chat-runner: conversations, messaging, search (9 tests)
- schedules-runner: CRUD + run (5 tests)
- workflow-runner: definitions, instances, stage progression (5 tests)
- renderer-runner: registry contract, block matching (4 tests)

Runner Result API (in-memory, 3 admin endpoints) stores results
from browser runs for CI consumption. Test-runners surface v0.2.0
posts results after each run and fixes suite prefix matching.

CI integration via Playwright: wait-for-healthy.sh, run-surface-tests.sh,
surface-test-driver.js. New test-runners stage in Gitea CI pipeline.

Verified: 169 passed, 0 failed, 9 warned, 8 skipped on fresh install.
Go handler tests: 4/4 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 23:52:31 +00:00
parent 829caa3b20
commit 448071d6b9
30 changed files with 1397 additions and 26 deletions

View File

@@ -0,0 +1,59 @@
/**
* Chat Runner — chat/conversations suite
*
* Tests conversation CRUD via the chat-core ext API.
*/
(function () {
'use strict';
var api = window.CR.api;
sw.testing.suite('chat/conversations', async function (s) {
var convId;
s.test('create conversation', async function (t) {
var r = await api.post('/conversations', {
title: 'Runner Test Convo ' + Date.now(),
type: 'direct'
});
t.assert.ok(r.id, 'conversation has id');
t.assert.ok(r.title, 'conversation has title');
convId = r.id;
s.track('conversation', convId);
});
s.test('get conversation', async function (t) {
t.assert.ok(convId, 'convId from previous test');
var r = await api.get('/conversations/' + convId);
t.assert.eq(r.id, convId, 'id matches');
});
s.test('update conversation', async function (t) {
t.assert.ok(convId, 'convId from previous test');
var r = await api.put('/conversations/' + convId, {
title: 'Updated Convo Title'
});
t.assert.eq(r.title, 'Updated Convo Title', 'title updated');
});
s.test('list conversations', async function (t) {
var r = await api.get('/conversations');
var list = Array.isArray(r) ? r : (r.data || []);
t.assert.ok(Array.isArray(list), 'response is array');
var found = list.some(function (c) { return c.id === convId; });
t.assert.ok(found, 'created conversation in list');
});
s.test('delete conversation', async function (t) {
t.assert.ok(convId, 'convId from previous test');
await api.del('/conversations/' + convId);
try {
await api.get('/conversations/' + convId);
t.assert.ok(false, 'expected error after delete');
} catch (e) {
t.assert.ok(true, 'conversation not found after delete');
}
convId = null;
});
});
})();

View File

@@ -0,0 +1,63 @@
/**
* Chat Runner — Entry Point
*
* Boot SDK, load test modules in dependency order.
* Each module is an IIFE that registers suites via sw.testing.suite().
*/
(async function () {
'use strict';
try {
var base = window.__BASE__ || '';
var ver = window.__VERSION__ || '0';
if (!window.preact) {
var { h, render } = await import(base + '/js/sw/vendor/preact.module.js');
var hooksModule = await import(base + '/js/sw/vendor/hooks.module.js');
var htmModule = await import(base + '/js/sw/vendor/htm.module.js');
window.preact = { h, render };
window.hooks = hooksModule;
window.html = htmModule.default.bind(h);
}
var sdk = await import(base + '/js/sw/sdk/index.js?v=' + ver);
await sdk.boot();
} catch (e) {
console.warn('[ChatRunner] SDK boot failed:', e.message);
}
window.CR = {
base: window.__BASE__ || '',
api: sw.api.ext('chat-core')
};
var surfaceId = 'chat-runner';
var assetBase = '/surfaces/' + surfaceId + '/js/';
if (window.CR.base) assetBase = window.CR.base + assetBase;
var modules = [
'conversations.js',
'messaging.js'
];
var loaded = 0;
function loadNext() {
if (loaded >= modules.length) { onReady(); return; }
var script = document.createElement('script');
script.src = assetBase + modules[loaded] + '?v=' + (window.__VERSION__ || '0') + '.' + Date.now();
script.onload = function () { loaded++; loadNext(); };
script.onerror = function () {
console.error('[ChatRunner] Failed to load: ' + modules[loaded]);
loaded++; loadNext();
};
document.body.appendChild(script);
}
function onReady() {
console.log('[ChatRunner] All modules loaded — ' + sw.testing.suites().length + ' suites registered');
var manifest = window.__MANIFEST__ || {};
if (manifest.id === surfaceId) {
window.location.href = (window.__BASE__ || '') + '/s/test-runners';
}
}
loadNext();
})();

View File

@@ -0,0 +1,60 @@
/**
* Chat Runner — chat/messaging suite
*
* Tests message CRUD and search within conversations.
*/
(function () {
'use strict';
var api = window.CR.api;
sw.testing.suite('chat/messaging', async function (s) {
var convId, msgId;
s.beforeAll(async function () {
var r = await api.post('/conversations', {
title: 'Messaging Test ' + Date.now(),
type: 'direct'
});
convId = r.id;
s.track('conversation', convId);
});
s.test('send message', async function (t) {
var r = await api.post('/messages/' + convId, {
content: 'Hello from chat-runner test!',
content_type: 'text'
});
t.assert.ok(r.id, 'message has id');
t.assert.ok(r.content, 'message has content');
msgId = r.id;
});
s.test('list messages', async function (t) {
var r = await api.get('/messages/' + convId);
var list = Array.isArray(r) ? r : (r.data || r.messages || []);
t.assert.ok(Array.isArray(list), 'messages is array');
t.assert.ok(list.length > 0, 'at least one message');
var found = list.some(function (m) { return m.id === msgId; });
t.assert.ok(found, 'sent message appears in list');
});
s.test('search conversations', async function (t) {
var r = await api.get('/search?q=chat-runner');
var list = Array.isArray(r) ? r : (r.data || r.conversations || r.results || []);
t.assert.ok(Array.isArray(list), 'search returns array');
if (list.length === 0) {
t.warn('Search returned empty — may need time for indexing');
}
});
s.test('mark read', async function (t) {
try {
await api.post('/read/' + convId, {});
t.assert.ok(true, 'mark read succeeded');
} catch (e) {
t.warn('mark read failed: ' + e.message);
}
});
});
})();