diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 472c6ab..104c056 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -10,12 +10,7 @@ on: jobs: e2e-tests: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest timeout-minutes: 30 @@ -29,24 +24,44 @@ jobs: node-version: '20' cache: 'npm' + - name: Verify Node.js version + run: | + node --version + npm --version + - name: Install dependencies run: npm ci - - name: Build application + - name: Update browserslist database + run: npx update-browserslist-db@latest + + - name: Build main process run: npm run prestart env: NODE_ENV: development - # Linux-specific: Setup virtual display - - name: Setup display (Linux) - if: runner.os == 'Linux' + - name: Build renderer process + run: | + echo "Building renderer process..." + npm run build:renderer 2>&1 | tee build-output.log || (cat build-output.log && exit 1) + env: + NODE_ENV: production + # No code signing needed for test builds + SKIP_NOTARIZATION: 'true' + + - name: Copy renderer artifacts + run: | + mkdir -p .erb/renderer + cp -R release/app/dist/renderer/* .erb/renderer/ + + # Setup virtual display for headless testing + - name: Setup display run: | sudo apt-get update sudo apt-get install -y xvfb libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 echo "DISPLAY=:99" >> $GITHUB_ENV - - name: Start Xvfb (Linux) - if: runner.os == 'Linux' + - name: Start Xvfb run: | Xvfb :99 -screen 0 1920x1080x24 & sleep 3 @@ -63,12 +78,16 @@ jobs: ELECTRON_NO_UPDATER: '1' # Disable analytics in test DISABLE_ANALYTICS: '1' + # Ensure headless operation + ELECTRON_DISABLE_GPU: '1' + # No code signing needed for test builds + SKIP_NOTARIZATION: 'true' - name: Upload test results uses: actions/upload-artifact@v4 if: always() with: - name: test-results-${{ matrix.os }} + name: test-results path: | test-results/ playwright-report/ @@ -78,11 +97,11 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: failure-screenshots-${{ matrix.os }} + name: failure-screenshots path: test-results/screenshots/ retention-days: 7 - # Summary job that requires all matrix jobs to pass + # Summary job e2e-tests-summary: needs: e2e-tests runs-on: ubuntu-latest @@ -91,7 +110,7 @@ jobs: - name: Check E2E test results run: | if [ "${{ needs.e2e-tests.result }}" == "failure" ]; then - echo "E2E tests failed on one or more platforms" + echo "E2E tests failed" exit 1 fi echo "All E2E tests passed!" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 377a9b9..7e87733 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,23 +1,15 @@ name: Integration Tests on: - push: - branches: [develop] pull_request: - branches: [develop] + branches: [dev] jobs: integration-tests: - name: Integration Tests (Node ${{ matrix.node-version }}) - runs-on: ${{ matrix.os }} + name: Integration Tests + runs-on: ubuntu-latest timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - node-version: [18, 20] - services: postgres: image: postgres:16 @@ -37,14 +29,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' cache: 'npm' - - name: Install system dependencies (Ubuntu) - if: runner.os == 'Linux' + - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y libsecret-1-dev @@ -69,14 +60,13 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: integration-test-results-${{ matrix.os }}-node${{ matrix.node-version }} + name: integration-test-results path: | coverage/ test-results/ retention-days: 7 - name: Upload coverage to Codecov - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20' uses: codecov/codecov-action@v4 with: files: ./coverage/coverage-final.json diff --git a/e2e/fixtures/electron.fixture.ts b/e2e/fixtures/electron.fixture.ts index bd3b095..795f13e 100644 --- a/e2e/fixtures/electron.fixture.ts +++ b/e2e/fixtures/electron.fixture.ts @@ -114,6 +114,7 @@ export const test = base.extend({ } // Launch the Electron app + // In CI environments, Electron runs headless automatically via Playwright const electronApp = await electron.launch({ args: [ mainBundlePath, @@ -121,6 +122,9 @@ export const test = base.extend({ '--disable-gpu', '--no-sandbox', '--disable-dev-shm-usage', + // Additional CI-friendly flags + '--disable-software-rasterizer', + '--disable-extensions', ], env: { ...process.env, @@ -131,6 +135,10 @@ export const test = base.extend({ ELECTRON_NO_UPDATER: '1', // Disable analytics in tests DISABLE_ANALYTICS: '1', + // Ensure headless operation in CI + ...(process.env.CI === 'true' && { + ELECTRON_DISABLE_GPU: '1', + }), }, }); diff --git a/jest.integration.config.js b/jest.integration.config.js index b569f92..cf2efac 100644 --- a/jest.integration.config.js +++ b/jest.integration.config.js @@ -4,9 +4,18 @@ module.exports = { ...baseConfig, testMatch: ['**/tests/integration/**/*.test.ts'], testEnvironment: 'node', + // Integration tests don't need the build check - they run in Node.js, not Electron + setupFiles: [], setupFilesAfterEnv: ['/tests/setup/jest.integration.setup.ts'], testTimeout: 30000, maxWorkers: 1, + // Fix Jest Haste collision by ignoring release/app directory + modulePathIgnorePatterns: ['/release/app'], + testPathIgnorePatterns: [ + ...(baseConfig.testPathIgnorePatterns || []), + 'release/app/dist', + '.erb/dll', + ], moduleNameMapper: { ...baseConfig.moduleNameMapper, '^@services/(.*)$': '/src/main/services/$1', diff --git a/tests/integration/README.md b/tests/integration/README.md index b542b32..5d186f4 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -161,3 +161,6 @@ Use `tests/integration/utils/ipc-mock.ts` to mock `ipcMain` and test that handle - [ ] **Phase 5** - Git Service Integration Tests - [ ] **Phase 6** - AI Provider Integration Tests - [ ] **Phase 7** - CI/CD Pipeline Integration + + +Testing github actions pipeline? \ No newline at end of file