feat(attachments): let automated tests attach logs, HAR files, videos, traces and HTML - #133
Merged
snevesbarros merged 2 commits intoOct 3, 2026
Merged
Conversation
…, traces and HTML Automated tests can now upload files with their results and show them on the execution: - POST /build/:buildId/attachment stores a file against the build while the test runs (the execution does not exist yet, the same reason screenshots hang off the build). The kind and the type it is served with come from the file extension, never the client's mime type: log/txt, json, har, webm/mp4, zip (trace or archive), html/htm and images. The size limit is ANGLES_ATTACHMENT_MAX_SIZE_MB (default 100). - Executions list the returned ids in `attachments`, or on a step's `attachments`, for POST /execution and PUT /build/:id/executions. Ids that were not uploaded against the execution's own build are dropped, and the rest are linked to the execution when it is saved. - GET /attachment?executionId= or ?buildId= lists them without server paths. - Files are served with nosniff and a sandbox CSP. HTML snapshots, traces and archives are always downloads, so a snapshot's scripts never run on the API origin. Range requests work, so videos can be seeked. - Deleting an attachment removes its references; deleting an execution or build (including the nightly clean-up) removes its files. Also documents the endpoints in swagger.json and docs/test-attachments.md, adds the attachment indexes to the Mongo init scripts, and exposes the size limit in docker-compose and the Kubernetes config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KgQXSUjuLVXmLWxobnMfSf
This was referenced Oct 3, 2026
…oard-sdet-features-g34tzr
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
Automated tests can now attach files to their results and have them shown on the execution: console logs, network HAR files, videos, Playwright traces, page HTML snapshots and images.
A test only creates its execution when it finishes (or, in batch mode, when the whole run finishes), so files are uploaded against the build while the test runs, the same way screenshots are. The execution then lists the returned ids when it's saved, either for the whole test or on a step.
API
POST /build/:buildId/attachment(multipart fieldattachment). The kind and the type the file is served with come from the file extension, never from the client's mime type:.log/.txt: log.json: json.har: har.webm/.mp4: video.zip: trace when the name contains "trace", otherwise archive.html/.htm: html.png/.jpg/.jpeg/.gif/.webp: imageAny other extension is rejected with a 400. The size limit is
ANGLES_ATTACHMENT_MAX_SIZE_MB(default 100). The response never includes server paths.attachmentson an execution, and on a step'sattachments, for bothPOST /executionandPUT /build/:id/executions. Ids that weren't uploaded against the execution's own build are dropped. The rest are linked to the execution when it's saved, so an execution can never claim another build's (or team's) file. Malformed ids return a 422.GET /attachment?executionId=and?buildId=list a test's or a build's attachments (metadata only).GET /attachment/:id/fileserves files withX-Content-Type-Options: nosniffandContent-Security-Policy: sandbox. HTML snapshots, traces and archives are always served as downloads, so a snapshot's scripts never run on the API origin with the viewer's session. Range requests work, so videos can be seeked. Add?download=trueto force a download.Clean-up:
DELETE /attachment/:idalso removes the file's references from executions and steps.Also
swagger.jsonand addsdocs/test-attachments.md.buildandexecutionattachment indexes tosetup/mongo-init.jsand the Kubernetes init script.ANGLES_ATTACHMENT_MAX_SIZE_MBindocker-compose.ymland the Kubernetes ConfigMap.Compatibility
Every execution response now includes an
attachmentsarray. Released clients are unaffected: the Java client's Gson ignores unknown fields, the Python client returns plain dicts, and in JavaScript an extra property is harmless.Related PRs (merge this one first)
attachFile/attach_fileand friendsTesting
test/test-attachment.tests.js(24 tests) covers:POST /executionand from batchesnpx eslint app testis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01KgQXSUjuLVXmLWxobnMfSf
Generated by Claude Code