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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
Lotus CI
2026-10-22 20:36:47 -04:00
co-authored by Claude Opus 5.5
parent 2ea08f1c7e
commit 2d3c54490f
+45 -1
View File
@@ -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 <outDir>
//
@@ -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));