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
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
import { freshExtensionTest as test } from '../../fixtures/extension.fixture'
|
|
import { TEN_SECONDS_MS } from '../../utils/timing'
|
|
|
|
test.describe('Extension Onboarding Flow', () => {
|
|
test('onboarding tab opens automatically on fresh install', async ({ context }) => {
|
|
// Wait for onboarding tab to open automatically
|
|
const onboardingPage = await context.waitForEvent('page', {
|
|
predicate: (page) => page.url().includes('onboarding.html'),
|
|
timeout: TEN_SECONDS_MS,
|
|
})
|
|
|
|
// Verify onboarding page loaded
|
|
expect(onboardingPage).toBeTruthy()
|
|
await onboardingPage.waitForLoadState('networkidle')
|
|
|
|
// Check that the onboarding page is loaded
|
|
// Look for onboarding-specific elements
|
|
await onboardingPage.waitForSelector('button, input, [data-testid]', { timeout: 5000 })
|
|
|
|
// Verify we're on the onboarding page
|
|
const title = await onboardingPage.title()
|
|
expect(title.toLowerCase()).toContain('lux')
|
|
})
|
|
|
|
test('background script initializes on fresh install', async ({ context }) => {
|
|
// Wait for any extension page to load
|
|
await context.waitForEvent('page', {
|
|
predicate: (page) => page.url().includes('chrome-extension://'),
|
|
timeout: 5000,
|
|
})
|
|
|
|
// Check for service workers or background pages
|
|
const backgroundPages = context.backgroundPages()
|
|
const serviceWorkers = context.serviceWorkers()
|
|
|
|
// Either background pages or service workers should exist
|
|
const hasBackground = backgroundPages.length > 0 || serviceWorkers.length > 0
|
|
expect(hasBackground).toBe(true)
|
|
})
|
|
})
|