Skip to content

Commit 46a0400

Browse files
committed
qa(desktop): prove acknowledged native AX File menu selection on isolated runners
1 parent 1897cbb commit 46a0400

3 files changed

Lines changed: 537 additions & 210 deletions

File tree

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

Lines changed: 61 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -1,239 +1,90 @@
11
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-
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'
7+
native-menu:
8+
name: native-menu-${{ matrix.version }}
639
runs-on: macos-26
64-
timeout-minutes: 30
10+
timeout-minutes: 25
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
version: [baseline, pinned, canary]
6515
steps:
66-
- name: Checkout code
67-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
16+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
6817
with:
6918
persist-credentials: false
70-
71-
- name: Setup Bun
72-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
19+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
7320
with:
7421
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
22+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
8023
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
106-
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
113-
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'
121-
runs-on: macos-26
122-
timeout-minutes: 30
123-
continue-on-error: true
124-
steps:
125-
- name: Checkout code
126-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
127-
with:
128-
persist-credentials: false
129-
130-
- name: Setup Bun
131-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
132-
with:
133-
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
24+
node-version: 22
25+
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
13926
with:
14027
path: |
14128
~/Library/Caches/electron
14229
~/Library/Caches/electron-builder
14330
~/Library/Caches/ms-playwright
14431
key: desktop-downloads-${{ runner.os }}-${{ hashFiles('bun.lock') }}
14532
restore-keys: desktop-downloads-${{ runner.os }}-
146-
147-
- name: Install dependencies
148-
run: bun install --frozen-lockfile
149-
150-
- name: Switch to electron@latest
33+
- run: bun install --frozen-lockfile
34+
- if: matrix.version == 'canary'
15135
working-directory: apps/desktop
15236
run: bun add --no-save -d electron@latest
153-
154-
- name: Bundle main and preload
37+
- name: Restore original routing guard for baseline only
38+
if: matrix.version == 'baseline'
39+
run: |
40+
python3 - <<'PYCODE'
41+
from pathlib import Path
42+
p = Path('apps/desktop/src/main/menu.ts')
43+
source = p.read_text()
44+
before = "label: 'Folder Access…',\n click: (_item, focusedWindow) => {\n const win = focusedWindowOrMain(focusedWindow)"
45+
after = before.replace('focusedWindowOrMain', 'focusedMainOrFallback')
46+
assert source.count(before) == 1
47+
p.write_text(source.replace(before, after))
48+
PYCODE
49+
- name: Compile QA-only native menu driver
50+
run: xcrun swiftc apps/desktop/e2e/native-menu.swift -o /tmp/sim-native-menu
51+
- name: Bundle desktop
15552
working-directory: apps/desktop
15653
run: bun run build
157-
158-
- name: Install system-browser fixture
159-
working-directory: apps/desktop
160-
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
164-
run: brew install tmux
165-
166-
- name: Run Playwright _electron smoke suite
54+
- name: Native menu proof with zero retries
55+
if: matrix.version != 'baseline'
16756
working-directory: apps/desktop
168-
run: bunx playwright test
57+
run: bunx playwright test e2e/native-menu.spec.ts --grep 'Folder Access' --retries=0
16958
env:
170-
BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json
171-
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
176-
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
185-
timeout-minutes: 20
186-
steps:
187-
- name: Checkout code
188-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
189-
with:
190-
persist-credentials: false
191-
192-
- name: Setup Bun
193-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
194-
with:
195-
bun-version: 1.4.2
196-
197-
- name: Setup Node
198-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
199-
with:
200-
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
59+
DESKTOP_NATIVE_MENU_HELPER: /tmp/sim-native-menu
60+
DESKTOP_NATIVE_MENU_CASES: '10'
61+
- name: Verify the original guard fails only the utility menu
62+
if: matrix.version == 'baseline'
21863
working-directory: apps/desktop
21964
env:
220-
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
221-
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
65+
DESKTOP_NATIVE_MENU_HELPER: /tmp/sim-native-menu
66+
DESKTOP_NATIVE_MENU_CASES: '1'
22867
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
68+
set +e
69+
bunx playwright test e2e/native-menu.spec.ts --grep 'Folder Access' --retries=0
70+
result=$?
71+
set -e
72+
test "$result" -ne 0
73+
python3 - <<'PYCODE'
74+
import json
75+
from pathlib import Path
76+
reports = list(Path('test-results').rglob('folder-access-menu.json'))
77+
assert len(reports) == 1, reports
78+
report = json.loads(reports[0].read_text())
79+
main, picker = report['checks']
80+
assert main['status'] == 'passed' and main['shown'] and main['closed'], report
81+
assert picker['status'] == 'failed' and picker['shown'] is False and picker['parentUrl'] is None and picker['callbackEntered'] is True, report
82+
assert any(action.get('command') == 'press' and action.get('ok') for action in picker['nativeActions']), report
83+
print('Expected red verified: native main menu works; original guard prevents utility menu popup.')
84+
PYCODE
85+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
86+
if: always()
87+
with:
88+
name: desktop-native-menu-${{ matrix.version }}
89+
path: apps/desktop/test-results
90+
retention-days: 14

0 commit comments

Comments
 (0)