Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api/results.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ POST /results/:uploadId/download
| Field | Values | Description |
|-------|--------|-------------|
| `results` | `FAILED`, `ALL` | Which test artifacts to include. |
| `resultId` | A result ID (optional) | Only the files of the flow run this result belongs to: its first attempt and every retry, on that one device. `report.xml` then covers just that run. Use the `id` of a result from [Get results](#get-results). A value that isn't a positive whole number is a `400`, and a result that isn't in this upload is a `404`. |

**Example**

Expand All @@ -174,3 +175,13 @@ curl -X POST https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f
-d '{"results": "FAILED"}' \
-o artifacts.zip
```

To download one flow run only, add its result ID:

```bash
curl -X POST https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f1d12a/download \
-H "x-app-api-key: <key>" \
-H "Content-Type: application/json" \
-d '{"results": "ALL", "resultId": 4446290}' \
-o artifacts.zip
```
22 changes: 21 additions & 1 deletion artifacts/artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Each test run generates:

* Logs
* Screenshots, including the diff image from every [`assertScreenshot`](../advanced/visual-testing.md#reading-a-failure) that doesn't match, whether it failed the flow or was `optional: true` and only warned
* A screenshot and a screen hierarchy (the on-screen element tree, as JSON) for each step that failed or warned, on Maestro 2.7 and later
* Videos
* Test reports

Expand Down Expand Up @@ -38,6 +39,9 @@ Use the [`dcd artifacts`](../cli/dcd-artifacts.md) command to download artifacts
# Download a zip of all artifacts
dcd artifacts --upload-id <uuid> --download-artifacts ALL

# Download one flow's artifacts only
dcd artifacts --upload-id <uuid> --download-artifacts ALL --flow login

# Download a JUnit report
dcd artifacts --upload-id <uuid> --report junit

Expand All @@ -63,21 +67,37 @@ artifacts.zip
│ ├── logs/
│ │ ├── login-maestro.log
│ │ ├── login-commands.json
│ │ ├── login-step-004-tapOn.json
│ │ ├── login-step-009-tapOn.json
│ │ └── ...
│ ├── screenshots/
│ │ ├── login-failure-screenshot.jpg
│ │ ├── login-step-004-tapOn.jpg
│ │ └── login-diff-screenshots-home_diff.png
│ └── videos/
│ └── login-recording.mp4
├── 4502/
│ ├── logs/
│ ├── screenshots/
│ └── videos/
└── report.xml # merged JUnit report covering every test in the upload
└── report.xml # merged JUnit report covering every test in the download
```

Files are named after the flow file (without its extension), e.g. `login-maestro.log` for `login.yaml`. In `screenshots/`, a failed flow has one `-failure-screenshot.jpg` of the whole screen, each `takeScreenshot` is named after its `path` (`login-home.jpg` for `takeScreenshot: home`), and each `assertScreenshot` diff is named after its baseline (see [Reading a failure](../advanced/visual-testing.md#reading-a-failure)). Screenshots taller than 1080 px are downscaled to 1080 px tall and saved as JPEG; smaller ones, such as a crop made with `cropOn`, keep their size. Diffs are always full-size PNGs. The `logs/` folder also holds stdout/stderr, the device log (`-logcat.zip` on Android, `-ios-device-log.zip` on iOS) and any per-flow reports. With `--download-artifacts FAILED`, only failed tests get a folder, but `report.xml` is always included and still covers every test.

### Step screenshots and screen hierarchies

On Maestro 2.7 and later, each step that failed or warned (an `optional: true` step that didn't succeed) also has:

* its screen hierarchy in `logs/`, named `<flow>-step-<NNN>-<command>.json`
* its screenshot in `screenshots/`, named `<flow>-step-<NNN>-<command>.jpg`

The flow's `commands.json` lists these as `SCREEN_HIERARCHY` and `SCREENSHOT` artifacts at the paths Maestro wrote them to, such as `screen-hierarchy/step-009-tapOn.json` and `screenshots/step-009-tapOn.png`. To find a step's files in the archive, match on the `step-<NNN>` number. Two differences from those paths: screenshots are saved as JPEG like every other screenshot, and the step that failed the flow keeps its screenshot under the usual `-failure-screenshot.jpg` name. Secret-named variables are masked in screen hierarchies as they are in `commands.json`, within the limits in [Environment Variables](../configuration/environment-variables.md).

### One flow at a time

`--flow` or `--result-id` narrows the download to one flow on one device: its first attempt and every retry, each in its own result-ID folder. `report.xml` then covers just that flow. See the [`dcd artifacts` reference](../cli/dcd-artifacts.md) for how `--flow` matches a flow.

Each [retry](../advanced/retry-strategies.md#seeing-every-attempt) attempt gets its own result-ID folder, so the failed attempt's screenshots and video are in the zip even if a retry passed.

## Report formats
Expand Down
14 changes: 13 additions & 1 deletion cli/dcd-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Pass exactly one of `--download-artifacts` or `--report`.
|------|-------------|
| `--download-artifacts <ALL\|FAILED>` | Download a zip of logs, screenshots, and videos. `ALL` includes every test; `FAILED` includes only failed tests. Mutually exclusive with `--report` |
| `--artifacts-path <path>` | Output path for the artifacts zip (default: `./artifacts.zip`). Requires `--download-artifacts` |
| `--result-id <id>` | Download only one result's artifacts: that flow's first attempt and every retry, on that one device. Requires `--download-artifacts`. Mutually exclusive with `--flow` |
| `--flow <file-or-name>` | Download only one flow's artifacts, by its file path (`flows/login.yaml`), file name (`login.yaml`) or name (`login`). If it matches more than one result, for example one per device in a [device matrix](../configuration/device-matrix.md), the command fails and lists the result IDs to pass to `--result-id`. Requires `--download-artifacts`. Mutually exclusive with `--result-id` |

### Report Download

Expand All @@ -46,7 +48,7 @@ Pass exactly one of `--download-artifacts` or `--report`.
| `--json` | Print the result as one JSON object: `status` (`SUCCESS` or `FAILED`), `uploadId`, and `downloads`, with one entry per file giving its `type`, `path`, `ok` and, if it failed, `error` |
| `--debug` | Enable detailed debug logging |

A download that fails prints a warning, and the command still exits `0`. With `--json`, it exits `1` when every download failed.
A download that fails prints a warning, and the command exits `1`, with or without `--json`. Every ZIP download is checked for completeness: if a download ends early, the command retries it once through a slower route, and if that one is also incomplete, it deletes the partial file and fails.

## Examples

Expand All @@ -60,6 +62,16 @@ dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --download-artifa
dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --download-artifacts FAILED --artifacts-path ./failed-artifacts.zip
```

**Download artifacts for one flow:**
```bash
dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --download-artifacts ALL --flow login
```

**Download artifacts for one result, for example one device of a matrix:**
```bash
dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --download-artifacts ALL --result-id 4446290
```

**Download a JUnit report:**
```bash
dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --report junit
Expand Down
2 changes: 1 addition & 1 deletion configuration/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Variables whose names start with `MAESTRO_` are also set in the environment of t

## Masking Secrets

Values of variables whose names contain a keyword such as `PASSWORD`, `TOKEN`, `SECRET` or `API_KEY` are masked in the result log and in the downloadable `maestro.log`, stdout/stderr and `commands.json` — see [Inspecting Variables](../artifacts/inspecting-variables.md) for the full list of keywords. Masking has limits:
Values of variables whose names contain a keyword such as `PASSWORD`, `TOKEN`, `SECRET` or `API_KEY` are masked in the result log and in the downloadable `maestro.log`, stdout/stderr, `commands.json` and step screen hierarchies — see [Inspecting Variables](../artifacts/inspecting-variables.md) for the full list of keywords. Masking has limits:

- Values passed with `--env` / `-e` are only masked if they're 5 or more characters long, so a short value such as a 4-digit PIN stays visible.
- Literal values assigned in a script, such as `password = '...'`, are masked. Values written directly in a flow's `env:` block, and values computed at runtime (`output.*`), are not.
Expand Down
4 changes: 3 additions & 1 deletion mcp/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ Download a completed run's artifacts zip (videos, logs and screenshots) to local
|-----------|------|-------------|
| `uploadId` | string | **Required.** UUID of the upload to download artifacts for |
| `type` | `ALL` \| `FAILED` | Which tests to include artifacts for (default `ALL`) |
| `artifactsPath` | string | Where to write the artifacts zip (default `./artifacts.zip`), relative to the server's working directory, which your MCP client chooses. It must stay inside that folder, and a file the server didn't write is never replaced |
| `artifactsPath` | string | Where to write the artifacts zip (default `./artifacts.zip`). A relative path is from the server's working directory, which your MCP client chooses, so prefer an absolute path |
| `resultId` | integer | Only this result's artifacts: its flow's first attempt and every retry, on that one device. Can't be combined with `flow` |
| `flow` | string | Only this flow's artifacts, by its file path (`flows/login.yaml`), file name or name (`login`). When it matches several results, for example one per device, the download fails with a warning that lists their IDs to pass as `resultId`. Can't be combined with `resultId` |
| `report` | `junit` \| `allure` \| `html` | Also download a formatted report of this type. `allure` is deprecated, see [Deprecations & Removals](../getting-started/deprecations.md) |
| `reportPath` | string | Where to write the report (defaults by type: `report.xml` for `junit`, `report.zip` for `html`, `report.html` for `allure`). The `html` report is a ZIP. It follows the same rules as `artifactsPath` |

Expand Down
40 changes: 33 additions & 7 deletions public/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ paths:
for the whole upload is at the root. Every attempt's files are included,
so a retried test's failed attempt can still be debugged.

Pass `resultId` to get one flow run only: that result's first attempt and
every retry, on its one device. `report.xml` then covers just that run.

The ZIP is streamed as it is built. An error after streaming starts ends
the download early, leaving a truncated ZIP.
parameters:
Expand Down Expand Up @@ -496,16 +499,25 @@ paths:
contentMediaType: application/zip
'400':
description: |
`uploadId` isn't a UUID (JSON), or the ZIP couldn't be assembled (the
message as plain text).
`uploadId` isn't a UUID or `resultId` isn't a positive whole number
(JSON), or the ZIP couldn't be assembled (the message as plain text).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
statusCode: 400
message: Validation failed (uuid is expected)
error: Bad Request
examples:
badUploadId:
summary: uploadId isn't a UUID
value:
statusCode: 400
message: Validation failed (uuid is expected)
error: Bad Request
badResultId:
summary: resultId isn't a positive whole number
value:
statusCode: 400
message: resultId must be a positive whole number
error: Bad Request
text/plain:
schema:
type: string
Expand All @@ -516,7 +528,7 @@ paths:
The upload has no results in your team, or doesn't exist. Unlike
the report downloads, this one answers with the standard error envelope.
For a key with **CI: run tests only** access, also a run that key didn't
start.
start. With `resultId`, also a result that isn't in this upload.
content:
application/json:
schema:
Expand All @@ -534,6 +546,12 @@ paths:
statusCode: 404
message: Upload not found
error: UPLOAD_NOT_FOUND
resultNotInUpload:
summary: A resultId from another upload
value:
statusCode: 404
message: Result 4446290 not found in upload 7e12345f-eb12-12ec-a30b-bb1234f1d12a
error: Not Found
'429':
$ref: '#/components/responses/RateLimited'
'503':
Expand Down Expand Up @@ -3847,6 +3865,14 @@ components:
description: |
`FAILED` for the failed tests' files only, `ALL` for every test's.
Any other value counts as `ALL`.
resultId:
type: integer
minimum: 1
description: |
Optional. Only the files of the flow run this result belongs to: its
first attempt and every retry, on that one device. Result IDs are the
`id` of each entry in `GET /results/{uploadId}`. Leave it out for the
whole upload.
FlowSummaries:
type: object
required: [statusCode, flows]
Expand Down
Loading