This commit is contained in:
lin onetwo 2025-06-12 17:25:47 +08:00
parent bbf86c364a
commit 1123788d8b
4 changed files with 44 additions and 7 deletions

View file

@ -46,6 +46,14 @@ jobs:
- name: Install dependencies
run: pnpm install
# Set up virtual display for Linux GUI testing
- name: Set up virtual display
run: |
sudo apt-get update
sudo apt-get install -y xvfb
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- name: Run linting
run: pnpm run lint
continue-on-error: true
@ -57,7 +65,16 @@ jobs:
run: pnpm run build:plugin
- name: Package for testing
run: pnpm run package:dev
run: pnpm run package
- name: Set executable permissions
run: chmod +x out/TidGi-linux-x64/tidgi
- name: Create logs directory
run: mkdir -p logs
- name: Run e2e tests
run: pnpm run test:e2e
env:
CI: true
DISPLAY: :99

10
.gitignore vendored
View file

@ -69,4 +69,12 @@ deb2appimage.json
userData-dev/
wiki-dev/
*.tsbuildinfo
tsconfig.test.json.tsbuildinfo
tsconfig.test.json.tsbuildinfo
# E2E test artifacts
logs/
reports/
*.png
*.jpg
*.jpeg
screenshots/

View file

@ -5,10 +5,12 @@ module.exports = {
'features/stepDefinitions/**/*.ts',
],
requireModule: ['ts-node/register'],
format: ['progress'],
format: ['progress', 'json:logs/cucumber-report.json'],
formatOptions: {
snippetInterface: 'async-await',
},
paths: ['features/*.feature'],
timeout: 60000, // Increase timeout for CI
retry: process.env.CI ? 1 : 0, // Retry once in CI
},
};

View file

@ -28,19 +28,29 @@ After(async function(this: ApplicationWorld) {
});
When('I launch the TidGi application', async function(this: ApplicationWorld) {
// For E2E tests on dev mode, use the packaged test version with NODE_ENV environment variable baked in
const packedAppPath = getPackedAppPath();
console.log('Launching packaged test app at:', packedAppPath);
try {
this.app = await electron.launch({
executablePath: packedAppPath,
// Add debugging options to prevent app from closing
args: ['--no-sandbox', '--disable-dev-shm-usage'],
// CI environment specific args for headless testing
args: [
'--no-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
'--disable-software-rasterizer',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding',
'--disable-features=TranslateUI',
'--disable-ipc-flooding-protection'
],
env: {
...process.env,
NODE_ENV: 'test',
// Force headless mode in CI
DISPLAY: process.env.CI ? ':99' : process.env.DISPLAY,
},
});
this.mainWindow = await this.app.firstWindow();