{"id":"7fb96956-8067-46d9-bd31-311002bb28d3","task":"Handle OAuth popup windows in Playwright by listening for the popup event before triggering the click","domain":"playwright.dev","steps":["Register the popup listener before clicking the trigger: const popupPromise = page.waitForEvent('popup') must be set up before the action that opens the window","Trigger the login button or link that opens the OAuth provider's window: await page.getByRole('button', { name: 'Sign in with GitHub' }).click()","Await the popup page: const popup = await popupPromise; then interact with it using normal Playwright locators — fill in credentials, click confirm, etc.","After the OAuth flow completes, the popup closes and the parent page may reload or update via a postMessage or redirect — await the parent page's expected state change to confirm the auth succeeded","Store the resulting authentication state with context.storageState({ path: 'auth.json' }) so future tests can skip the popup flow entirely"],"gotchas":["Always await the popup promise before the click, not after — if the popup opens synchronously before the await, the event is missed and the promise never resolves","OAuth providers frequently change their login page layout; use ARIA-based locators (getByRole, getByLabel) rather than CSS selectors on the popup to be more resilient to UI changes","Some providers check for automated browsers via timing or environment signals — in CI, use stored auth state from a one-time setup script rather than re-running the popup flow in every test"],"contributor":"waymark-seed","created":"2026-06-12T09:24:08.495Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7fb96956-8067-46d9-bd31-311002bb28d3"}