Repository navigation
feat(attachments): attach logs, HAR files, videos, traces and HTML to tests - #12
Merged
Merged
Conversation
… tests
Adds reporter methods that upload a file against the current build and add
it to the current test or to its last step:
- attach_file(file_path, file_name=None) and attach_data(data, file_name)
for the whole test (video, trace, HAR, console log)
- attach_file_to_last_step / attach_data_to_last_step for the most recent
step (e.g. page.content() as page.html right after fail_step())
Uploads only need the build id, so they work in batch mode too. A rejected
upload raises AnglesApiError.
Also adds AttachmentRequests (POST /build/{buildId}/attachment, listing by
execution or build, file download and delete) with a longer timeout for
uploads, and `attachments` on CreateExecution, Execution and Step. Needs an
Angles server with test attachment support (AnglesHQ/angles, same branch
name).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgQXSUjuLVXmLWxobnMfSf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds reporter methods that upload a file against the current build and attach it to the current test, or to its last step:
attach_file(file_path, file_name=None)andattach_data(data, file_name)attach to the whole test.attach_file_to_last_stepandattach_data_to_last_stepattach to the most recent step.datamay bebytesorstr.AnglesApiError. Calling these without a started test, or*_to_last_stepwithout a step, raisesRuntimeErrorbefore anything is uploaded.AttachmentRequests(exported) covers upload from a path or from in-memory content, listing by execution or build, file download and delete. Uploads use a 300 s timeout instead of the 10 s JSON default, because videos and traces can be large.attachmentsonCreateExecution,ExecutionandStep(defaultNone, so they're left out of the JSON when unused).Depends on
AnglesHQ/angles#133 (the API).
Release
release-on-main.ymlpublishes the current version on merge and then bumps the patch. If you want this released as a minor version, bumppyproject.tomlfirst.Testing
New
tests/test_reporter_attachments.py(6 tests) covers:pytest: 21 passed (15 existing plus 6 new).Ran the client against a running instance with the new API:
.exeis rejected with a 400AnglesApiError🤖 Generated with Claude Code
https://claude.ai/code/session_01KgQXSUjuLVXmLWxobnMfSf
Generated by Claude Code