import type { Page, FrameLocator } from '@playwright/test'; import type { ChatBot, ChatMessageLogEntry, ChatRoom, CreateTestHostOptions, DevAccountName, HexString, LoginBehavior, NavigationLogEntry, NotificationLogEntry, PaymentLogEntry, PaymentTopUpBehavior, PermissionBehavior, PermissionLogEntry, PreimageEntry, SigningLogEntry, StatementSubmissionLogEntry, TestHostAPI, Theme, ThemeInput } from '../types.js'; export interface TestHost { /** The host page (contains the iframe) */ page: Page; /** FrameLocator for the embedded product iframe */ productFrame(): FrameLocator; /** Dispose container and recreate with a single account (iframe reloads) */ switchAccount(name: DevAccountName): Promise; /** Dispose container and recreate with multiple accounts (iframe reloads) */ setAccounts(names: DevAccountName[]): Promise; /** All auto-signed payloads since last clear */ getSigningLog(): Promise; /** Clear the signing log */ clearSigningLog(): Promise; /** Set how the host responds to remote permission requests */ setPermissionBehavior(behavior: PermissionBehavior): Promise; /** Pre-grant a permission without the product requesting it */ grantPermission(tag: string): Promise; /** Revoke a previously granted permission */ revokePermission(tag: string): Promise; /** List currently granted permissions */ getGrantedPermissions(): Promise; /** Enable or disable permission enforcement on signing (default: enabled) */ setEnforcePermissions(enforce: boolean): Promise; /** Get the log of all permission requests and their outcomes */ getPermissionLog(): Promise; /** Clear the permission log */ clearPermissionLog(): Promise; /** Get the log of navigation attempts from the product */ getNavigationLog(): Promise; /** Clear the navigation log */ clearNavigationLog(): Promise; /** Get the log of push notifications from the product */ getNotificationLog(): Promise; /** Clear the notification log */ clearNotificationLog(): Promise; /** List chat rooms the product has created in the current session */ getChatRooms(): Promise; /** List chat bots the product has registered in the current session */ getChatBots(): Promise; /** Get the log of messages posted by the product */ getChatMessageLog(): Promise; /** Clear all chat state (rooms, bots, messages, subscribers) */ clearChatState(): Promise; /** Inject an incoming chat action (peer message) into the product */ injectChatAction(action: { roomId: string; peer: string; payload: unknown; }): Promise; /** List preimages known to the test host (submitted + seeded) */ getPreimages(): Promise; /** Seed a preimage value; returns its key (blake2b-256 hash). */ seedPreimage(value: Uint8Array): Promise; /** Clear all preimages */ clearPreimages(): Promise; /** Get the log of statements submitted by the product */ getSubmittedStatements(): Promise; /** Inject a statement into the store; delivers to matching subscribers */ injectStatement(statement: unknown): Promise; /** Clear all statements */ clearStatements(): Promise; /** * Get the current theme as the upstream struct (`{ name, variant }`). * Use `theme.variant` for the light/dark sub-mode (`'Light' | 'Dark'`). */ getTheme(): Promise; /** * Set the theme and notify subscribers. * * Accepts `'light' | 'dark'` (mapped to the host's `Default` theme with * the matching variant) or the full `{ name, variant }` struct. */ setTheme(theme: ThemeInput): Promise; /** Set how the host responds to login requests */ setLoginBehavior(behavior: LoginBehavior): Promise; /** Whether the product is currently authenticated */ getIsAuthenticated(): Promise; /** Simulate user disconnect (unauthenticated state) */ simulateDisconnect(): Promise; /** Simulate user reconnect (authenticated state) */ simulateReconnect(): Promise; /** Set the mock payment balance */ setPaymentBalance(amount: bigint): Promise; /** Get the log of payment operations */ getPaymentLog(): Promise; /** Clear the payment log */ clearPaymentLog(): Promise; /** * Set how the host responds to `paymentTopUp` (default `'ok'`). Use * `{ type: 'partial', credited }` to drive products through the RFC-0021 * `PartialPayment` error path; the balance is bumped by `credited` and the * call rejects with `PaymentTopUpErr.PartialPayment({ credited })`. */ setPaymentTopUpBehavior(behavior: PaymentTopUpBehavior): Promise; /** Manually set a payment's status and notify subscribers */ simulatePaymentStatus(paymentId: string, status: { tag: string; value?: string; }): Promise; /** Wait until the product-sdk has connected to the host container */ waitForConnection(timeout?: number): Promise; } export interface TestHostFixtureOptions { /** URL of the product to test */ productUrl: string; /** Initial accounts — dev names or custom { name, uri } (default: ['alice']) */ accounts?: CreateTestHostOptions['accounts']; /** Networks the host can route (default: [PASEO_ASSET_HUB]) */ networks?: CreateTestHostOptions['networks']; /** Map product account requests to specific accounts (see CreateTestHostOptions.productAccounts) */ productAccounts?: CreateTestHostOptions['productAccounts']; } export declare function createTestHostFixture(defaults: TestHostFixtureOptions): { testHost: ({ page }: { page: Page; }, use: (fixture: TestHost) => Promise) => Promise; }; declare global { interface Window { __TEST_HOST__: TestHostAPI; } } //# sourceMappingURL=fixture.d.ts.map