import type { Viewport, Media } from './types.js'; /** * Geolocation coordinates to emulate. */ export interface Geolocation { /** * Latitude between -90 and 90. */ latitude: number; /** * Longitude between -180 and 180. */ longitude: number; /** * Non-negative accuracy value. */ accuracy?: number; } /** * Options for granting permissions dynamically. */ export interface GrantPermissionsOptions { /** * Origin to grant permissions for. If not specified, permissions are granted to all origins. */ origin?: string; } /** * Class to emulate different environment features like viewport size, media, * geolocation, permissions, and offline mode. * * @use when * - Overriding device settings dynamically during a test (e.g. testing responsive layout * breakpoint transitions, dark mode switching, geolocation updates, or offline network behaviors). * * @dont use when * - Setting static configuration options that are best configured via the main Lupa config file. */ export declare class Emulation { /** * Changes the size of the viewport. * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.setViewport({ width: 375, height: 667 }) * ``` */ setViewport(viewport: Viewport): Promise; /** * Emulates media features. * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.emulateMedia({ colorScheme: 'dark' }) * ``` */ emulateMedia(media: Media): Promise; /** * Sets the geolocation for the browser context dynamically. * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.setGeolocation({ latitude: 48.8584, longitude: 2.2944 }) * ``` */ setGeolocation(geolocation?: Geolocation): Promise; /** * Grants permissions to the browser context dynamically. * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.grantPermissions(['geolocation']) * ``` */ grantPermissions(permissions: string[], options?: GrantPermissionsOptions): Promise; /** * Clears all permissions granted dynamically. * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.clearPermissions() * ``` */ clearPermissions(): Promise; /** * Toggles the offline state of the browser context. * * > [!IMPORTANT] * > **Persistence Notice**: Unlike `network.setOffline(...)`, this method changes the global context state. * > The context will remain offline until it is explicitly set back to online (i.e. it does not * > automatically revert at the end of the test). * * @example * ```typescript * import { emulation } from '@pawel-up/lupa/commands' * * await emulation.setOffline(true) * ``` */ setOffline(offline: boolean): Promise; } export declare const emulation: Emulation;