Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/build_pat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ 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
timeout-minutes: 3
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
Expand Down
26 changes: 26 additions & 0 deletions app/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading