From 551377d0326c18a63ad48716a3a0db7bda01051d Mon Sep 17 00:00:00 2001 From: Alex Chapin Date: Tue, 13 Oct 2026 23:30:20 -0400 Subject: [PATCH 1/2] test: add Electron startup smoke test (PAT_SMOKE_TEST) to Build_PAT (#340 prerequisite) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build_pat.yaml | 13 +++++++++++++ app/background.js | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.github/workflows/build_pat.yaml b/.github/workflows/build_pat.yaml index 6376119e..1d4dab24 100755 --- a/.github/workflows/build_pat.yaml +++ b/.github/workflows/build_pat.yaml @@ -153,6 +153,19 @@ jobs: ../ cmake --build . --target "$BUILD_TARGET" -j $N + # Starts the built app bundle in the repo's Electron; does not test the packaged installer layout + - name: Electron startup smoke test + shell: bash + env: + PAT_SMOKE_TEST: "1" + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get install -y xvfb + xvfb-run -a npx electron --no-sandbox build + else + npx electron build + fi + - name: Save artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v6 diff --git a/app/background.js b/app/background.js index 5ca5f94b..8d65c3ac 100644 --- a/app/background.js +++ b/app/background.js @@ -53,6 +53,32 @@ app.on('ready', () => { }); remoteMain.enable(mainWindow.webContents); + // CI smoke test: PAT_SMOKE_TEST=1 exits 0 once the AngularJS app has bootstrapped, 1 on load failure/crash/timeout + if (process.env.PAT_SMOKE_TEST === '1') { + const fail = reason => { + console.error('PAT smoke test FAILED: ' + reason); + app.exit(1); + }; + const wc = mainWindow.webContents; + wc.on('did-fail-load', (event, code, description) => fail('did-fail-load ' + code + ' ' + description)); + wc.on('render-process-gone', (event, details) => fail('render-process-gone ' + details.reason)); + wc.on('did-finish-load', () => { + setTimeout(() => { + wc.executeJavaScript('typeof angular !== "undefined" && !!angular.element(document.body).injector()') + .then(ok => { + if (ok) { + console.log('PAT smoke test passed'); + app.exit(0); + } else { + fail('AngularJS app did not bootstrap'); + } + }) + .catch(err => fail(err.message)); + }, 5000); + }); + setTimeout(() => fail('timeout'), 90000); + } + const env = getEnv(app.getAppPath()); if (env.name === 'development') { mainWindow.loadURL('http://localhost:3000/index.html'); From d51d0bec72a07c1f006954829e86942c73846829 Mon Sep 17 00:00:00 2001 From: Alex Chapin Date: Tue, 13 Oct 2026 23:35:34 -0400 Subject: [PATCH 2/2] ci: hard timeout on Electron smoke step --- .github/workflows/build_pat.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_pat.yaml b/.github/workflows/build_pat.yaml index 1d4dab24..3da2cbfa 100755 --- a/.github/workflows/build_pat.yaml +++ b/.github/workflows/build_pat.yaml @@ -155,6 +155,7 @@ jobs: # Starts the built app bundle in the repo's Electron; does not test the packaged installer layout - name: Electron startup smoke test + timeout-minutes: 3 shell: bash env: PAT_SMOKE_TEST: "1"