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>
66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
/**
|
|
* Schedules Runner — schedules/crud suite
|
|
*
|
|
* Tests schedule CRUD via the kernel schedules API.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
var API = window.SR.api;
|
|
|
|
sw.testing.suite('schedules/crud', async function (s) {
|
|
var schedId;
|
|
|
|
s.test('create schedule', async function (t) {
|
|
var r = await sw.api.post(API, {
|
|
name: 'runner-test-' + Date.now(),
|
|
cron_expr: '0 0 * * *',
|
|
script: 'print("hello from schedule runner")',
|
|
enabled: false
|
|
});
|
|
t.assert.ok(r.id, 'schedule has id');
|
|
t.assert.ok(r.name, 'schedule has name');
|
|
schedId = r.id;
|
|
s.track('schedule', schedId);
|
|
});
|
|
|
|
s.test('get schedule', async function (t) {
|
|
t.assert.ok(schedId, 'schedId from previous test');
|
|
var r = await sw.api.get(API + '/' + schedId);
|
|
t.assert.eq(r.id, schedId, 'id matches');
|
|
t.assert.ok(r.cron_expr, 'cron_expr present');
|
|
});
|
|
|
|
s.test('update schedule', async function (t) {
|
|
t.assert.ok(schedId, 'schedId from previous test');
|
|
var r = await sw.api.put(API + '/' + schedId, {
|
|
name: 'runner-test-updated',
|
|
cron_expr: '30 2 * * *'
|
|
});
|
|
t.assert.eq(r.name, 'runner-test-updated', 'name updated');
|
|
});
|
|
|
|
s.test('run schedule', async function (t) {
|
|
t.assert.ok(schedId, 'schedId from previous test');
|
|
try {
|
|
await sw.api.post(API + '/' + schedId + '/run', {});
|
|
t.assert.ok(true, 'run endpoint returned successfully');
|
|
} catch (e) {
|
|
t.warn('Schedule run failed: ' + e.message);
|
|
}
|
|
});
|
|
|
|
s.test('delete schedule', async function (t) {
|
|
t.assert.ok(schedId, 'schedId from previous test');
|
|
await sw.api.del(API + '/' + schedId);
|
|
try {
|
|
await sw.api.get(API + '/' + schedId);
|
|
t.assert.ok(false, 'expected error after delete');
|
|
} catch (e) {
|
|
t.assert.ok(true, 'schedule not found after delete');
|
|
}
|
|
schedId = null;
|
|
});
|
|
});
|
|
})();
|