Publish Untrace Desktop 1.6.1 with offline batch workflows
This commit is contained in:
1 parent
99b4b22352
commit
7ce81b0727
47 files changed
+5958
-1208
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
import { mkdtemp, rm, readFile } from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { chromium } from '@playwright/test';
|
||||
|
||||
const data = await mkdtemp(path.join(os.tmpdir(), 'untrace-portable-'));
|
||||
const env = { ...process.env, UNTRACE_TEST: '1', UNTRACE_DATA_DIR: data };
|
||||
delete env.ELECTRON_RUN_AS_NODE;
|
||||
const { version, build } = JSON.parse(await readFile('package.json', 'utf8'));
|
||||
const artifact = build.portable.artifactName.replace('${version}', version);
|
||||
const processHandle = spawn(path.resolve('release', artifact), ['--remote-debugging-port=19384'], { env, windowsHide: true, stdio: 'ignore' });
|
||||
let browser;
|
||||
try {
|
||||
for (let attempt = 0; attempt < 120; attempt++) {
|
||||
try { browser = await chromium.connectOverCDP('http://127.0.0.1:19384', { timeout: 1000 }); break; }
|
||||
catch { await new Promise(resolve => setTimeout(resolve, 500)); }
|
||||
}
|
||||
if (!browser) throw new Error('Portable app did not start within 60 seconds.');
|
||||
const page = browser.contexts()[0].pages()[0];
|
||||
await page.waitForURL('untrace://app/');
|
||||
await page.getByLabel('Open image file', { exact: true }).waitFor({ state: 'attached' });
|
||||
if (await page.title() !== build.productName) throw new Error('Unexpected window');
|
||||
console.log('PASS: single-file portable extracted and loaded the offline app.');
|
||||
const cdp = await browser.newBrowserCDPSession();
|
||||
await Promise.race([cdp.send('Browser.close').catch(() => {}), new Promise(resolve => setTimeout(resolve, 1000))]);
|
||||
} finally {
|
||||
if (browser) await Promise.race([browser.close().catch(() => {}), new Promise(resolve => setTimeout(resolve, 1000))]);
|
||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||
await rm(data, { recursive: true, force: true, maxRetries: 10, retryDelay: 300 });
|
||||
}
|
||||
Reference in new issue
Block a user