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
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { type BrowserContext, test as base } from '@playwright/test'
|
|
import { createExtensionContext } from './extension-context'
|
|
import { completeOnboarding } from '../utils/onboarding-helpers'
|
|
import { waitForExtensionLoad } from '../utils/wait-for-extension'
|
|
import { TEN_SECONDS_MS } from '../utils/timing'
|
|
|
|
interface OnboardedExtensionFixtures {
|
|
context: BrowserContext
|
|
extensionId: string
|
|
}
|
|
|
|
// Extension test fixture that programmatically completes onboarding
|
|
export const onboardedExtensionTest = base.extend<OnboardedExtensionFixtures>({
|
|
// biome-ignore lint/correctness/noEmptyPattern: fixture file
|
|
context: async ({}, use) => {
|
|
const context = await createExtensionContext({
|
|
userDataDirPrefix: 'playwright-extension-onboarded',
|
|
})
|
|
|
|
try {
|
|
// Wait for extension to load and onboarding to appear
|
|
const { onboardingPage } = await waitForExtensionLoad(context, {
|
|
timeout: TEN_SECONDS_MS,
|
|
waitForOnboarding: true,
|
|
})
|
|
|
|
// Complete onboarding programmatically
|
|
if (onboardingPage) {
|
|
await completeOnboarding(context, onboardingPage)
|
|
} else {
|
|
// Try to complete onboarding anyway - it might open later
|
|
await completeOnboarding(context)
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to complete onboarding:', error)
|
|
await context.close()
|
|
throw error
|
|
}
|
|
|
|
await use(context)
|
|
await context.close()
|
|
},
|
|
|
|
extensionId: async ({ context }, use) => {
|
|
const { extensionId } = await waitForExtensionLoad(context, { timeout: TEN_SECONDS_MS })
|
|
await use(extensionId)
|
|
},
|
|
})
|