Skip to content

fix(playwright): don't block on debug element preview when element is removed - #5740

Open
mirao wants to merge 1 commit into
codeceptjs:4.xfrom
mirao:fix/playwright-debug-preview-stall
Open

mirao wants to merge 1 commit into
codeceptjs:4.xfrom
mirao:fix/playwright-debug-preview-stall

Conversation

@mirao

@mirao mirao commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #5739

Problem

With --verbose / --debug, _locate() previews the found elements via elToString() → Locator.evaluate(). Locators returned by .all() auto-wait for the element to be attached, so if the element is removed between .all() and evaluate(), the step (e.g. I.dontSeeElement()) blocks for the full helper timeout and fails with TimeoutError: evaluate: Timeout ...ms exceeded. Without debug mode the same test never stalls.

Fix

Make the debug preview best-effort: evaluate() gets a 100 ms timeout and falls back to <unavailable> instead of blocking or failing the step.

Test

Added a regression test to test/helper/Playwright_test.js that removes the element right after Locator.all() resolves and asserts _locate() returns in under 1 s in debug mode. It fails without the fix (timeout) and passes with it.

The repro from the issue (200 iterations, --verbose): 18/200 stalls, 55 s before → 0/200 stalls, 2 s after.

🤖 Generated with Claude Code

… removed

In debug mode _locate() previews found elements via Locator.evaluate(),
which auto-waits for the element to be attached. If the element was removed
between all() and evaluate(), the step blocked for the full helper timeout
and failed. Make the preview best-effort with a short timeout.

Fixes codeceptjs#5739

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playwright: debug logging in _locate() blocks for the full timeout when the element is removed (--verbose/--debug)

1 participant