mirror of
https://github.com/luxfi/extension.git
synced 2026-10-30 16:56:33 +00:00
- Add Playwright test infrastructure with Chrome extension support - Add E2E tests: basic-setup, onboarding-flow, sidebar-loads, wallet-connection - Add test-chrome job that runs after builds in CI - Add test-firefox job with web-ext validation and load test - Add test-safari job with Xcode build for macOS and iOS Simulator - Update workflow to run tests on PRs as well as releases - Add validate:firefox script for local Firefox manifest validation Tests verify: - Extension loads successfully - Background script/service worker initializes - Manifest is valid - Onboarding page opens on install
80 lines
1.6 KiB
TypeScript
80 lines
1.6 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
|
|
const IS_CI = process.env.CI === 'true'
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e/tests',
|
|
testMatch: '**/*.test.ts',
|
|
|
|
// Run tests sequentially - extensions need careful handling
|
|
workers: 1,
|
|
fullyParallel: false,
|
|
|
|
// Fail fast in CI
|
|
maxFailures: IS_CI ? 5 : undefined,
|
|
|
|
// Retry failed tests in CI
|
|
retries: IS_CI ? 2 : 0,
|
|
|
|
// Reporter
|
|
reporter: IS_CI
|
|
? [['html', { open: 'never' }], ['github'], ['list']]
|
|
: [['html', { open: 'on-failure' }], ['list']],
|
|
|
|
// Global timeout
|
|
timeout: 60_000,
|
|
|
|
// Expect timeout
|
|
expect: {
|
|
timeout: 10_000,
|
|
},
|
|
|
|
use: {
|
|
// Collect trace on failure
|
|
trace: 'retain-on-failure',
|
|
|
|
// Screenshot on failure
|
|
screenshot: 'only-on-failure',
|
|
|
|
// Video on failure
|
|
video: 'retain-on-failure',
|
|
|
|
// Extensions require headed mode
|
|
headless: false,
|
|
|
|
// Default viewport
|
|
viewport: { width: 1280, height: 720 },
|
|
|
|
// Base URL for extension pages
|
|
baseURL: 'chrome-extension://',
|
|
},
|
|
|
|
// Output directory for test artifacts
|
|
outputDir: './e2e/test-results',
|
|
|
|
// Projects for different browsers
|
|
projects: [
|
|
{
|
|
name: 'chrome',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
channel: 'chrome',
|
|
},
|
|
},
|
|
// Firefox project (limited extension support in Playwright)
|
|
// {
|
|
// name: 'firefox',
|
|
// use: {
|
|
// ...devices['Desktop Firefox'],
|
|
// },
|
|
// },
|
|
],
|
|
|
|
// Web server to run before tests (if needed)
|
|
// webServer: {
|
|
// command: 'pnpm dev',
|
|
// port: 9998,
|
|
// reuseExistingServer: !IS_CI,
|
|
// },
|
|
})
|