PlaywrightEx.Artifact (PlaywrightEx v0.13.0)

Copy Markdown View Source

Interact with a Playwright Artifact.

Artifacts are Playwright-owned files produced by operations such as tracing or downloads. Local Playwright connections expose a finished artifact path directly, while remote connections require streaming the artifact bytes through the protocol.

Summary

Functions

Deletes an artifact from Playwright.

Saves an artifact to path.

Types

opt()

@type opt() :: {:connection, GenServer.name()} | {:timeout, timeout()}

Functions

delete(artifact_guid, opts \\ [])

@spec delete(PlaywrightEx.guid(), [opt() | PlaywrightEx.unknown_opt()]) ::
  {:ok, any()} | {:error, any()}

Deletes an artifact from Playwright.

save_as(artifact_guid, path, opts \\ [])

@spec save_as(PlaywrightEx.guid(), Path.t(), [opt() | PlaywrightEx.unknown_opt()]) ::
  :ok | {:error, any()}

Saves an artifact to path.

Copies locally or streams over WebSocket, preserving the source artifact. Creates parent directories and replaces the destination only when saving succeeds. Temporary files and streams are cleaned up on failure.

The required :timeout covers the whole transfer. 0 times out immediately; :infinity disables the timeout. Cleanup may outlast the transfer timeout. Expected cleanup errors preserve the transfer result; unexpected errors propagate.