From 2d3c54490faa088e509b29b91d15937f8b573ad7 Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Thu, 22 Oct 2026 20:36:47 -0400 Subject: [PATCH] ci(windows-smoke): a matrix: link while hidden or minimised (#8) Hide the window (then minimise it), open matrix:r/lotus-smoke-*:example.org through Windows (protocol handler -> second cinny.exe -> single-instance), and require the window to come back and the URL to reach the page as lotus-deeplink. Refs #8, #19 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- scripts/windows-smoke.mjs | 46 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/scripts/windows-smoke.mjs b/scripts/windows-smoke.mjs index 1808d1b..3beadc2 100644 --- a/scripts/windows-smoke.mjs +++ b/scripts/windows-smoke.mjs @@ -3,7 +3,8 @@ // The app is started with WebView2's DevTools port open // (WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222) and this // script drives its real page over CDP with playwright-core. No login: every -// check runs on the login screen or through the app's own Tauri commands. +// check runs on the login screen or through the app's own Tauri commands +// (including a `matrix:` deep link while hidden/minimised, #8). // // node scripts/windows-smoke.mjs // @@ -184,6 +185,49 @@ if (!page.url().startsWith(FOREIGN)) { } foreign.close(); await page.goto(APP).catch(() => undefined); +await until(async () => /Login|Homeserver/.test(await page.locator('body').innerText()), 60_000); + +// 8. A `matrix:` link opened from Windows while the window is hidden to the +// tray, then while minimised, must bring the window back AND reach the page +// as `lotus-deeplink` (#8). It goes the real route: Windows' protocol handler +// starts a second cinny.exe, and single-instance forwards the URL to this one. +// (Turning the URL into a room navigation is the web app's job, signed in.) +const win = (cmd) => + page.evaluate( + ([c]) => window.__TAURI_INTERNALS__.invoke(`plugin:window|${c}`, { label: 'main' }), + [cmd], + ); +await page.evaluate(() => { + window.__deeplinks = []; + window.addEventListener('lotus-deeplink', (e) => window.__deeplinks.push(e.detail)); +}); +for (const [state, put] of [ + ['hidden to the tray', 'hide'], + ['minimised', 'minimize'], +]) { + const name = `deep link while ${state} reveals the window and reaches the page`; + const url = `matrix:r/lotus-smoke-${put}:example.org`; + try { + await win(put); + await new Promise((r) => setTimeout(r, 1500)); + const away = put === 'hide' ? !(await win('is_visible')) : await win('is_minimized'); + execSync(`cmd /c start "" "${url}"`); + const got = await until( + () => page.evaluate((u) => window.__deeplinks.includes(u), url), + 20_000, + ); + const visible = await win('is_visible'); + const minimised = await win('is_minimized'); + const ok = away && got && visible && !minimised; + record( + name, + ok ? 'pass' : 'fail', + `${state} first: ${away}; event: ${!!got}; visible after: ${visible}; minimised after: ${minimised}`, + ); + } catch (e) { + record(name, 'fail', String(e).slice(0, 200)); + } +} await page.screenshot({ path: `${OUT}/02-end.png` }).catch(() => undefined); writeFileSync(`${OUT}/results.json`, JSON.stringify(results, null, 2));