Skip to content

feat: Task-based download waiting and safe artifact saving - #87

Merged
ftes merged 2 commits into
mainfrom
feat/await-downloads
Sep 15, 2026
Merged

ftes merged 2 commits into
mainfrom
feat/await-downloads

Conversation

@ftes

@ftes ftes commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Adds download listeners that can be armed before an action and awaited afterward, with download metadata and file saving over local and WebSocket connections.

Supersedes #39.

Changes

  • Add Page.expect_download/2 and Page.await_download/1, with optional predicates on download metadata.
  • Use linked Tasks for one-shot event capture, with synchronous registration, one deadline, and owner/connection lifecycle handling.
  • Add Download.from_event/2, save_as/3, and delete/2. Saving preserves the source artifact so other readers can use it.
  • Stage artifact saves before replacing the destination, share one timeout across stream reads, and clean up files and streams on failure.
  • Handle expected connection failures at the process boundary and allow unexpected errors to propagate.

Compatibility

  • Breaking: :infinity disables timeouts; 0 means no waiting. Zero-timeout protocol commands fail without being sent, while frame URL/load-state waits check recorded state once. Migration guidance is in CHANGELOG.md.
  • Fix :infinity handling in frame waits and keyboard actions. Keyboard delays cannot extend a zero timeout.
  • URL predicate exceptions now propagate instead of becoming ordinary error results.

Validation

  • mix check: 209 tests passed, including formatting, Credo, compilation, and Dialyzer checks. The full suite also passed with the original failing CI seed (87788) and concurrency (8).
  • mix docs --warnings-as-errors passed.
  • GitHub Actions: build/lint and all 209 tests passed over both port and WebSocket transports.
  • Consumer compatibility: 6 phoenix_test_playwright download tests and 32 Fluffy download, URL, and assertion tests passed against the local implementation.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-15T08:04:08.697022Z 96fb4dd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 938f83619b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/playwright_ex/artifact.ex
@ftes ftes changed the title Add task-based download waiting and safe artifact saving feat: Task-based download waiting and safe artifact saving Sep 15, 2026
@ftes
ftes enabled auto-merge (squash) September 15, 2026 08:03
@ftes
ftes disabled auto-merge September 15, 2026 08:03
@ftes
ftes merged commit 48b461e into main Sep 15, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96fb4dda20

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/playwright_ex/event_waiter.ex
ftes added a commit that referenced this pull request Sep 15, 2026
Event waiters retained unrelated protocol events for their subscribed
channel. A waiter using `timeout: :infinity` could accumulate those
messages indefinitely.

Discard unrelated events and check the original deadline before
receiving again, so queued traffic cannot postpone an expired timeout.
Add regression coverage for mailbox draining, independent subscribers,
and timeout enforcement, plus module documentation and a changelog
entry.

Addresses the [review comment on
#87](#87 (comment)).

## Validation

- Both new regression tests failed before the fix and pass afterward.
- `mix check`: formatting, Credo, compilation, Dialyzer, and all 211
tests passed.
- All 211 tests passed over WebSocket using a local Playwright server;
Docker was unavailable for the container-based runner.
- `mix docs --warnings-as-errors` passed.
@ftes ftes mentioned this pull request Sep 15, 2026
@ftes
ftes deleted the feat/await-downloads branch September 15, 2026 09:39
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.

1 participant