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:
co-authored by
Claude Opus 5.5
parent
2ea08f1c7e
commit
2d3c54490f
@@ -3,7 +3,8 @@
|
|||||||
// The app is started with WebView2's DevTools port open
|
// The app is started with WebView2's DevTools port open
|
||||||
// (WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222) and this
|
// (WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222) and this
|
||||||
// script drives its real page over CDP with playwright-core. No login: every
|
// 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>
|
// node scripts/windows-smoke.mjs <outDir>
|
||||||
//
|
//
|
||||||
@@ -184,6 +185,49 @@ if (!page.url().startsWith(FOREIGN)) {
|
|||||||
}
|
}
|
||||||
foreign.close();
|
foreign.close();
|
||||||
await page.goto(APP).catch(() => undefined);
|
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);
|
await page.screenshot({ path: `${OUT}/02-end.png` }).catch(() => undefined);
|
||||||
|
|
||||||
writeFileSync(`${OUT}/results.json`, JSON.stringify(results, null, 2));
|
writeFileSync(`${OUT}/results.json`, JSON.stringify(results, null, 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user