ubuntu not working. idk I'm just gonna use windows anyway
This commit is contained in:
@@ -33,6 +33,22 @@ function makeService({ settings: settingsOverrides, screenApi } = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
test('XDG_SESSION_TYPE=x11 wins over a stray WAYLAND_DISPLAY value', () => {
|
||||
const prevSessionType = process.env.XDG_SESSION_TYPE;
|
||||
const prevWaylandDisplay = process.env.WAYLAND_DISPLAY;
|
||||
try {
|
||||
process.env.XDG_SESSION_TYPE = 'x11';
|
||||
process.env.WAYLAND_DISPLAY = 'wayland-0';
|
||||
const service = makeService();
|
||||
assert.equal(service.onWayland(), false);
|
||||
} finally {
|
||||
if (prevSessionType === undefined) delete process.env.XDG_SESSION_TYPE;
|
||||
else process.env.XDG_SESSION_TYPE = prevSessionType;
|
||||
if (prevWaylandDisplay === undefined) delete process.env.WAYLAND_DISPLAY;
|
||||
else process.env.WAYLAND_DISPLAY = prevWaylandDisplay;
|
||||
}
|
||||
});
|
||||
|
||||
// The raw/regular twin window plus margin: how long a test must wait for a
|
||||
// held Linux raw press to fire when no coordinate twin arrives.
|
||||
const TWIN_FLUSH_MS = 60;
|
||||
@@ -840,6 +856,49 @@ test('losing the click watcher mid-session falls back to interval capture', () =
|
||||
}
|
||||
});
|
||||
|
||||
test('losing the click watcher mid-session can fall back to hotkey-only', () => {
|
||||
const service = makeService();
|
||||
service.settings.get = (key) => {
|
||||
if (key === 'capture.fallbackTrigger') return 'hotkey';
|
||||
if (key === 'capture.autoIntervalSec') return 3;
|
||||
return null;
|
||||
};
|
||||
service.session = { guideId: 'guide-loss-hotkey', paused: false, count: 0, intervalSec: 0 };
|
||||
const states = [];
|
||||
service.notify = (channel, payload) => {
|
||||
states.push({ channel, payload });
|
||||
};
|
||||
|
||||
try {
|
||||
service.handleClickWatcherLoss('exited with code 1');
|
||||
|
||||
assert.equal(service.session.intervalSec, 0,
|
||||
'hotkey fallback must not silently start the 5-second timer');
|
||||
assert.equal(service.intervalTimer, null);
|
||||
assert.ok(states.some((s) => s.channel === 'capture:state'));
|
||||
} finally {
|
||||
service.finishSession();
|
||||
}
|
||||
});
|
||||
|
||||
test('starting a session with hotkey fallback keeps the timer off when clicks are unavailable', () => {
|
||||
const service = makeService();
|
||||
service.clickCaptureAvailable = () => false;
|
||||
service.settings.get = (key) => {
|
||||
if (key === 'capture.fallbackTrigger') return 'hotkey';
|
||||
if (key === 'capture.autoIntervalSec') return 7;
|
||||
if (key === 'capture.captureOutsideClicks') return false;
|
||||
return null;
|
||||
};
|
||||
|
||||
service.startSession('guide-hotkey-fallback');
|
||||
|
||||
assert.equal(service.session.intervalSec, 0);
|
||||
assert.equal(service.state().clickCaptureAvailable, false);
|
||||
assert.equal(service.state().clickCapture, false);
|
||||
service.finishSession();
|
||||
});
|
||||
|
||||
// ---- strict frame selection -----------------------------------------------------
|
||||
|
||||
test('a click is served instantly from the freshly buffered frame', async () => {
|
||||
|
||||
@@ -7,6 +7,7 @@ const path = require('node:path');
|
||||
|
||||
const {
|
||||
buildMissingElectronError,
|
||||
linuxSandboxLaunchArgs,
|
||||
repairElectronInstall,
|
||||
resolveElectronBinary,
|
||||
} = require('../../scripts/electron-launcher');
|
||||
@@ -171,3 +172,21 @@ test('reports a helpful error when the runtime is missing', (t) => {
|
||||
assert.match(message, /Electron could not be started/);
|
||||
assert.match(message, /Expected the binary in:/);
|
||||
});
|
||||
|
||||
test('uses --no-sandbox when the Linux sandbox helper is not root-owned and setuid', () => {
|
||||
const args = linuxSandboxLaunchArgs({
|
||||
electronPath: '/tmp/stepforge/node_modules/electron/dist/electron',
|
||||
platform: 'linux',
|
||||
statSync: () => ({ uid: 1000, mode: 0o100755 }),
|
||||
});
|
||||
assert.deepEqual(args, ['--no-sandbox']);
|
||||
});
|
||||
|
||||
test('keeps the sandbox enabled when the Linux helper is root-owned and setuid', () => {
|
||||
const args = linuxSandboxLaunchArgs({
|
||||
electronPath: '/tmp/stepforge/node_modules/electron/dist/electron',
|
||||
platform: 'linux',
|
||||
statSync: () => ({ uid: 0, mode: 0o104755 }),
|
||||
});
|
||||
assert.deepEqual(args, []);
|
||||
});
|
||||
|
||||
@@ -65,6 +65,7 @@ test('settings persist, deep-merge with defaults, and store global placeholders'
|
||||
assert.equal(s2.get('capture.delayMs'), 1500);
|
||||
assert.equal(s2.get('ai.ollama.model'), 'qwen3:0.6b');
|
||||
assert.equal(s2.get('capture.clickMarker'), DEFAULT_SETTINGS.capture.clickMarker);
|
||||
assert.equal(s2.get('capture.fallbackTrigger'), DEFAULT_SETTINGS.capture.fallbackTrigger);
|
||||
assert.deepEqual(s2.getGlobalPlaceholders(), { Company: 'Acme', Author: 'Tyler' });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user