mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-04-25 23:03:03 -07:00
- Isolate each test scenario in test-artifacts/{scenarioSlug}/ directory
- Use dynamic ports for mock OpenAI server to avoid port conflicts
- Log VIEW_LOADED event via did-finish-load in main process (more reliable)
- Search all .log files when waiting for log markers
- Increase timeout for log marker steps to 15 seconds
- Fix ts-node cache issues by clearing cache before tests
- Move application launch to individual scenarios (required for mock server setup)
All 45 E2E test scenarios now pass consistently.
66 lines
2 KiB
YAML
66 lines
2 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: lts/*
|
|
|
|
# Install C++ build tools for native modules (nsfw, better-sqlite3)
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Rebuild native modules for Electron
|
|
run: pnpm exec electron-rebuild -f -w better-sqlite3,nsfw
|
|
|
|
- name: Run linting
|
|
run: pnpm run lint --max-warnings 0
|
|
|
|
# Install minimal Linux dependencies for Electron GUI testing https://www.electronjs.org/docs/latest/tutorial/testing-on-headless-ci
|
|
- name: Install Linux GUI dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y xvfb
|
|
# Install Chinese fonts and locale support for i18n testing
|
|
sudo apt-get install -y fonts-noto-cjk fonts-wqy-zenhei language-pack-zh-hans
|
|
sudo locale-gen zh_CN.UTF-8
|
|
- name: Run tests
|
|
# E2E GUI tests with Electron on Linux require a virtual framebuffer, upgrade screen size from time to time.
|
|
run: xvfb-run --auto-servernum --server-args="-screen 0 2560x1440x24" pnpm run test
|
|
env:
|
|
CI: true
|
|
DISPLAY: :99
|
|
# Set Chinese locale for i18n testing
|
|
LANG: zh_CN.UTF-8
|
|
LC_ALL: zh_CN.UTF-8
|
|
timeout-minutes: 15
|
|
|
|
# Upload test artifacts (screenshots, logs)
|
|
- name: Upload test artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-artifacts
|
|
path: |
|
|
test-artifacts/
|
|
retention-days: 7
|
|
continue-on-error: true
|