From 76ed7d54063f57f60f1670c79ec79132f6a3ee02 Mon Sep 17 00:00:00 2001 From: Matt Obee Date: Sun, 9 Feb 2025 22:48:00 +0000 Subject: [PATCH] Formatting --- .github/workflows/tests.yml | 2 +- playwright.config.js | 36 +++++++++++++++++++++++------------- tests/theme.spec.ts | 4 ++-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e0e2398..39c2f8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: - name: Run tests env: PLAYWRIGHT_TEST_BASE_URL: 'https://deploy-preview-${{ env.GITHUB_PR_NUMBER }}--eventua11y.netlify.app/' - DEBUG: "pw:api,pw:browser*,pw:protocol*" + DEBUG: 'pw:api,pw:browser*,pw:protocol*' CI: 'true' run: | echo "Starting Playwright tests..." diff --git a/playwright.config.js b/playwright.config.js index 75caf2b..b6e8d5a 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -46,28 +46,38 @@ export default defineConfig({ waitForNavigation: 'networkidle', // CI-specific browser launch options - launchOptions: process.env.CI ? { - args: ['--no-sandbox', '--disable-setuid-sandbox'], - } : undefined, + launchOptions: process.env.CI + ? { + args: ['--no-sandbox', '--disable-setuid-sandbox'], + } + : undefined, // Use persistent context in CI to reduce browser startup overhead - contextOptions: process.env.CI ? { - acceptDownloads: false, - strictSelectors: true, - } : undefined, + contextOptions: process.env.CI + ? { + acceptDownloads: false, + strictSelectors: true, + } + : undefined, }, // Configure projects for major browsers. projects: [ { name: 'chromium', - use: { + use: { ...devices['Desktop Chrome'], // Additional chromium-specific settings for CI - launchOptions: process.env.CI ? { - executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH, - args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'], - headless: true - } : undefined, + launchOptions: process.env.CI + ? { + executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH, + args: [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-gpu', + ], + headless: true, + } + : undefined, }, }, { diff --git a/tests/theme.spec.ts b/tests/theme.spec.ts index af50798..6ba255a 100644 --- a/tests/theme.spec.ts +++ b/tests/theme.spec.ts @@ -11,13 +11,13 @@ test.describe('Theme Switching', () => { // Reset system preference and load page await page.emulateMedia({ colorScheme: 'light' }); await page.goto('/'); - + // Wait for critical components to be ready await Promise.all([ page.waitForLoadState('networkidle'), page.waitForLoadState('domcontentloaded'), page.waitForSelector('#upcoming-events', { state: 'visible' }), - page.waitForSelector('#theme-selector-button', { state: 'visible' }) + page.waitForSelector('#theme-selector-button', { state: 'visible' }), ]); // Ensure clean state with more reasonable drawer handling