test(daemon): verify bounded desktop readiness and cancellable artifacts

This commit is contained in:
Mohamed Boudra
2026-09-09 14:14:48 +02:00
parent 264276880e
commit 2ed204f05f
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -219,7 +219,7 @@ jobs:
- name: Upload desktop lifecycle screenshots
uses: actions/upload-artifact@v4
if: ${{ always() && runner.os == 'Linux' }}
if: ${{ !cancelled() && runner.os == 'Linux' }}
with:
name: desktop-lifecycle
path: ${{ runner.temp }}/desktop-lifecycle
+10 -3
View File
@@ -48,7 +48,7 @@ await writeFile(
);
let desktop;
let captured;
async function openDesktop(overrides = {}) {
async function openDesktop() {
desktop = await electron.launch({
args: ["--no-sandbox", "--ozone-platform=headless", main],
env: {
@@ -56,7 +56,6 @@ async function openDesktop(overrides = {}) {
PASEO_LISTEN: "127.0.0.1:1",
PASEO_WEB_UI_ENABLED: "false",
PASEO_HOST: "unused:1",
...overrides,
},
});
await expect
@@ -171,7 +170,15 @@ try {
preload,
'if (process.argv[1]?.endsWith("daemon-worker.js")) await new Promise(resolve => setTimeout(resolve, 45000));',
);
await openDesktop({ NODE_OPTIONS: `--import=${pathToFileURL(preload).href}` });
await openDesktop();
// Playwright removes NODE_OPTIONS from electron.launch's environment.
// Restore this runtime input inside the isolated fixture before it launches the daemon.
await desktop.evaluate(
(_, value) => {
process.env.NODE_OPTIONS = value;
},
`--import=${pathToFileURL(preload).href}`,
);
const began = Date.now();
const starting = await command("start_desktop_daemon");
captured = await readDaemonInstance(home);