/** * QA360 Cookie Manager Module * * P0: Cookie manipulation helpers * - Get/set/delete cookies with type safety * - Cookie filtering and searching * - Domain/path scoping * - Expiration handling */ import type { BrowserContext, Page } from '@playwright/test'; import type { Cookie } from '@playwright/test'; /** * Cookie creation options */ export interface CookieSetOptions { /** Cookie name */ name: string; /** Cookie value */ value: string; /** Cookie domain (defaults to current page domain) */ domain?: string; /** Cookie path (defaults to /) */ path?: string; /** Expiration date (Unix timestamp) or maxAge in seconds */ expires?: number; /** Max age in seconds (alternative to expires) */ maxAge?: number; /** Whether cookie is HTTP-only */ httpOnly?: boolean; /** Whether cookie is secure (HTTPS only) */ secure?: boolean; /** SameSite attribute */ sameSite?: 'Strict' | 'Lax' | 'None'; /** URL for setting cookie (used for domain inference) */ url?: string; } /** * Cookie filter options */ export interface CookieFilterOptions { /** Filter by name (supports wildcards) */ name?: string; /** Filter by domain */ domain?: string; /** Filter by path */ path?: string; /** Filter by secure flag */ secure?: boolean; /** Filter by httpOnly flag */ httpOnly?: boolean; /** Filter by sameSite attribute */ sameSite?: 'Strict' | 'Lax' | 'None'; } /** * Cookie Manager */ export declare class CookieManager { private context; constructor(context: BrowserContext); /** * Get all cookies */ all(): Promise; /** * Get cookies matching filter criteria */ filter(options: CookieFilterOptions): Promise; /** * Get a specific cookie by name */ get(name: string): Promise; /** * Get a cookie value by name */ getValue(name: string): Promise; /** * Check if a cookie exists */ has(name: string): Promise; /** * Set a cookie */ set(options: CookieSetOptions): Promise; /** * Set multiple cookies at once */ setMany(cookies: CookieSetOptions[]): Promise; /** * Update an existing cookie */ update(name: string, updates: Partial): Promise; /** * Delete a cookie by name */ delete(name: string): Promise; /** * Delete multiple cookies by name */ deleteMany(names: string[]): Promise; /** * Delete cookies matching filter criteria */ deleteFilter(options: CookieFilterOptions): Promise; /** * Clear all cookies */ clear(): Promise; /** * Clear cookies for a specific domain */ clearDomain(domain: string): Promise; /** * Get cookies count */ count(): Promise; /** * Export cookies as JSON string */ export(): Promise; /** * Import cookies from JSON string or array */ import(data: string | Cookie[]): Promise; /** * Get cookies grouped by domain */ byDomain(): Promise>; /** * Set a session cookie (no expiration) */ setSession(name: string, value: string, options?: Partial): Promise; /** * Set a cookie with max-age (in seconds) */ setWithMaxAge(name: string, value: string, maxAge: number, options?: Partial): Promise; /** * Set a cookie that expires in days */ setExpiringIn(name: string, value: string, days: number, options?: Partial): Promise; /** * Normalize cookie options to Playwright format */ private normalizeCookieOptions; /** * Check if cookie matches filter criteria */ private matchesFilter; /** * Simple wildcard matching */ private wildcardMatch; } /** * Convenience function to create cookie manager */ export declare function cookies(context: BrowserContext): CookieManager; /** * Convenience function to create cookie manager from page */ export declare function cookiesFromPage(page: Page): CookieManager;