Skip to content

[Feature]: Add debug logging to _takePageSnapshot catch blockΒ #41536

Description

@faisalaffan

πŸš€ Feature Request

Related PR: #41502 (closed β€” ready to reopen once this issue is accepted)

Replace the empty catch {} in ArtifactsRecorder._takePageSnapshot with a debugLogger.log call so that AI snapshot failures during error context capture are observable via DEBUG=pw:api.

Location: packages/playwright/src/index.ts:747

- } catch {}
+ } catch {
+   debugLogger.log('api', 'ariaSnapshot: failed to capture snapshot during error (may be expected)');
+ }

Example

In a large test suite (500+ tests, AI mode enabled), some failing tests produce error-context.md without an aria snapshot. Today there is no way to tell whether the snapshot was never attempted or failed silently.

After this change, running with DEBUG=pw:api would show:

pw:api ariaSnapshot: failed to capture snapshot during error (may be expected) +0ms

No change to user-facing behavior β€” the original test error still propagates. The debug log is purely for troubleshooting.

Motivation

_takePageSnapshot is best-effort artifact collection. When it fails, the failure should be observable. Currently the empty catch {} makes it impossible to distinguish "snapshot was never attempted" from "snapshot failed due to timeout/network/model error." A single debugLogger.log call provides this visibility without changing control flow or adding noise for regular users.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions