Skip to content

Commit b6a4fc2

Browse files
committed
test(desktop): validate release review fixes across supported test platforms
1 parent e620ee0 commit b6a4fc2

9 files changed

Lines changed: 492 additions & 463 deletions

File tree

‎.github/workflows/desktop-e2e.yml‎

Lines changed: 94 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,239 +1,136 @@
1-
name: desktop-e2e
2-
3-
# Smoke coverage of the real Electron shell on desktop changes, plus a weekly
4-
# advisory canary against electron@latest so Chromium-cadence breakage surfaces
5-
# before an upgrade is attempted.
6-
1+
name: desktop-release-review-validation
72
on:
8-
pull_request:
9-
paths:
10-
- '.github/workflows/desktop-e2e.yml'
11-
- '.github/workflows/desktop-release.yml'
12-
- 'apps/desktop/**'
13-
- 'apps/sim/app/_shell/desktop-update-*.tsx'
14-
- 'apps/sim/app/workspace/**/home/hooks/use-mothership-resize.ts'
15-
- 'apps/sim/app/workspace/**/home/hooks/use-resource-panel.ts'
16-
- 'apps/sim/app/workspace/**/home/components/chat-panel-layout.tsx'
17-
- 'apps/sim/stores/chat-panel/**'
18-
- 'apps/sim/stores/constants.ts'
19-
- 'apps/sim/lib/browser-agent/transport.ts'
20-
- 'apps/sim/lib/core/utils/separator-keys.ts'
21-
- 'apps/sim/scripts/fixtures/chat-panel.tsx'
22-
- 'apps/sim/app/layout.tsx'
23-
- 'apps/sim/hooks/use-desktop-update-state.ts'
24-
- 'apps/sim/lib/desktop/**'
25-
- 'apps/sim/app/desktop/connect/**'
26-
- 'apps/sim/app/credential-groups/**'
27-
- 'apps/sim/hooks/queries/slack-search.ts'
28-
- 'apps/sim/hooks/queries/personal-search-integrations.ts'
29-
- 'apps/sim/hooks/use-search-integration-connection.ts'
30-
- 'apps/sim/hooks/use-github-installation-setup.ts'
31-
- 'apps/sim/lib/api/contracts/desktop-source-connect.ts'
32-
- 'apps/sim/scripts/fixtures/desktop-source-connect.tsx'
33-
- 'apps/sim/app/workspace/**/browser-session/**'
34-
- 'apps/sim/app/_styles/**'
35-
- 'apps/sim/lib/postcss/**'
36-
- 'apps/sim/postcss.config.mjs'
37-
- 'apps/sim/public/brand/fonts/**'
38-
- 'packages/emcn/**'
39-
- 'packages/desktop-bridge/**'
40-
- 'packages/browser-protocol/**'
41-
- 'packages/terminal-protocol/**'
42-
- 'packages/logger/**'
43-
- 'packages/security/**'
44-
- 'packages/tsconfig/**'
45-
- 'packages/utils/**'
46-
- 'bun.lock'
47-
- 'package.json'
48-
schedule:
49-
- cron: '23 9 * * 1'
503
workflow_dispatch:
51-
524
permissions:
535
contents: read
54-
55-
concurrency:
56-
group: desktop-e2e-${{ github.ref }}
57-
cancel-in-progress: true
58-
596
jobs:
60-
e2e:
61-
name: e2e
62-
if: github.event_name != 'schedule'
63-
runs-on: macos-26
64-
timeout-minutes: 30
7+
root:
8+
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}
9+
timeout-minutes: 40
6510
steps:
66-
- name: Checkout code
67-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
11+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
6812
with:
6913
persist-credentials: false
70-
71-
- name: Setup Bun
72-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
14+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
7315
with:
7416
bun-version: 1.4.2
75-
76-
# Electron, electron-builder and Playwright download their binaries on every cold install. All
77-
# three caches are keyed by version inside, so an older entry restored by prefix is harmless.
78-
- name: Cache Electron and Playwright downloads
79-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
17+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
8018
with:
81-
path: |
82-
~/Library/Caches/electron
83-
~/Library/Caches/electron-builder
84-
~/Library/Caches/ms-playwright
85-
key: desktop-downloads-${{ runner.os }}-${{ hashFiles('bun.lock') }}
86-
restore-keys: desktop-downloads-${{ runner.os }}-
87-
88-
- name: Install dependencies
89-
run: bun install --frozen-lockfile
90-
91-
- name: Bundle main and preload
92-
working-directory: apps/desktop
93-
run: bun run build
94-
95-
- name: Install system-browser fixture
96-
working-directory: apps/desktop
97-
run: bunx playwright install chromium
98-
99-
# The terminal-cancel suite drives a real tmux server; without tmux its tmux scenarios skip.
100-
- name: Install tmux
101-
run: brew install tmux
102-
103-
- name: Run Playwright _electron smoke suite
104-
working-directory: apps/desktop
105-
run: bunx playwright test
19+
node-version: 22
20+
- run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep)
21+
- run: bun install --frozen-lockfile
22+
- name: Complete root test gate
10623
env:
107-
BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json
108-
TERMINAL_CANCEL_REPORT_PATH: test-results/terminal-cancel-report.json
109-
110-
- name: Upload test results
111-
if: failure()
112-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
24+
VITEST_MAX_WORKERS: '4'
25+
run: |
26+
set -o pipefail
27+
bun run test 2>&1 | tee full-test.log
28+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
29+
if: always()
11330
with:
114-
name: desktop-e2e-results-pinned
115-
path: apps/desktop/test-results
116-
retention-days: 7
117-
118-
e2e-canary:
119-
name: e2e-canary
120-
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
31+
name: release-review-root-tests
32+
path: full-test.log
33+
native:
12134
runs-on: macos-26
12235
timeout-minutes: 30
123-
continue-on-error: true
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
variant: [baseline, pinned, canary]
12440
steps:
125-
- name: Checkout code
126-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
41+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
12742
with:
12843
persist-credentials: false
129-
130-
- name: Setup Bun
131-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
44+
fetch-depth: 2
45+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
13246
with:
13347
bun-version: 1.4.2
134-
135-
# Electron, electron-builder and Playwright download their binaries on every cold install. All
136-
# three caches are keyed by version inside, so an older entry restored by prefix is harmless.
137-
- name: Cache Electron and Playwright downloads
138-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
48+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
13949
with:
140-
path: |
141-
~/Library/Caches/electron
142-
~/Library/Caches/electron-builder
143-
~/Library/Caches/ms-playwright
144-
key: desktop-downloads-${{ runner.os }}-${{ hashFiles('bun.lock') }}
145-
restore-keys: desktop-downloads-${{ runner.os }}-
146-
147-
- name: Install dependencies
148-
run: bun install --frozen-lockfile
149-
150-
- name: Switch to electron@latest
50+
node-version: 22
51+
- run: bun install --frozen-lockfile
52+
- if: matrix.variant == 'canary'
15153
working-directory: apps/desktop
15254
run: bun add --no-save -d electron@latest
153-
154-
- name: Bundle main and preload
155-
working-directory: apps/desktop
55+
- name: Restore only the menu guard for the regression control
56+
if: matrix.variant == 'baseline'
57+
run: git show HEAD^:apps/desktop/src/main/menu.ts > apps/desktop/src/main/menu.ts
58+
- working-directory: apps/desktop
15659
run: bun run build
157-
158-
- name: Install system-browser fixture
60+
- if: matrix.variant != 'baseline'
15961
working-directory: apps/desktop
16062
run: bunx playwright install chromium
161-
162-
# The terminal-cancel suite drives a real tmux server; without tmux its tmux scenarios skip.
163-
- name: Install tmux
63+
- if: matrix.variant != 'baseline'
16464
run: brew install tmux
165-
166-
- name: Run Playwright _electron smoke suite
65+
- name: Require the unfixed menu to fail for the reported reason
66+
if: matrix.variant == 'baseline'
67+
working-directory: apps/desktop
68+
run: |
69+
set +e
70+
bunx playwright test e2e/smoke.spec.ts -g 'Folder Access opens from the focused main window and server picker' --retries=0 > menu-baseline.log 2>&1
71+
result=$?
72+
set -e
73+
cat menu-baseline.log
74+
test "$result" -ne 0
75+
python3 - <<'PY'
76+
import json
77+
from pathlib import Path
78+
reports=list(Path('test-results').rglob('folder-access-menu.json'))
79+
assert len(reports)==1, reports
80+
checks=json.loads(reports[0].read_text())['checks']
81+
assert len(checks)==2, checks
82+
assert checks[0]['status']=='passed', checks
83+
assert checks[1]['status']=='failed' and checks[1]['shown'] is False and checks[1]['parentUrl'] is None, checks
84+
print('Confirmed: main-window control passes; utility-window menu fails on the original guard.')
85+
PY
86+
- name: Full native suite with zero retries
87+
if: matrix.variant != 'baseline'
16788
working-directory: apps/desktop
168-
run: bunx playwright test
89+
run: bunx playwright test --retries=0
16990
env:
17091
BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json
17192
TERMINAL_CANCEL_REPORT_PATH: test-results/terminal-cancel-report.json
172-
173-
- name: Upload test results
174-
if: failure()
175-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
93+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
94+
if: always()
17695
with:
177-
name: desktop-e2e-results-latest
178-
path: apps/desktop/test-results
179-
retention-days: 7
180-
181-
package-smoke:
182-
name: package-smoke
183-
if: github.event_name != 'schedule'
184-
runs-on: macos-26
96+
name: release-review-native-${{ matrix.variant }}
97+
path: |
98+
apps/desktop/test-results
99+
apps/desktop/menu-baseline.log
100+
windows:
101+
runs-on: windows-latest
185102
timeout-minutes: 20
186103
steps:
187-
- name: Checkout code
188-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
104+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
189105
with:
190106
persist-credentials: false
191-
192-
- name: Setup Bun
193-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
107+
fetch-depth: 2
108+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
194109
with:
195110
bun-version: 1.4.2
196-
197-
- name: Setup Node
198-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
111+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
199112
with:
200113
node-version: 22
201-
202-
# Electron, electron-builder and Playwright download their binaries on every cold install. All
203-
# three caches are keyed by version inside, so an older entry restored by prefix is harmless.
204-
- name: Cache Electron and Playwright downloads
205-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
206-
with:
207-
path: |
208-
~/Library/Caches/electron
209-
~/Library/Caches/electron-builder
210-
~/Library/Caches/ms-playwright
211-
key: desktop-downloads-${{ runner.os }}-${{ hashFiles('bun.lock') }}
212-
restore-keys: desktop-downloads-${{ runner.os }}-
213-
214-
- name: Install dependencies
215-
run: bun install --frozen-lockfile
216-
217-
- name: Bundle and package unsigned
218-
working-directory: apps/desktop
219-
env:
220-
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
114+
- run: bun install --frozen-lockfile
115+
- name: Require original test entrypoint to reject Windows
116+
shell: pwsh
221117
run: |
222-
bun run build
223-
bunx electron-builder --mac dir --universal --publish never \
224-
-c.mac.identity=- -c.mac.hardenedRuntime=false
225-
226-
- name: Run packaged Electron smoke suite
227-
working-directory: apps/desktop
118+
git show HEAD^:apps/desktop/package.json | Set-Content apps/desktop/package.json
119+
$output = & bun run --cwd apps/desktop test src/main/menu.test.ts 2>&1 | Out-String
120+
$result = $LASTEXITCODE
121+
$output | Set-Content windows-baseline.log
122+
Write-Output $output
123+
git restore apps/desktop/package.json
124+
if ($result -eq 0 -or -not $output.Contains('Native desktop modules require macOS or Linux.')) { throw 'Baseline did not reproduce the native prebuild rejection.' }
125+
- name: Run portable cases through the real package test entrypoint
126+
shell: pwsh
228127
run: |
229-
APP_BUNDLE="$(find release -maxdepth 2 -name '*.app' -print -quit)"
230-
if [ -z "$APP_BUNDLE" ]; then
231-
echo "::error::Packaged app bundle was not found."
232-
exit 1
233-
fi
234-
EXECUTABLE="$(find "$APP_BUNDLE/Contents/MacOS" -maxdepth 1 -type f -perm -111 -print -quit)"
235-
if [ -z "$EXECUTABLE" ]; then
236-
echo "::error::Packaged app executable was not found."
237-
exit 1
238-
fi
239-
SIM_DESKTOP_EXECUTABLE="$EXECUTABLE" bunx playwright test e2e/packaged-smoke.spec.ts
128+
& bun run --cwd apps/desktop test src/main/local-files.test.ts src/main/desktop-executor/runner.test.ts src/main/security-guards.test.ts src/main/config.test.ts src/main/desktop-settings.test.ts --reporter=default --reporter=json --outputFile=../../windows-portable-tests.json
129+
exit $LASTEXITCODE
130+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
131+
if: always()
132+
with:
133+
name: release-review-windows-tests
134+
path: |
135+
windows-baseline.log
136+
windows-portable-tests.json

‎apps/desktop/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bun run dev # bundle + launch against https://www.sim.ai
5252
SIM_DESKTOP_ORIGIN=http://localhost:3000 bun run dev # against local sim
5353
```
5454

55-
- `bun run test` — vitest unit suite (electron is mocked; runs anywhere).
55+
- `bun run test` — Vitest suite with Electron mocked. Native directory cases build and run on macOS/Linux; Windows can run the remaining cases without compiling native modules. `bun run test:watch` uses the same setup.
5656
- `bun run test:e2e` — Playwright `_electron` smoke suite against a fixture origin (macOS, real Electron window).
5757
- `bun run type-check` / `lint:check` — standard workspace checks; CI picks these up automatically via `turbo run`.
5858
- `SIM_DESKTOP_USER_DATA=<dir>` isolates settings/partition state (used by e2e).

0 commit comments

Comments
 (0)