@@ -15,6 +15,22 @@ test('Phase 6 observer returns stable refs and ranked semantic matches', async (
|
||||
const zoom = await observer.zoom({ ref: 'r1' }); assert.deepEqual(zoom.rect, [10, 20, 30, 30]);
|
||||
});
|
||||
|
||||
test('observer returns when the Shell helper never connects', async () => {
|
||||
const observer = new DesktopObserver({
|
||||
screenshot: { capture: async () => '/tmp/frame.png' },
|
||||
normalizer: { normalize: async () => ({ path: '/tmp/frame.webp' }) },
|
||||
shell: { connect: () => new Promise(() => {}), windows: async () => assert.fail('shell windows'), focused: async () => assert.fail('shell focused') },
|
||||
atspi: { tree: async () => [{ role: 'label', name: 'Discord', rect: [0, 0, 10, 10] }] },
|
||||
timeouts: { shell: 40 },
|
||||
});
|
||||
const started = Date.now();
|
||||
const bundle = await observer.observe({ includeOcr: false });
|
||||
assert.ok(Date.now() - started < 1000);
|
||||
assert.equal(bundle.screenshot_path, '/tmp/frame.webp');
|
||||
assert.equal(bundle.tree[0].name, 'Discord');
|
||||
assert.match(bundle.unavailable.join(' '), /Shell helper/);
|
||||
});
|
||||
|
||||
test('observer returns after a hung screenshot instead of staying on THINKING', async () => {
|
||||
const observer = new DesktopObserver({
|
||||
screenshot: { capture: () => new Promise(() => {}) },
|
||||
|
||||
Reference in New Issue
Block a user