Files
zeekay 169927b78b refactor: strip duplicate pkgs, consume @l.x/* from npm — keep only pkgs/wallet (canonical @luxfi/wallet bones)
- Delete pkgs/{analytics,api,config,eslint-config,gating,lx,notifications,
  prices,sessions,ui,utilities} — all identical to ~/work/lux/exchange
  canonical (MD5-matched). Now published to npm at @l.x/*; consume from
  there instead of vendoring.
- pkgs/wallet remains — this IS @luxfi/wallet (the uniswap-style extension
  + mobile wallet bones). Published at 1.0.10.
- Rewrite 3553 bare-path imports (uniswap/src/, ui/src/, utilities/src/,
  lx/src/, lux/src/) → explicit @l.x/* across 725 files.
- apps/{extension,mobile}/package.json: workspace:^ → npm ^versions for
  all @l.x/* / @luxfi/eslint-config; only @luxfi/wallet stays workspace.
- apps/{extension,mobile}/.eslintrc.js: RULES_DIR → node_modules/@l.x/lx/eslint_rules.

~315K line deletion. One canonical home: ~/work/lux/exchange.
2026-04-23 17:58:21 -07:00

57 lines
1.6 KiB
TypeScript

/* oxlint-disable typescript/no-explicit-any -- e2e test file */
import type { BrowserContext } from '@playwright/test'
import { sleep } from '@l.x/utils/src/time/timing'
export async function waitForExtensionLoad(
context: BrowserContext,
options?: {
timeout?: number
waitForOnboarding?: boolean
},
// oxlint-disable-next-line typescript/no-explicit-any -- biome-parity: oxlint is stricter here
let onboardingPage: any
while (Date.now() - startTime < timeout) {
// Check all pages
const pages = context.pages()
for (const page of pages) {
const url = page.url()
if (url.startsWith('chrome-extension://')) {
extensionId = url.split('/')[2]
if (url.includes('onboarding')) {
onboardingPage = page
}
break
}
}
// Check service workers (MV3 extensions use service workers, not background pages)
if (!extensionId) {
const workers = context.serviceWorkers()
for (const worker of workers) {
const url = worker.url()
if (url.startsWith('chrome-extension://')) {
extensionId = url.split('/')[2]
break
}
}
}
// If we found the extension and we're waiting for onboarding, keep checking
if (extensionId && options?.waitForOnboarding && !onboardingPage) {
// Continue waiting for onboarding page
} else if (extensionId) {
// We have what we need
break
}
await sleep(100)
}
if (!extensionId) {
throw new Error(`Extension failed to load within ${timeout}ms`)
}
return { extensionId, onboardingPage }
}