Skip to content

The OSINT investigator's workbench. One case, one folder, every tool. Local-first: your media and your investigations never leave your machine.

JavaScript

Stop the gate failing on how busy the runner was (#110)

OsintMeThat5dcaa80343a0
diff --git a/frontend/e2e/timeline.spec.js b/frontend/e2e/timeline.spec.js
index 3e5dc63..fdae20a 100644
--- a/frontend/e2e/timeline.spec.js
+++ b/frontend/e2e/timeline.spec.js
@@ -165,6 +165,21 @@ async function setWindow(page, from, to) {
const axisWindowText = async (page) =>
(await page.locator('.range-face').getAttribute('title')).split(' · ')[0];
+/** Where a handle is, read once it has stopped moving. The overview window reflows
+ * as a drag lands, and a box measured mid-reflow aims the next press beside the
+ * handle rather than on it — the drag then does nothing and the window never
+ * changes. Costs one extra frame on a machine that was already still. */
+async function restingBox(locator) {
+ let last = await locator.boundingBox();
+ for (let look = 0; look < 20; look += 1) {
+ await locator.page().waitForTimeout(50);
+ const box = await locator.boundingBox();
+ if (last && box && box.x === last.x && box.width === last.width) return box;
+ last = box;
+ }
+ return last;
+}
+
/** A preset put on the axis from `⋯`, where tracks are added. */
async function addTrack(page, name) {
await page.locator('.timeline-bar').getByRole('button', { name: 'More', exact: true }).click();
@@ -924,7 +939,7 @@ test('moves and resizes the overview window', async ({ page }) => {
await zoomIn(page);
const before = await axisWindowText(page);
const start = page.getByRole('button', { name: 'Change range start' });
- const startBox = await start.boundingBox();
+ const startBox = await restingBox(start);
await page.mouse.move(startBox.x + startBox.width / 2, startBox.y + startBox.height / 2);
await page.mouse.down();
await page.mouse.move(startBox.x + 90, startBox.y + startBox.height / 2, { steps: 5 });
@@ -933,7 +948,7 @@ test('moves and resizes the overview window', async ({ page }) => {
const narrowed = await axisWindowText(page);
const drag = page.getByRole('button', { name: 'Move visible range' });
- const dragBox = await drag.boundingBox();
+ const dragBox = await restingBox(drag);
await page.mouse.move(dragBox.x + dragBox.width / 2, dragBox.y + dragBox.height / 2);
await page.mouse.down();
await page.mouse.move(dragBox.x + dragBox.width / 2 - 45, dragBox.y + dragBox.height / 2, { steps: 4 });
diff --git a/frontend/playwright.config.js b/frontend/playwright.config.js
index eefc6d2..9d9059a 100644
--- a/frontend/playwright.config.js
+++ b/frontend/playwright.config.js
@@ -10,6 +10,12 @@ export default defineConfig({
// MapLibre/Konva startup into a timeout; CI stays fully deterministic.
workers: process.env.CI ? 1 : 4,
reporter: process.env.CI ? 'github' : 'list',
+ // A web-first assertion polls, so a longer ceiling costs a passing run nothing
+ // and only lengthens a genuine failure. The default five seconds is a guess
+ // about how fast the machine is, and a contended CI runner spends that much
+ // just getting the app to react. Local runs keep the short one, where a real
+ // failure should come back quickly.
+ expect: { timeout: process.env.CI ? 20_000 : 5_000 },
use: {
baseURL: 'http://127.0.0.1:18477',
screenshot: 'only-on-failure',
diff --git a/tests/test_workqueue.py b/tests/test_workqueue.py
index d1c6970..5a4d31a 100644
--- a/tests/test_workqueue.py
+++ b/tests/test_workqueue.py
@@ -142,7 +142,10 @@ def test_moving_a_case_directory_waits_for_the_background_worker(
workqueue.register("slow", slow)
workqueue.enqueue(case, "slow", payload={})
workqueue.wake(case)
- assert started.wait(2), "the worker never picked the job up"
+ # A liveness budget, not the measurement: on an idle machine the worker is in
+ # the handler within milliseconds, and what is under test is the drain below.
+ # Two seconds is a scheduling guess, and a loaded Windows runner missed it.
+ assert started.wait(30), "the worker never picked the job up"
if operation == "delete":
case.delete()