Skip to content

desktop-e2e

desktop-e2e #1544

Workflow file for this run

name: desktop-e2e
on:
workflow_dispatch:
permissions:
contents: read
jobs:
native-menu:
name: native-menu-${{ matrix.version }}
runs-on: macos-26
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
version: [baseline, pinned, canary]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: 1.4.2
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
with:
node-version: 22
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: |
~/Library/Caches/electron
~/Library/Caches/electron-builder
~/Library/Caches/ms-playwright
key: desktop-downloads-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: desktop-downloads-${{ runner.os }}-
- run: bun install --frozen-lockfile
- if: matrix.version == 'canary'
working-directory: apps/desktop
run: bun add --no-save -d electron@latest
- name: Restore original routing guard for baseline only
if: matrix.version == 'baseline'
run: |
python3 - <<'PYCODE'
from pathlib import Path
p = Path('apps/desktop/src/main/menu.ts')
source = p.read_text()
before = "label: 'Folder Access…',\n click: (_item, focusedWindow) => {\n const win = focusedWindowOrMain(focusedWindow)"
after = before.replace('focusedWindowOrMain', 'focusedMainOrFallback')
assert source.count(before) == 1
p.write_text(source.replace(before, after))
PYCODE
- name: Compile QA-only native menu driver
run: xcrun swiftc apps/desktop/e2e/native-menu.swift -o /tmp/sim-native-menu
- name: Bundle desktop
working-directory: apps/desktop
run: bun run build
- name: Native menu proof with zero retries
if: matrix.version != 'baseline'
working-directory: apps/desktop
run: bunx playwright test e2e/native-menu.spec.ts --grep 'Folder Access' --retries=0
env:
DESKTOP_NATIVE_MENU_HELPER: /tmp/sim-native-menu
DESKTOP_NATIVE_MENU_CASES: '10'
- name: Verify the original guard fails only the utility menu
if: matrix.version == 'baseline'
working-directory: apps/desktop
env:
DESKTOP_NATIVE_MENU_HELPER: /tmp/sim-native-menu
DESKTOP_NATIVE_MENU_CASES: '1'
run: |
set +e
bunx playwright test e2e/native-menu.spec.ts --grep 'Folder Access' --retries=0
result=$?
set -e
test "$result" -ne 0
python3 - <<'PYCODE'
import json
from pathlib import Path
reports = list(Path('test-results').rglob('folder-access-menu.json'))
assert len(reports) == 1, reports
report = json.loads(reports[0].read_text())
main, picker = report['checks']
assert main['status'] == 'passed' and main['shown'] and main['closed'], report
assert picker['status'] == 'failed' and picker['shown'] is False and picker['parentUrl'] is None and picker['callbackEntered'] is True, report
assert any(action.get('command') == 'press' and action.get('ok') for action in picker['nativeActions']), report
print('Expected red verified: native main menu works; original guard prevents utility menu popup.')
PYCODE
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: desktop-native-menu-${{ matrix.version }}
path: apps/desktop/test-results
retention-days: 14