diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56005ea..fd5edb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,13 +48,13 @@ jobs: - name: Run E2E tests env: NEXT_PUBLIC_API_URL: localhost:8088 - NEXT_PUBLIC_FIREBASE_ENV: PROD + NEXT_PUBLIC_FIREBASE_ENV: DEV NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }} NEXT_PUBLIC_SUPABASE_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_KEY }} run: | yarn --cwd=web serve & npx wait-on http://localhost:3000 - npx playwright test tests/playwright + npx playwright test tests/e2e SERVER_PID=$(fuser -k 3000/tcp) echo $SERVER_PID kill $SERVER_PID diff --git a/.gitignore b/.gitignore index 9e813ed..29d68d4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ # testing /coverage +# Playwright +/tests/reports/playwright-report + # next.js /.next/ /out/ diff --git a/package.json b/package.json index 131eb76..4df114d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,10 @@ "sync-android": "./scripts/sync_android.sh", "migrate": "./scripts/migrate.sh", "test": "jest", + "playwright": "playwright test", + "playwright:ui": "playwright test --ui", + "playwright:debug": "playwright test --debug", + "playwright:report": "npx playwright show-report tests/reports/playwright-report", "test:watch": "jest --watch", "test:coverage": "jest --coverage", "test:update": "jest --updateSnapshot", diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..88f4847 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,28 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + testDir: './tests/e2e', + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: process.env.CI ? 1 : undefined, + reporter: [['html', {outputFolder: `tests/reports/playwright-report`, open: 'on-falure'}]], + use: { + baseURL: 'http://localhost:3000', + trace: 'on-first-retry', + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, + // { + // name: 'webkit', + // use: { ...devices['Desktop Safari'] }, + // }, + ], +}); \ No newline at end of file diff --git a/tests/e2e/web/.auth/.keep b/tests/e2e/web/.auth/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/e2e/web/components/.keep b/tests/e2e/web/components/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/e2e/web/pages/.keep b/tests/e2e/web/pages/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/playwright/some.test.ts b/tests/e2e/web/specs/some.test.ts similarity index 66% rename from tests/playwright/some.test.ts rename to tests/e2e/web/specs/some.test.ts index c5383a5..1e7e2c4 100644 --- a/tests/playwright/some.test.ts +++ b/tests/e2e/web/specs/some.test.ts @@ -1,7 +1,8 @@ import {expect, test} from '@playwright/test'; test('shows', async ({page}) => { - // await page.goto('http://localhost:3000/profile'); // Adjust this to your route + await page.goto('/'); // Adjust this to your route + expect(await page.title()).toBe('Compass'); // // const spinner = page.locator('[data-testid="spinner"]'); // await expect(spinner).toBeVisible(); diff --git a/tests/e2e/web/utils/.keep b/tests/e2e/web/utils/.keep new file mode 100644 index 0000000..e69de29