diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 5ce4759..01bc0ce 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -2,9 +2,9 @@ name: E2E on: push: - branches: [ main, master ] + branches: [main, master] pull_request: - branches: [ '**' ] + branches: ['**'] jobs: test-e2e: @@ -28,9 +28,6 @@ jobs: - name: Setup Chrome uses: browser-actions/setup-chrome@v1 - - name: Install Playwright Browsers - run: npx playwright install --with-deps chromium - - name: Set Playwright Chrome executable for CI run: echo "PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/google-chrome" >> $GITHUB_ENV @@ -45,6 +42,9 @@ jobs: - name: Install dependencies run: npm ci --no-audit --no-fund + - name: Install Playwright Browsers + run: npx playwright install --with-deps chromium + - name: Prepare E2E config and data fixtures run: | mkdir -p src/assets/data diff --git a/e2e/app.spec.ts b/e2e/app.spec.ts index 1c85685..60e5416 100644 --- a/e2e/app.spec.ts +++ b/e2e/app.spec.ts @@ -3,17 +3,11 @@ import { test, expect } from '@playwright/test'; test.describe('Git Catalogue App', () => { test('should load the application', async ({ page }) => { - // Navigate to the application await page.goto('/'); - - // Wait for the page to load - await page.waitForLoadState('networkidle'); - - // Check that the page loaded successfully by looking for Angular content - // The app should have loaded without critical errors + + // Web-first assertions auto-wait; avoid networkidle, which hangs on the + // external Google Fonts CDN and makes this flaky on CI. await expect(page).toHaveTitle('GitCatalogue'); - - // Check that the main app component is present await expect(page.locator('app-root')).toBeVisible(); }); @@ -37,13 +31,12 @@ test.describe('Git Catalogue App', () => { } }); - // Navigate to the application await page.goto('/'); - - // Wait for the page to fully load - await page.waitForLoadState('networkidle'); - - // Assert that there are no critical console errors + + // Wait for Angular to bootstrap rather than networkidle, which never + // settles when the external Google Fonts CDN stalls on CI. + await expect(page.locator('app-root')).toBeVisible(); + expect(errors).toEqual([]); }); }); \ No newline at end of file