diff --git a/README.md b/README.md index ab314fa..3c3a93c 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,12 @@ DeviceCloud is a third-party Maestro Cloud alternative. -Reasons to switch: +Why teams switch: -* Cheap unit-based pricing -* Up to 100 parallel runs -* Twice as fast as Maestro Cloud for half the cost -* Google Play APIs -* Tablets and iPads -* Fast support response times (via Discord or Slack Connect) +* Per-test-run pricing, with $20 of free credits to start +* Parallel runs: up to 20 iOS and 20 Android tests at once on the Max plan, and more on Enterprise +* Google Play APIs, tablets, iPads and foldables +* Fast support, through Discord or Slack Connect ## Try it @@ -50,9 +48,9 @@ Start with the [Quick Start](getting-started/quickstart.md) to install the CLI a ### Automate with AI & code * [Agent Devices](mcp/agent-devices.md) - give your AI agent a cloud iOS or Android device to drive, with a person on hand when it gets stuck (beta) -* [MCP Server](mcp/overview.md) - let Claude, Cursor and other MCP clients run your tests +* [Connect an AI Agent](mcp/connect.md) - let Claude Code, Cursor and other MCP clients run your tests * [CLI Reference](cli/overview.md) - every `dcd` command and flag -* [REST API](api/overview.md) - uploads, results and flows over HTTP +* [REST API](api/overview.md) - uploads, results, flow analytics, device sessions and IP addresses over HTTP ### Pricing & plans @@ -69,11 +67,11 @@ For most projects, yes. The CLI mimics the Maestro Cloud API, so you change `mae ### How much does it cost? -DeviceCloud bills per test run i.e. a single top-level flow on a single device and are charged at $0.11 for standard iOS and $0.09 for standard Android. iPad, iPhone Duo, Pixel 10 Pro Fold, Google Play, tablet and `m4` and `m1` runner flows are charged at the advanced rate of $0.15. New accounts get $20 of free credits. The Pro and Max plans include a set amount of usage each month, and usage beyond that is billed as [overage](billing/overage.md), up to a limit you control. See [Test Run Billing](billing/test-run-billing.md). +DeviceCloud bills per test run: one top-level flow on one device. A standard run costs $0.11 on iOS and $0.09 on Android. Runs on an iPad, the iPhone Duo, the Pixel 10 Pro Fold, the generic tablet or a Google Play image, and runs on the `m4` and `m1` runner types, cost the advanced rate of $0.15. New accounts get $20 of free credits. The Pro and Max plans include a set amount of usage each month, and usage beyond that is billed as [overage](billing/overage.md), up to a limit you control. See [Test Run Billing](billing/test-run-billing.md). ### How many tests can I run in parallel? -It depends on your plan: Pro runs up to 5 iOS and 5 Android tests at once, and Max up to 20 of each. Enterprise concurrency is arranged to fit your requirements. Once you hit your maximum, further tests queue and start automatically as capacity frees up. See [Concurrency & Parallel Runs](getting-started/concurrency-and-parallel-runs.md) and [Subscriptions](billing/subscriptions.md). +It depends on your plan: on the standard runners, Pro runs up to 5 iOS and 5 Android tests at once, and Max up to 20 of each. Enterprise concurrency is arranged to fit your requirements. Once you hit your maximum, further tests queue and start automatically as capacity frees up. See [Concurrency & Parallel Runs](getting-started/concurrency-and-parallel-runs.md) and [Subscriptions](billing/subscriptions.md). ### Which devices and OS versions can I run on? @@ -81,7 +79,7 @@ Android runs cover a range of Google Pixel phones plus a generic tablet, and iOS ### Which Maestro versions are supported? -We always support the latest version of Maestro with backwards compatibility up to v2.2.0. Runs default to v2.10.0, and you can use `--maestro-version latest` to always use the most up to date version. We periodically remove support for older versions, and these will be announced with plenty of warning. See [Maestro Versions](configuration/maestro-versions.md). +We always support the latest version of Maestro, and older versions back to v2.2.0. We're targeting v2.2.0 for removal on 23 November 2026, after which v2.6.1 is the oldest. Runs default to v2.10.0, and `--maestro-version latest` always uses the newest version we support. We announce removals of older versions well in advance. See [Maestro Versions](configuration/maestro-versions.md). ### Do I need an API key, or can I just log in? @@ -93,23 +91,23 @@ There are first-class integrations for GitHub Actions, Bitrise, Bitbucket Pipeli ### How do I get videos, logs and test reports? -Pass `--download-artifacts ALL` (or `FAILED`) to a `dcd cloud` run, or fetch them after the fact with `dcd artifacts --upload-id --download-artifacts ALL`. Each result in the console also has a download menu for its logs, reports, app binary and workspace. Reports are available as `junit` and `html` via `--report`. `html-detailed` and `allure` are deprecated and will be removed on 7 December 2026. See [Artifacts & Downloads](artifacts/artifacts.md) and [Report Formats](artifacts/report-formats.md). +Pass `--download-artifacts ALL` (or `FAILED`) to a `dcd cloud` run, or fetch them after the fact with `dcd artifacts --upload-id --download-artifacts ALL`. Each result in the console also has a download menu for its logs, reports, app binary and workspace. Reports are available as `junit` and `html` via `--report`. `html-detailed` and `allure` are deprecated, and we're targeting their removal on 7 December 2026. See [Artifacts & Downloads](artifacts/artifacts.md) and [Report Formats](artifacts/report-formats.md). ### Is there a time limit on a test? -Yes. Every flow has a 10-minute execution limit. A flow that is still running when it reaches the limit is stopped and marked as failed, with a "Test run timed out after 10 minutes" error. A flow that needs longer can opt into [extended runtime](configuration/extended-runtime.md), which gives it up to 20 minutes and is charged at 2×. Failed tests can be retried up to twice, giving a maximum of three total runs, free of charge. See [Quick Start](getting-started/quickstart.md#limits) and [Retry Strategies](advanced/retry-strategies.md). +Yes. Every flow has a 10-minute execution limit. A flow that is still running when it reaches the limit is stopped and marked as failed, with a "Test run timed out after 10 minutes" error. A flow that needs longer can opt into [extended runtime](configuration/extended-runtime.md), which gives it up to 20 minutes and is charged at 2×. `--retry` re-runs a failed test up to twice, free of charge, and you can also retry failed tests from the console. See [Quick Start](getting-started/quickstart.md#limits) and [Retry Strategies](advanced/retry-strategies.md). ### Can I allow-list DeviceCloud in our firewall? -Yes. Test runner egress comes from a published set of IP ranges, and the same list is served from an unauthenticated endpoint — `GET https://api.devicecloud.dev/ip-addresses` so your tooling can poll it rather than watching a docs page. See [IP Addresses](security/ip-addresses.md). +Yes. Test runner egress comes from a published set of IP ranges, and the same list is served from an unauthenticated endpoint, `GET https://api.devicecloud.dev/ip-addresses`, so your tooling can poll it rather than watching a docs page. See [IP Addresses](security/ip-addresses.md). ### Can AI agents drive DeviceCloud? -Yes. The `@devicecloud.dev/dcd` package ships `dcd-mcp`, a Model Context Protocol server that lets Claude, Cursor, VS Code and other MCP clients list devices, submit runs, check status and download artifacts. It's in beta, and the one billable tool can be hidden entirely with `--read-only`. See [MCP Server](mcp/overview.md). +Yes. `dcd mcp`, the Model Context Protocol server built into the CLI, lets Claude Code, Cursor, VS Code, Codex and other MCP clients list devices, run cloud tests, check status and download artifacts. `--read-only` hides the one billable tool. [Agent Devices](mcp/agent-devices.md) (closed beta) also give an agent a cloud device to drive, through DeviceCloud's hosted MCP server. See [Connect an AI Agent](mcp/connect.md). ### How do I get support? -Every account gets community and team support via [Discord](https://discord.gg/gm3mJwcNw8), and you can also email [support@devicecloud.dev](mailto:support@devicecloud.dev). We aim to respond within four hours for urgent queries and three days for non-urgent. Max and Enterprise customers both receive priority email support and Enterprise customers have direct access to the team via Slack Connect. Support hours are 8am–8pm UK time, Monday to Friday. See [Service Level Agreements](legal/service-level-agreements.md). +Every account gets community and team support via [Discord](https://discord.gg/gm3mJwcNw8), and you can also email [support@devicecloud.dev](mailto:support@devicecloud.dev). We aim to respond within four hours for urgent queries, and within one to three business days for other queries, depending on severity. Max and Enterprise customers both receive priority email support and Enterprise customers have direct access to the team via Slack Connect. Support hours are 8am–8pm UK time, Monday to Friday. See [Service Level Agreements](legal/service-level-agreements.md). ::: info Question not answered here? Ask in our [Discord](https://discord.gg/gm3mJwcNw8) or email [support@devicecloud.dev](mailto:support@devicecloud.dev) and we'll be happy to help. diff --git a/SUMMARY.md b/SUMMARY.md index b905653..1c41900 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -100,6 +100,7 @@ * [Subscriptions](billing/subscriptions.md) * [Overage](billing/overage.md) +* [Usage Alerts & Limits](billing/usage-alerts.md) * [Test Run Billing](billing/test-run-billing.md) ## Legal diff --git a/advanced/async-execution.md b/advanced/async-execution.md index 06f3baf..1de099f 100644 --- a/advanced/async-execution.md +++ b/advanced/async-execution.md @@ -5,15 +5,17 @@ By default, `dcd cloud` waits for all tests to complete before exiting. Async mo ## Basic Usage ```bash -dcd cloud --async +dcd cloud --async ``` When tests are submitted successfully, the command exits with code `0` regardless of test outcome. If submission itself fails, it exits with code `1`. +Because the command doesn't wait for the run, `--download-artifacts` and `--report` do nothing with `--async`. Download artifacts and reports with [`dcd artifacts`](../cli/dcd-artifacts.md) once the run has finished. With `--json` or `--json-file`, the result has `status` `PENDING`, and each test has the status it was submitted with (see [JSON output](../cli/dcd-cloud.md#json-output)). + Pair `--async` with `--name` to make it easy to look up results later: ```bash -dcd cloud --async --name "build-$GIT_SHA" +dcd cloud --async --name "build-$GIT_SHA" ``` ## Checking Results After an Async Run @@ -21,10 +23,10 @@ dcd cloud --async --name "build-$GIT_SHA" Use the `dcd status` command to poll for results by upload ID: ```bash -dcd status --upload-id +dcd status --upload-id ``` -You can also look a run up by name with `--name` (handy when paired with `--async --name`). See [dcd status](../cli/dcd-status.md) for the full reference. +You can also look a run up by name with `--name` (handy when paired with `--async --name`). A run's status can turn `FAILED` before all its tests have finished, so wait until no test is queued, pending or running before you download anything. See [dcd status](../cli/dcd-status.md#polling-an-async-run) for an example. ## GitHub Actions Pattern diff --git a/advanced/cancel-previous.md b/advanced/cancel-previous.md index ebd77b5..240568a 100644 --- a/advanced/cancel-previous.md +++ b/advanced/cancel-previous.md @@ -90,15 +90,17 @@ dcd cloud --app-file build/app.apk --flows ./.maestro \ ``` The CLI doesn't read your CI provider's environment, so pass the context -yourself. `--repo-name` plus `--branch` or `--pr-number` are required; without -them nothing is cancelled. `gh_check_name` scopes the group to this job, and -`gh_run_id` stops jobs of the same CI run from cancelling each other. +yourself. A repository plus a branch or PR are required: `--repo-name` with +`--branch` or `--pr-number`, or the same values as `--metadata gh_repo=…` with +`gh_branch=…` or `gh_pr_number=…`. Without them nothing is cancelled. +`gh_check_name` scopes the group to this job, and `gh_run_id` stops jobs of +the same CI run from cancelling each other. == Bitbucket ```yaml - pipe: docker://moropo/device-cloud-for-bitbucket:1.6.1 variables: - API_KEY: $DCD_API_KEY + API_KEY: $DEVICE_CLOUD_API_KEY APP_FILE: build/app.apk CANCEL_PREVIOUS: "true" CHECK_NAME: Android diff --git a/advanced/chrome-onboarding.md b/advanced/chrome-onboarding.md index 9b3fb2a..61973b6 100644 --- a/advanced/chrome-onboarding.md +++ b/advanced/chrome-onboarding.md @@ -6,10 +6,14 @@ Chrome Onboarding pre-configures Chrome browser settings before your tests run o By default we use a config-based Chrome onboarding which adds minimal overhead and works for most scenarios. -If config-based onboarding fails, we automatically switch to Maestro-based onboarding which uses a Maestro script. While more thorough, Maestro-based onboarding adds significant overhead as it runs an additional flow on the device before your tests. +If config-based onboarding can't be confirmed on the device, we automatically switch to Maestro-based onboarding, which runs a Maestro flow that opens Chrome and taps through its first-run screens. It's more thorough, but it adds significant overhead, because the flow runs on the device before your test. + +If Maestro-based onboarding fails, the test goes back in the queue to start again on a fresh device. This doesn't use up a [retry](retry-strategies.md) and isn't charged. If onboarding still fails on the last attempt, the test starts anyway, and the test's log notes that Chrome may show its welcome screen first. ### Forcing Maestro-based Onboarding If you're experiencing issues with Chrome, you can force Maestro-based onboarding using the CLI flag `--maestro-chrome-onboarding`. -**Important:** Using Maestro-based onboarding **will slow your test suite down**. We therefore only recommend using it if you are experiencing issues with the default config-based method. +::: warning +Maestro-based onboarding **will slow your test suite down**. We only recommend it if you're having issues with the default config-based method. +::: diff --git a/advanced/exit-codes.md b/advanced/exit-codes.md index ceda85f..5b01013 100644 --- a/advanced/exit-codes.md +++ b/advanced/exit-codes.md @@ -1,27 +1,22 @@ # Exit Codes -Device Cloud uses standard exit codes to indicate the status of command execution. Understanding these codes is useful for CI/CD integration and automation. +The `dcd` CLI reports how a command went through its exit code, so a CI job can pass or fail on it. -## Standard Exit Codes +## `dcd cloud` -### Success +| Code | Meaning | +|---|---| +| `0` | The run passed | +| `1` | The CLI couldn't finish: a bad flag or path, a network or API error, or a run the API refused to start | +| `2` | The run failed: at least one of its tests failed or was cancelled | -```bash -0 # Command completed successfully -``` - -### General Errors - -```bash -1 # CLI or infrastructure error (bad workspace, network failure, dcd bug) -2 # Test run explicitly failed -``` - -A run the API refuses to start also exits `1`. That includes HTTP `402` refusals, when a run would take you over your [Overage Limit](../billing/overage.md#when-a-run-would-go-over-the-limit) or a subscription payment is [overdue](../billing/test-run-billing.md#overdue-payments). +A run the API refuses to start exits `1`. That includes HTTP `402` refusals, when a run would take you over your [Overage Limit](../billing/overage.md#when-a-run-would-go-over-the-limit) or past a [usage alert's hard stop](../billing/usage-alerts.md#hard-stop), or a subscription payment is [overdue](../billing/test-run-billing.md#overdue-payments). A run fails if any of its tests fails or is cancelled, so a run you cancel from the console also exits `2`. With `--async`, `dcd cloud` exits `0` as soon as the run is submitted, whatever the outcome. -## JSON Output +A run superseded by a newer run through [`--cancel-previous`](cancel-previous.md) exits `0`, even if one of its tests had already failed. With `--json` or `--json-file`, its `status` is `SUPERSEDED`. + +### JSON output The two JSON flags behave differently around test failures: @@ -32,15 +27,28 @@ The two JSON flags behave differently around test failures: Use `--json-file` when you want to inspect the result yourself rather than have a non-zero exit code fail the build. Use `--json` when you still want the exit code to gate your pipeline. ::: -`dcd status --json` exits `0` whenever it prints a result. That includes a `FAILED` run and a failed lookup, which is also reported as `FAILED` but with an `error` field (see [dcd status](../cli/dcd-status.md#json-output)). +On a CLI or infrastructure error, `--json` prints `{"status": "FAILED", "error": "…"}`. That's the same `status` as a failed run, so check the exit code, or look for an `error` field, to tell them apart. See [JSON output](../cli/dcd-cloud.md#json-output). -## Superseded Runs +## `dcd status` -A run superseded by a newer run through [`--cancel-previous`](cancel-previous.md) exits `0`, even if one of its tests had already failed. With `--json` or `--json-file`, its `status` is `SUPERSEDED`. +`dcd status` exits `0` whenever it can read the run, whatever the run's status, so check the status it prints rather than its exit code. + +With `--json`, a failed lookup, such as an unknown upload ID or an API it can't reach, is reported as `FAILED` with an `error` field, and still exits `0`. Other errors, such as passing neither `--upload-id` nor `--name`, print the same `status` and `error` but exit `1`. See [dcd status](../cli/dcd-status.md#json-output). + +## Other commands + +`dcd upload`, `dcd list`, `dcd login` and the other commands exit `0` when they succeed and `1` when they fail. `dcd artifacts` exits `0` even when a download fails, unless you pass `--json`: then it exits `1` when every download failed. + +## Device sessions -## Live Sessions +Every [`dcd device`](../cli/dcd-device.md) subcommand uses these codes: -- **`dcd live run`** exits `2` if the flow fails, or if it's still running when `--timeout` is reached. -- **`dcd live exec`** exits `0` even when the commands fail — check the printed result. +| Code | Meaning | +|---|---| +| `0` | Done | +| `1` | Called wrongly: a bad flag or value, no session to pick, or credentials the API rejected | +| `2` | It ran and failed: a flow, action or launch failed, or the API couldn't do it | +| `3` | A limit was hit: concurrent sessions, spend cap or rate limit | +| `4` | The session has ended, or there is no such session | -See [dcd live](../cli/dcd-live.md) for the full reference. +The deprecated [`dcd live`](../cli/dcd-live.md) has no such contract. `dcd live run` exits `2` if the flow fails, or if it's still running when `--timeout` is reached. `dcd live exec` exits `0` even when the commands fail, so check the printed result. diff --git a/advanced/retry-strategies.md b/advanced/retry-strategies.md index 99d84bb..f2da00d 100644 --- a/advanced/retry-strategies.md +++ b/advanced/retry-strategies.md @@ -1,20 +1,37 @@ # Retry Strategies -Failed tests can be automatically retried using the `--retry` flag. Retries are free of charge and capped at 2, giving a maximum of 3 total runs per test. If needed, you can queue additional retries on the [console](https://console.devicecloud.dev/results). +DeviceCloud can run a failed test again for you. Retries are free: a retried run is never charged. -## Usage +## Automatic retries + +Pass `--retry` to `dcd cloud`: ```bash dcd cloud app.apk flows/ --retry 2 ``` -If a test fails, DeviceCloud will re-run the test up to the specified number of times, stopping as soon as a run passes. The final status reflects the last run. You can view the other results using the dropdown menu on the console. +When a test fails, DeviceCloud runs it again, up to the number of times you set, and stops as soon as an attempt passes. The maximum is `2`, so a test runs at most 3 times. The CLI reduces a higher value to `2` and warns you. + +- Any failed test is retried, except one that fails because its encrypted app, flows or environment variables can't be decrypted. That would fail the same way again, so it doesn't use up a retry. +- A retry joins the queue as a new test run, with the original run's [priority](../configuration/run-priority.md). While it runs, it counts towards your [concurrency limit](../getting-started/concurrency-and-parallel-runs.md) like any other test. +- `dcd cloud` waits for the retries before it exits. Its exit code, and the `status` under `--json`, follow the last attempt of each test. With `--async`, the retries happen in the background. +- A retry of a flow with [extended runtime](../configuration/extended-runtime.md) gets the same 20-minute limit. + +## Infrastructure failures + +If a test is interrupted by a failure on our side, such as a simulator that fails to boot, DeviceCloud runs it again automatically. That doesn't use up a retry, and it isn't charged (see [Test Run Billing](../billing/test-run-billing.md#retries)). + +## Retrying from the console + +You can also retry tests from the [console](https://console.devicecloud.dev/results), on top of any `--retry` attempts. These retries are free too. Results older than 6 months can't be retried. + +With the [DeviceCloud GitHub App](../ci-cd/github-checks.md), a failed check also has a **Re-run failed tests** button. + +## Seeing every attempt -## Limitations +A test's final status is the status of its last attempt. In the console, pick an earlier attempt from the attempt menu on the result. [Artifacts](../artifacts/artifacts.md) keep each attempt in its own folder, while `report.xml` covers only the last attempt of each flow. -- The maximum value is `--retry 2` (3 runs total) -- Only failed test executions are retried — configuration errors (invalid flow files, authentication failures, missing dependencies) will not be retried -- Retries count toward your concurrency limit while running +[Email](../notifications/email-notifications.md), [Slack](../notifications/slack-notifications.md) and [webhook](../notifications/webhook-notifications.md) notifications each have a setting for whether to report again after retries. ::: info If your test is still failing after 2 retries, reach out on [Discord](https://discord.gg/gm3mJwcNw8) for help diagnosing the root cause. diff --git a/advanced/visual-testing.md b/advanced/visual-testing.md index b64a17f..3f19f87 100644 --- a/advanced/visual-testing.md +++ b/advanced/visual-testing.md @@ -9,7 +9,7 @@ Maestro's `assertScreenshot` command compares the current screen against a refer DeviceCloud runs these assertions like any other command. The one thing you need to set up is getting your baseline images onto the device. ::: warning -**Use Maestro 2.10.0**, the default version. Maestro 2.2.0 resolves the baseline path against a different working directory and reports `Screenshot file not found` no matter where you put the file, so don't pin `--maestro-version` to it — see [Maestro Versions](../configuration/maestro-versions.md). +**Don't pin `--maestro-version 2.2.0`.** That version resolves the baseline path against a different working directory and reports `Screenshot file not found` no matter where you put the file. Use the default version, 2.10.0, or a later one (see [Maestro Versions](../configuration/maestro-versions.md)). ::: ## Uploading your baselines @@ -47,7 +47,7 @@ The file extension is optional. `assertScreenshot: screenshots/home` looks for ` ## Creating your first baseline -Maestro has no "record" mode, so you have to capture the first baseline yourself. A baseline must match the device's screen dimensions **exactly**, so capture it on a local emulator or simulator configured identically to the DeviceCloud device you intend to test on — a `pixel-7` / API 34 AVD for `--android-device pixel-7 --android-api-level 34`, for example. +Maestro has no "record" mode, so you have to capture the first baseline yourself. A baseline must match the device's screen dimensions **exactly**, so capture it on a local emulator or simulator configured identically to the DeviceCloud device you intend to test on — a `pixel-8` / API 34 AVD for `--android-device pixel-8 --android-api-level 34`, for example. 1. Boot that local device and run the flow with `takeScreenshot` in place of the assertion: @@ -100,7 +100,7 @@ Because baselines are resolution-locked, a [device matrix](../configuration/devi ``` screenshots/ - pixel-7-api-34/home.png + pixel-8-api-34/home.png iphone-16-ios-18/home.png ``` @@ -114,8 +114,8 @@ includedPaths: | Device | `DCD_DEVICE` | | --- | --- | -| `--android-device pixel-7 --android-api-level 34` | `pixel-7-api-34` | -| The same with `--google-play` | `pixel-7-api-34-play` | +| `--android-device pixel-8 --android-api-level 34` | `pixel-8-api-34` | +| The same with `--google-play` | `pixel-8-api-34-play` | | `--android-device generic-tablet --android-api-level 36` | `13-5in-freeform-api-36` | | `--ios-device iphone-16 --ios-version 18` | `iphone-16-ios-18` | | `--ios-device iphone-17 --ios-version 26` | `iphone-17-ios-26` | diff --git a/api/device-sessions.md b/api/device-sessions.md index 0306918..21fd694 100644 --- a/api/device-sessions.md +++ b/api/device-sessions.md @@ -2,7 +2,64 @@ The REST API behind [Agent Devices](../mcp/agent-devices.md). The MCP tools call these same endpoints. Authenticate with an [API key](../getting-started/api-keys.md) in `x-app-api-key`, as for the rest of the [REST API](overview.md#authentication). A key limited to **Device sessions only** can reach these endpoints, the hosted MCP server and the build upload endpoints, but nothing else. -A session is named by its `id` (for example `brave-teal-otter`) in every path. Every successful response about a session includes a `session` block: its state, time and idle time left, cost so far, warnings and console link. [The tool reference](../mcp/agent-devices-tools.md#the-session-block) lists its fields. +Device sessions are in a closed beta: contact support to have them turned on for your team. Until they are, starting a session answers `403` with `LIVE_NOT_ENABLED`. + +A session is billed from the moment a device is assigned to it until it ends, so stop it with `DELETE` as soon as you're done. It also ends after 5 minutes without a command, or when it reaches its maximum length. [Agent Devices](../mcp/agent-devices.md#pricing) has the price and the [limits](../mcp/agent-devices.md#limits). + +A session is named by its `id` (for example `brave-teal-otter`) in every path. Its numeric `live_id` works too. Every successful response about a session includes a `session` block: its state, time and idle time left, cost so far, warnings and console link. [The tool reference](../mcp/agent-devices-tools.md#the-session-block) lists its fields. A successful `POST` answers `201`. Other successful requests answer `200`. + +## Example + +Start an Android session, wait for its device, install a build from a link, tap a button, then stop: + +```bash +# Start a session. The answer's session.id names it in the calls below. +curl -X POST https://api.devicecloud.dev/device/sessions \ + -H "x-app-api-key: " \ + -H "Content-Type: application/json" \ + -d '{"platform": "android", "clientLabel": "my-script"}' + +# Read the session until session.state is "ready" +curl https://api.devicecloud.dev/device/sessions/brave-teal-otter \ + -H "x-app-api-key: " + +# Install a build from a link, then launch it +curl -X POST https://api.devicecloud.dev/device/sessions/brave-teal-otter/install \ + -H "x-app-api-key: " \ + -H "Content-Type: application/json" \ + -d '{"url": "https://example.com/app-release.apk"}' +curl -X POST https://api.devicecloud.dev/device/sessions/brave-teal-otter/launch \ + -H "x-app-api-key: " + +# Tap the element whose text is "Log in" +curl -X POST https://api.devicecloud.dev/device/sessions/brave-teal-otter/actions \ + -H "x-app-api-key: " \ + -H "Content-Type: application/json" \ + -d '{"type": "tap", "text": "Log in"}' + +# Stop the session and release the device +curl -X DELETE https://api.devicecloud.dev/device/sessions/brave-teal-otter \ + -H "x-app-api-key: " +``` + +Starting a session answers `201` with its `session` block (some fields left out here): + +```json +{ + "session": { + "id": "brave-teal-otter", + "live_id": 4182, + "state": "queued", + "platform": "android", + "model": "pixel-10-api-36", + "client_label": "my-script", + "queue": { "position": 1, "eta_s": 25, "waited_s": 0, "reason": "waiting_for_device" }, + "monitor_url": "https://console.devicecloud.dev/device/brave-teal-otter" + } +} +``` + +`launch` waits up to 45 s for the install to finish. Each command answers with its `result` (`success`, and `output` or `error`) and the `session` block. The [OpenAPI specification](https://docs.devicecloud.dev/openapi.yaml) has every request and response in full. ## Sessions @@ -14,6 +71,10 @@ A session is named by its `id` (for example `brave-teal-otter`) in every path. E | `GET /device/sessions/:id` | One session | | `DELETE /device/sessions/:id` | Stop a session and release the device | +`model`, `os` and `googlePlay` take the values `GET /device/models` lists. Without them, you get the platform's default device. `maxDurationMin` is a whole number of minutes, from 1 up to your team's limit (60 unless support has lowered it), and defaults to that limit. `clientLabel` says who is driving, such as `claude-code`: up to 64 letters, digits, spaces and `. _ / -`, starting with a letter or digit. + +To get a `binaryUploadId`, upload the build with [`dcd upload`](../cli/dcd-upload.md), which prints its ID, or reuse the `appBinaryId` of a test run from [`GET /uploads/status`](uploads.md#get-upload-status). It must be your team's build for the session's platform. To install from a link instead, use `install` with `url`. + ## The device | Method and path | What it does | @@ -23,22 +84,13 @@ A session is named by its `id` (for example `brave-teal-otter`) in every path. E | `POST /device/sessions/:id/actions` | One action: `tap` (`x`/`y` percent, `text` or `id`), `type` (`text`, and `sensitive: true` to keep it secret), `swipe` (`direction`: `up`, `down`, `left` or `right`, or `from`/`to` points in percent), `press_key` (`key`: `back`, `home`, `enter`, `backspace`, `tab`, and on Android `volume_up`, `volume_down`, `lock` or `power`). Answered once the screen has settled. `text` and `id` are matched whole, ignoring case. A `tap` on something that is not on screen waits about 17 s before it fails | | `POST /device/sessions/:id/run` | Run a Maestro flow, within [what a session runs](#what-a-session-runs): `{ "yaml": "..." }` for one flow, or `{ "flowUploadId": "...", "flow"?: "..." }` for a [flow bundle](#flow-bundles). `env` passes [secrets and variables](#secrets). Waits up to 110 s, or `waitSeconds` (0 to 300), then answers `running` with a `command_id`. A failed run's result includes `screen_text`, the app's visible text after the failure | | `GET /device/sessions/:id/commands/:commandId` | The status and result of a `run` that answered `running`. `?waitSeconds=` (0 to 300) waits for it to finish instead of answering at once | -| `GET /device/sessions/:id/inspect` | The screen as compact JSON. The on-screen keyboard and the System UI are left out unless you add `?all=true`. Some apps also drop their own fields from the tree while a keyboard is open, and `all` cannot bring them back: hide the keyboard first (`run` with `- hideKeyboard`), then inspect again | +| `GET /device/sessions/:id/inspect` | The screen as compact JSON. On Android, the on-screen keyboard and the System UI are left out unless you add `?all=true`. Some apps also drop their own fields from the tree while a keyboard is open, and `all` cannot bring them back: hide the keyboard first (`run` with `- hideKeyboard`), then inspect again | | `GET /device/sessions/:id/screenshot` | The screen as it is now, as a JPEG data URL. `fresh` is `false` when no new frame came within 3 s, so this is the latest there is | | `GET /device/sessions/:id/logs` | The installed app's recent device log lines. `lines` (default 200, at most 2000), `level` (`warning` or `error`) and `grep` (any case) narrow them. The answer stops at 24 KB, with `truncated: true` when older lines were left out | ## What a session runs -A session takes Maestro YAML and runs the common Maestro commands: `tapOn`, `doubleTapOn`, `longPressOn`, `inputText`, `eraseText`, `hideKeyboard`, `pressKey` (`Back`, `Home` and `Enter`), `swipe`, `scroll`, `scrollUntilVisible`, `assertVisible`, `assertNotVisible`, `extendedWaitUntil`, `waitForAnimationToEnd`, `launchApp`, `stopApp`, `killApp`, `clearState`, `openLink`, `takeScreenshot`, `back`, and `runFlow`, `repeat` and `retry`. - -It doesn't run flow scripts: `runScript`, `evalScript`, or a JavaScript condition or expression. Only `${NAME}` variables from `env` are filled in. It also doesn't run `copyTextFrom`, `pasteText`, `inputRandom*`, `setLocation`, `travel` or `addMedia`, or other `pressKey` keys. A flow with a command it doesn't run fails before its first step, and the error names the line. - -These flows are run by a Maestro-compatible engine, not by Maestro itself. A [test run](../getting-started/quickstart.md) runs your flows on Maestro, so check a flow there before you rely on it there. - -Two things differ by platform: - -- **iOS.** A session works on the app in front. On the home screen the screen reads as empty and a tap is refused, so launch an app first. When a tap opens another app, such as a link into Safari, the session follows it. `lock`, `power`, `volume_up` and `volume_down` aren't available on a simulator. -- **Android.** `eraseText` must be at the top level of a flow, not inside `runFlow`, `repeat` or `retry`. +A session runs the common Maestro commands, but not flow scripts, and a few things differ by platform. [What a session runs](../mcp/agent-devices.md#what-a-session-runs) in Agent Devices lists them. ## Flow bundles @@ -46,8 +98,8 @@ To run several flows, or a flow that runs others, upload them as a zip, then pas | Method and path | What it does | |---|---| -| `POST /device/bundles/upload-url` | `{ "bytes"?: 1234 }`. Returns the bundle's `id`, and signed URLs to `PUT` the zip to: `upload` and `mirror` (either may be `null`). Upload to each one given | -| `POST /device/bundles` | Register it: `{ "id", "sha", "bytes", "supabase": true, "backblaze": true }`, where `sha` is the SHA-256 of the zip in hex, and `supabase` and `backblaze` say which URLs you uploaded to. Returns `{ "bundle" }` | +| `POST /device/bundles/upload-url` | `{ "bytes"?: 1234 }`. Returns the bundle's `id`, plus `upload` and `mirror`, each `{ "path", "signedUrl" }` or `null`. `PUT` the zip, as `application/zip`, to each `signedUrl` given | +| `POST /device/bundles` | Register it: `{ "id", "sha", "bytes", "supabase": true, "backblaze": true }`, where `sha` is the SHA-256 of the zip in hex. Set `supabase` if you uploaded to `upload`, and `backblaze` if you uploaded to `mirror`. Returns `{ "bundle" }` | A bundle can be up to 50 MB. Bundles are deleted a day after they're uploaded, once no command needs them. @@ -55,7 +107,7 @@ A bundle can be up to 50 MB. Bundles are deleted a day after they're uploaded, o | Method and path | What it does | |---|---| -| `POST /device/sessions/:id/request-human` | `{ "reason": "..." }`, up to 500 characters. The session waits for a person, with its idle timer paused, for up to 30 minutes. Your [webhook](../notifications/webhook-notifications.md#device-needs-human) gets a `device.needs_human` event | +| `POST /device/sessions/:id/request-human` | `{ "reason": "..." }`, up to 500 characters. The session waits for a person, with its idle timer paused, for up to your team's limit (30 minutes by default) and never past its maximum length. Your [webhook](../notifications/webhook-notifications.md#device-needs-human) gets a `device.needs_human` event | | `GET /device/sessions/:id/human` | Whether it's still waiting, or was handed back, with the person's note | | `POST /device/sessions/:id/hand-back` | `{ "note"?: "..." }`, up to 2000 characters. Hand the session back to the agent | @@ -70,7 +122,7 @@ Taking control of a device is for people in the console. While someone has contr ## Secrets -`env` on `run` is an object of names to string values: up to 50 of them, each up to 4096 characters. Names are letters, digits and `_`, and don't start with a digit. Names starting with `DCD_` are reserved. Refer to them in the YAML as `${NAME}`. They're encrypted before they're stored, never shown in the timeline, and masked in the command's output and in `inspect`. +`env` on `run` is an object of names to string values: up to 50 of them, each up to 4096 characters. Names are up to 64 letters, digits and `_`, and don't start with a digit. Names starting with `DCD_`, in any case, are reserved. Refer to them in the YAML as `${NAME}`. They're encrypted before they're stored, never shown in the timeline, and masked in the command's output and in `inspect`. A `type` action with `sensitive: true` sends its text the same way. @@ -88,27 +140,27 @@ Over a limit, the API answers HTTP `429` with `LIVE_RATE_LIMITED`, and `retry_af ## Errors -Errors are JSON with a `message`. Most also have a stable `error` code, listed below. A few have only the `message`, such as a malformed request to start a session. - -| Code | Meaning | -|---|---| -| `LIVE_NOT_ENABLED` | Device sessions aren't enabled for your organization | -| `LIVE_CONCURRENCY_LIMIT` | Your organization has as many sessions open as it may | -| `LIVE_SPEND_CAP` | Your organization reached its monthly spend cap | -| `LIVE_NOT_FOUND` | No such session in your organization | -| `LIVE_NOT_READY` | The device is still starting, or installing an app: retry shortly | -| `LIVE_SESSION_ENDED` | The session has ended | -| `LIVE_INVALID_ACTION` | The request is malformed: the message says how | -| `LIVE_INVALID_APP` | The build isn't one this device can install | -| `LIVE_APP_DOWNLOAD_FAILED` | The build at the URL couldn't be downloaded | -| `LIVE_NO_APP` | No app is installed, and none was named | -| `LIVE_COMMAND_NOT_FOUND` | No such command in this session | -| `LIVE_LOGS_UNAVAILABLE` | The device logs couldn't be read | -| `LIVE_SESSION_REQUIRED` | MCP only: more than one session is open, so pass `session_id` | -| `LIVE_RATE_LIMITED` | Too many requests: slow down | -| `LIVE_NOT_WAITING_FOR_HUMAN` | Hand-back on a session that isn't waiting for a person | -| `LIVE_HUMAN_IN_CONTROL` | A person has taken control in the console: wait for them to hand back | -| `LIVE_CONSOLE_ONLY` | Only a person signed in to the console can do this (take control) | -| `LIVE_NOT_IN_CONTROL` | Only the person in control can do this (remove a held step) | -| `LIVE_SECRETS_UNAVAILABLE` | Secrets can't be accepted right now | -| `API_KEY_SCOPE` | The API key isn't allowed to reach this endpoint | +Errors are JSON with a `message`. Most also have a stable `error` code, listed below with its HTTP status. A few have only the `message`, such as a malformed request to start a session. + +| Code | Status | Meaning | +|---|---|---| +| `LIVE_NOT_ENABLED` | `403` | Device sessions aren't enabled for your organization | +| `LIVE_CONCURRENCY_LIMIT` | `409` | Your organization has as many sessions open as it may | +| `LIVE_SPEND_CAP` | `402` | Your organization reached its monthly spend cap | +| `LIVE_NOT_FOUND` | `404` | No such session in your organization | +| `LIVE_NOT_READY` | `425` | The device is still starting, or installing an app: retry shortly | +| `LIVE_SESSION_ENDED` | `409` | The session has ended | +| `LIVE_INVALID_ACTION` | `400` | The request is malformed: the message says how | +| `LIVE_INVALID_APP` | `400` | The build isn't one this device can install | +| `LIVE_APP_DOWNLOAD_FAILED` | `400` | The build at the URL couldn't be downloaded | +| `LIVE_NO_APP` | `409` | No app is installed, and none was named | +| `LIVE_COMMAND_NOT_FOUND` | `404` | No such command in this session | +| `LIVE_LOGS_UNAVAILABLE` | `502` | The device logs couldn't be read | +| `LIVE_SESSION_REQUIRED` | None | MCP only: no session is open, or more than one is, so pass `session_id` | +| `LIVE_RATE_LIMITED` | `429` | Too many requests: slow down | +| `LIVE_NOT_WAITING_FOR_HUMAN` | `409` | Hand-back on a session that isn't waiting for a person | +| `LIVE_HUMAN_IN_CONTROL` | `409` | A person has taken control in the console: wait for them to hand back | +| `LIVE_CONSOLE_ONLY` | `403` | Only a person signed in to the console can do this (take control) | +| `LIVE_NOT_IN_CONTROL` | `409` | Only the person in control can do this (remove a held step) | +| `LIVE_SECRETS_UNAVAILABLE` | `503` | Secrets can't be accepted right now | +| `API_KEY_SCOPE` | `403` | The API key isn't allowed to reach this endpoint | diff --git a/api/flows.md b/api/flows.md index 2df8da2..bb9ee6f 100644 --- a/api/flows.md +++ b/api/flows.md @@ -21,10 +21,12 @@ GET /flows | `platform` | string | No | Filter by platform: `android` or `ios`. | | `appId` | string | No | Filter by app ID (e.g. `com.example.app`). | | `days` | number | No | Lookback window in days. Default: `14`. Ignored if `startDate` is set. | -| `startDate` | string | No | Start of date range (ISO 8601). Overrides `days`. | -| `endDate` | string | No | End of date range (ISO 8601). Defaults to now if `startDate` is set. | +| `startDate` | string | No | Start of date range (ISO 8601). A date without a time means the start of that day (UTC). Overrides `days`. | +| `endDate` | string | No | End of date range (ISO 8601). A date without a time means the end of that day (UTC). Defaults to now if `startDate` is set. | | `tags` | string | No | Comma-separated tag filter. Returns flows that have any of the given tags (e.g. `smoke,critical`). | +A date without a time in `endDate` covers that whole day, so `endDate=2026-01-31` includes 31 January. This differs from `to` on [`GET /uploads/list`](uploads.md#list-uploads), where a date without a time means the start of the day. + **Example** ```bash @@ -76,12 +78,14 @@ GET /flows/runs | Parameter | Type | Required | Description | |-----------|------|----------|-------------| -| `fileName` | string | Yes | The flow's path exactly as `GET /flows` returns it in `file_name` — relative to the flows folder you ran and starting with `./` (e.g. `./auth/login.yaml`). URL-encode it. | +| `fileName` | string | Yes | The flow's path exactly as `GET /flows` returns it in `file_name`, starting with `./` (e.g. `./auth/login.yaml`). It's relative to the flows folder you ran, unless your flows use files outside that folder: see [`includedPaths`](../configuration/workspace-config.md#includedpaths). URL-encode it. | | `platform` | string | No | Filter by platform: `android` or `ios`. | | `appId` | string | No | Filter by app ID. | | `limit` | number | No | Maximum number of runs to return. Default: `100`. | -| `startDate` | string | No | Start of date range (ISO 8601). | -| `endDate` | string | No | End of date range (ISO 8601). | +| `startDate` | string | No | Start of date range (ISO 8601). A date without a time means the start of that day (UTC). | +| `endDate` | string | No | End of date range (ISO 8601). A date without a time means the end of that day (UTC). | + +Neither date has a default. Leave both out to get the newest runs of any age, up to `limit`. **Example** @@ -110,3 +114,5 @@ curl --get "https://api.devicecloud.dev/flows/runs" \ ] } ``` + +`uploadName` is `Unknown` for an upload that was given no name. diff --git a/api/ip-addresses.md b/api/ip-addresses.md index 7433f6e..c642b02 100644 --- a/api/ip-addresses.md +++ b/api/ip-addresses.md @@ -2,7 +2,7 @@ Returns the current list of DeviceCloud test-runner egress IP addresses, so your DevOps tooling can automate firewall allow-listing instead of updating it by hand whenever the addresses change. -Unlike the other REST API endpoints, this one is **public** — no API key is required — so automation can poll it without credentials. Responses are cacheable (`Cache-Control: public, max-age=3600`); polling once an hour is plenty. +This endpoint needs no API key, so automation can poll it without credentials. It isn't rate limited, and responses are cacheable (`Cache-Control: public, max-age=3600`), so polling once an hour is plenty. The same data is published in human-readable form on the [IP Addresses](../security/ip-addresses.md) security page, which is regenerated daily from this endpoint. @@ -46,11 +46,13 @@ curl https://api.devicecloud.dev/ip-addresses | Field | Type | Description | |-------|------|-------------| | `updatedAt` | `string` | ISO date (`YYYY-MM-DD`) the list last changed. Watch this to detect updates without diffing the whole payload. | -| `ipAddresses` | `string[]` | Flat list of bare IP addresses — the simplest thing to allow-list. | +| `ipAddresses` | `string[]` | Every address in one flat list, the simplest thing to allow-list. A single host (`/32`) appears as a bare IP; a wider range would appear in CIDR notation. | | `ranges` | `object[]` | Structured view of each range (see below). | | `ranges[].cidr` | `string` | The range in CIDR notation. Single hosts are expressed as `/32`. | | `ranges[].platforms` | `string[]` | Runner platforms whose traffic egresses from this range — `android`, `ios`, or both. | | `ranges[].type` | `string` | Traffic type. Currently always `egress` (outbound from the app under test). | | `ranges[].description` | `string` | Human-readable note about the range. | -> **Tip:** If your firewall accepts CIDR notation, allow-list `ranges[].cidr`; otherwise use the flat `ipAddresses` list. Poll on a schedule and reconcile against `updatedAt` to keep your allow-list in sync automatically. +::: tip +If your firewall accepts CIDR notation, allow-list `ranges[].cidr`. Otherwise use the flat `ipAddresses` list, and check it for any entry in CIDR notation. Poll on a schedule and compare `updatedAt` to keep your allow-list in sync. +::: diff --git a/api/overview.md b/api/overview.md index c14f75a..fce51c2 100644 --- a/api/overview.md +++ b/api/overview.md @@ -1,6 +1,8 @@ # REST API -The DeviceCloud REST API gives you programmatic access to the same data available in the console — test results, upload history, and flow analytics. +The DeviceCloud REST API gives you programmatic access to the same data available in the console — test results, upload history, and flow analytics. It also lets an AI agent drive a cloud device through [device sessions](device-sessions.md), and lists the test runners' [IP addresses](ip-addresses.md). + +The API doesn't start test runs. To start one, use [`dcd cloud`](../cli/dcd-cloud.md) or one of the [CI integrations](../ci-cd/overview.md), then read the results here. ## Authentication @@ -12,7 +14,7 @@ x-app-api-key: You can create an API key in the console under **Settings → API Keys**. The full key is shown only once, when it's created or rotated, so store it securely. -Requests can also be authenticated with a DeviceCloud login session, which is how the CLI authenticates after `dcd login`: send `Authorization: Bearer ` together with `x-dcd-org: `, where the signed-in user must be a member of that team. For scripts and CI, use an API key. +Requests can also be authenticated with a DeviceCloud login session, which is how the CLI authenticates after `dcd login`: send `Authorization: Bearer ` together with `x-dcd-org: `, where the signed-in user must be a member of that team. The team ID is a number: `dcd whoami --json` shows it as `org.id`. For scripts and CI, use an API key. A missing or invalid API key returns HTTP `403`. @@ -24,13 +26,32 @@ https://api.devicecloud.dev ## Rate limits -The API accepts up to 60 requests per minute. Requests over the limit receive HTTP `429 Too Many Requests`; wait a moment and try again. +Each endpoint accepts up to 60 requests a minute. Over the limit, the API answers HTTP `429 Too Many Requests` with a `Retry-After` header. Wait that many seconds, then retry, and back off further if you get `429` again. -These endpoints aren't rate limited, so they're safe to poll: [`GET /results/:uploadId`](results.md#get-results), [`GET /uploads/status`](uploads.md#get-upload-status) and [`GET /ip-addresses`](ip-addresses.md). +These endpoints aren't counted, so they're safe to poll: [`GET /results/:uploadId`](results.md#get-results), [`GET /uploads/status`](uploads.md#get-upload-status) and [`GET /ip-addresses`](ip-addresses.md). [Device sessions](device-sessions.md#rate-limits) have their own limits. ## Errors -Most errors are returned with a matching HTTP status code. Three endpoints are the exception: [`GET /results/:uploadId`](results.md#get-results), [`GET /flows`](flows.md#get-flow-summaries) and [`GET /flows/runs`](flows.md#get-runs-for-a-flow) respond with HTTP `200` and report the error in the body instead: +Errors are JSON, with an HTTP status code that matches the error. Most look like this: + +```json +{ + "statusCode": 403, + "message": "Invalid API key. Please check your API key and ensure it is valid for this environment.", + "error": "Forbidden" +} +``` + +`statusCode` repeats the HTTP status. `message` says what went wrong, and some validation errors give a list of messages. `error` is either the status text, as here, or a stable code such as `API_KEY_SCOPE`. Match on codes, never on `message` text. Some errors add more fields; ignore those you don't know. + +Any endpoint that needs an API key can answer: + +- `403` with `"error": "API_KEY_SCOPE"`: the key's access doesn't cover this endpoint, such as a key limited to **Device sessions only** calling `GET /uploads/list`. +- `503` with the message "Could not validate the API key right now": the API couldn't check your key. Retry. It doesn't mean the key is invalid. + +The [JUnit report](results.md#download-junit-report) and [HTML report](results.md#download-html-report) downloads answer an error with a `message` only. + +Three endpoints report client errors differently: [`GET /results/:uploadId`](results.md#get-results), [`GET /flows`](flows.md#get-flow-summaries) and [`GET /flows/runs`](flows.md#get-runs-for-a-flow) respond with HTTP `200` and report the error in the body instead: ```json { diff --git a/api/results.md b/api/results.md index e69aba1..3402be7 100644 --- a/api/results.md +++ b/api/results.md @@ -14,7 +14,7 @@ All results endpoints operate on a specific upload identified by its UUID. Returns all test results for an upload, including status and failure reasons. -Tests waiting in the queue are currently reported as `PENDING` rather than `QUEUED` by this endpoint, so treat both as "not started yet". +This endpoint reports a test waiting in the queue as `PENDING`, not `QUEUED`, so that older CLIs keep working. Treat both as "not started yet". [`GET /uploads/status`](uploads.md#get-upload-status) reports `QUEUED`. ``` GET /results/:uploadId @@ -42,7 +42,7 @@ curl https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f1d12a \ "duration_seconds": 32, "retry_of": null, "created_at": "2026-01-15T10:30:04Z", - "simulator_name": "pixel-7-api-34", + "simulator_name": "pixel-10-api-36", "platform": "android" } ] @@ -51,6 +51,8 @@ curl https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f1d12a \ Every attempt is included: a retry appears as its own entry, with `retry_of` set to the `id` of the original attempt. Each entry also includes `config` (the run settings for that test) and `result_files` (references to its stored artifacts, plus the step log itself when it is 512 KB or smaller), which are left out of the example above. Responses for large uploads can therefore run to several megabytes. To poll a run's progress, use the [summary view](#summary-view), or [`GET /uploads/status`](uploads.md#get-upload-status) if you only need the latest attempt of each test. +An upload ID with no results in your team, such as a mistyped one, answers HTTP `200` with an empty `results` list, not `404`. If a poll keeps getting an empty list, check the ID. + Each result also has a `cancellation_reason`, which is `null` unless the test was cancelled for a recorded reason: @@ -85,8 +87,8 @@ curl "https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f1d12a?v "duration_seconds": 32, "fail_reason": "Element not found: Text matching regex next.* not found", "cancellation_reason": null, - "simulator_name": "pixel-7-api-34", - "config": { "deviceName": "Pixel 7", "osVersion": "34" } + "simulator_name": "pixel-10-api-36", + "config": { "deviceName": "Pixel 10", "osVersion": "36" } } ] } @@ -111,7 +113,9 @@ The API also compresses responses when the request includes an `Accept-Encoding` ## Download JUnit report -Returns a combined JUnit XML report for all tests in an upload. Compatible with most CI systems. +Returns one JUnit XML report covering the latest attempt of every test in an upload. A test without a report of its own gets a generated test case, so every test appears. Compatible with most CI systems. + +An upload with no results in your team answers HTTP `404`. ``` GET /results/:uploadId/report @@ -129,7 +133,7 @@ curl https://api.devicecloud.dev/results/7e12345f-eb12-12ec-a30b-bb1234f1d12a/re ## Download HTML report -Returns a ZIP containing the HTML report together with the screenshots, videos and logs of every test in an upload (the latest attempt of each). +Returns a ZIP containing the HTML report together with the screenshots, videos and logs of every test in an upload (the latest attempt of each). An upload with no results in your team answers HTTP `404`. ``` GET /results/:uploadId/html-report diff --git a/api/uploads.md b/api/uploads.md index 6c8364f..4c4d87e 100644 --- a/api/uploads.md +++ b/api/uploads.md @@ -12,12 +12,14 @@ GET /uploads/list | Parameter | Type | Required | Description | |-----------|------|----------|-------------| -| `name` | string | No | Filter by upload name. Supports `*` as a wildcard. | +| `name` | string | No | Filter by upload name. Supports `*` as a wildcard. A name with a `*` matches regardless of case; without one, the match is exact. | | `from` | string | No | Return uploads created on or after this date (ISO 8601). | | `to` | string | No | Return uploads created on or before this date (ISO 8601). A date without a time means midnight at the start of that day (UTC), so `to=2026-01-31` leaves out uploads made on 31 January — use `2026-02-01` or `2026-01-31T23:59:59Z` to include them. | | `limit` | number | No | Maximum number of results. Default: `20`. At most 1,000 uploads are returned per request; use `offset` to page through more. | | `offset` | number | No | Number of results to skip. Default: `0`. | +The response is HTTP `400` if `limit` isn't a whole number of 1 or more, `offset` isn't a whole number of 0 or more, `from` or `to` isn't ISO 8601, or `from` is after `to`. + **Example** ```bash @@ -60,7 +62,7 @@ GET /uploads/status | `uploadId` | string | No* | The upload UUID. | | `name` | string | No* | The upload name. Returns the most recent match if multiple exist. | -*One of `uploadId` or `name` is required. If no upload matches, the response is HTTP `404`. +*One of `uploadId` or `name` is required. With both, `uploadId` is tried first. If no upload matches, the response is HTTP `404`. With neither, or with an `uploadId` that isn't a UUID, it's HTTP `400`. **Example** @@ -86,13 +88,15 @@ curl "https://api.devicecloud.dev/uploads/status?uploadId=7e12345f-eb12-12ec-a30 "durationSeconds": 32, "failReason": "Element not found: Text matching regex next.* not found", "createdAt": "2026-01-15T10:30:04Z", - "device": "pixel-7-api-34" + "device": "pixel-10-api-36" } ] } ``` -`tests` lists the latest attempt of each test. Each entry also carries `createdAt` and `device` (the device the test ran on, e.g. `pixel-7-api-34` or `iPhone 16 - 18`), and `consoleUrl` includes a `&result=` parameter that opens the upload's most recently created test. +`tests` lists the latest attempt of each test. `device` is the device the test ran on, such as `pixel-10-api-36` or `iPhone 16 - 18`. `durationSeconds` is left out until the test has a duration, and `failReason` appears only on a failed test. + +`consoleUrl` opens the upload in the console at its most recently created test (the `&result=` parameter). The overall `status` is worked out from the tests: diff --git a/artifacts/artifacts.md b/artifacts/artifacts.md index 2957260..81ab978 100644 --- a/artifacts/artifacts.md +++ b/artifacts/artifacts.md @@ -45,11 +45,13 @@ dcd artifacts --upload-id --report junit dcd artifacts --upload-id --report html --html-path ./report.zip ``` +One `dcd artifacts` command can't take both `--download-artifacts` and `--report`. To get the artifacts and a report, run it twice. + See the [`dcd artifacts` reference](../cli/dcd-artifacts.md) for the full flag list. ### From the Console -Each test result in the [DeviceCloud console](https://console.devicecloud.dev) has a download menu with the files for that result: `commands.json`, the Maestro log, Maestro stdout and stderr, the logcat (Android), the HTML, JUnit and Allure reports (when the run generated them; Allure is deprecated and will be removed on 7 December 2026), the app binary (APK or APP build) and the workspace. Videos and screenshots are shown on the result page; to download them in bulk, use `--download-artifacts` or `dcd artifacts`. +Each test result in the [DeviceCloud console](https://console.devicecloud.dev) has a download menu with the files for that result: `commands.json`, the Maestro log, Maestro stdout and stderr, the logcat (Android), the HTML, JUnit and Allure reports (when the run generated them; Allure is deprecated, with removal targeted for 7 December 2026), the app binary (APK or APP build) and the workspace. Videos and screenshots are shown on the result page; to download them in bulk, use `--download-artifacts` or `dcd artifacts`. ## Artifact Archive Structure diff --git a/artifacts/report-formats.md b/artifacts/report-formats.md index c1ea936..48a7939 100644 --- a/artifacts/report-formats.md +++ b/artifacts/report-formats.md @@ -1,9 +1,9 @@ # Report Formats -Device Cloud supports the standard Maestro report formats: JUnit and HTML. +DeviceCloud supports the standard Maestro report formats: JUnit and HTML. ::: warning -`allure` and `html-detailed` are deprecated and **will be removed on 7 December 2026**. From that date, runs that pass them still run and don't fail: +`allure` and `html-detailed` are deprecated. We're targeting their removal on **7 December 2026**, subject to change based on usage. Once they're removed, runs that pass them still run and don't fail: - `--report html-detailed` gets the standard HTML report. - `--report allure` gets no report. @@ -17,10 +17,10 @@ We support the following report types: - `junit` - `html` -- `html-detailed` (deprecated, removed on 7 December 2026) -- `allure` (deprecated, removed on 7 December 2026) +- `html-detailed` (deprecated, removal targeted for 7 December 2026) +- `allure` (deprecated, removal targeted for 7 December 2026) -You can enable each report using `--report `. +You can enable each report using `--report `. `--format` is an alias for `--report`. The CLI will automatically download the report to your working directory for you after the run finishes. To change the download path, use the flag for that report format: @@ -42,8 +42,8 @@ JUnit reports are XML-based and are generally the standard format for CI/CD repo ### HTML and HTML-Detailed -HTML reports are human-readable and provide a summary of a test run, including failure screenshots. Both are delivered as a ZIP containing the report and the files it links to. Detailed reports add the test steps to everything in a standard HTML report. `html-detailed` is deprecated: from 7 December 2026 it gives the standard HTML report. +HTML reports are human-readable and provide a summary of a test run, including failure screenshots. Both are delivered as a ZIP containing the report and the files it links to. Detailed reports add the test steps to everything in a standard HTML report. `html-detailed` is deprecated: once it's removed (targeted for 7 December 2026), it gives the standard HTML report. ### Allure -Allure reports are HTML-based and are downloaded as a single, self-contained HTML file. Allure is deprecated and will be removed on 7 December 2026. From that date, runs that pass `--report allure` get no report. Use `html` or `junit` instead. +Allure reports are HTML-based and are downloaded as a single, self-contained HTML file. Allure is deprecated, and we're targeting its removal on 7 December 2026. Once it's removed, runs that pass `--report allure` get no report. Use `html` or `junit` instead. diff --git a/billing/overage.md b/billing/overage.md index c52d769..7459fa1 100644 --- a/billing/overage.md +++ b/billing/overage.md @@ -76,11 +76,15 @@ The full message also gives your usage so far, the cost of the upload, your limi To start testing again, raise your Overage Limit or wait for your next billing period to start. +A [hard stop](usage-alerts.md#hard-stop) that you've set on a usage alert refuses runs in the same way, with the same HTTP `402` and `USAGE_LIMIT_EXCEEDED`. Its message names the alert's limit instead of the Overage Limit. + ## Warnings The billing page shows a warning once you've used 80% of your Overage Limit, and another when you reach it. With a limit of `0`, both are based on your included credits instead. +To be told by email, Slack or webhook when usage reaches an amount you choose, per day, per week or per billing period, set up [Usage Alerts & Limits](usage-alerts.md). + ## Refunds diff --git a/billing/subscriptions.md b/billing/subscriptions.md index 74ccb35..f9ca445 100644 --- a/billing/subscriptions.md +++ b/billing/subscriptions.md @@ -14,10 +14,10 @@ This subscription costs $25 per month and comes with $25 of usage included which Additional usage beyond $25 is billed as [overage](overage.md) on your next monthly invoice. -This plan lets you run up to 5 iOS and 5 Android tests in parallel. Read about [Concurrency & Parallel Runs](../getting-started/concurrency-and-parallel-runs.md) to understand how this may be reduced at peak times. +This plan runs up to 5 tests at once on each [runner type](../configuration/runner-type.md): iOS `default` and `m4`, and Android `cpu1` and `m1`. It has no Concurrency Protection, so at busy times you may get fewer. See [Concurrency & Parallel Runs](../getting-started/concurrency-and-parallel-runs.md). + +For support, ask our team and community on [Discord](https://discord.gg/gm3mJwcNw8) or email [support@devicecloud.dev](mailto:support@devicecloud.dev). -If you require support when using this plan, you can contact our team and community via [Discord](https://discord.gg/gm3mJwcNw8).\ -\ This plan supports unlimited users and unlimited apps. Results are retained for 6 months. ### Max Plan @@ -26,9 +26,9 @@ This subscription costs $200 per month and comes with $200 of usage included whi Additional usage beyond $200 is billed as [overage](overage.md) on your next monthly invoice. -This plan lets you run up to 20 iOS and 20 Android tests in parallel. +This plan runs up to 20 tests at once on iOS `default`, Android `cpu1` and Android `m1`, and up to 5 on iOS `m4`. -In addition, it offers **Concurrency Protection** to ensure you always have at least 1 test running even at very busy times. Read more [Concurrency & Parallel Runs](../getting-started/concurrency-and-parallel-runs.md) to understand how this works. +It also has **Concurrency Protection**: even at very busy times, at least 1 iOS `default` test and 1 Android `cpu1` test can always run. See [Concurrency & Parallel Runs](../getting-started/concurrency-and-parallel-runs.md) for how this works. This plan supports [Enterprise SSO](../security/enterprise-single-sign-on.md) and priority support via email. @@ -40,6 +40,8 @@ On the Pro and Max plans, overage is capped each billing period so a runaway pip A run that would take you over the limit is refused. See [Overage](overage.md#overage-limit) for how the limit works and what happens when you reach it. +To be told before you get there, or to refuse runs at a lower amount per day, week or billing period, set up [Usage Alerts & Limits](usage-alerts.md). + ### Enterprise Plan This subscription starts at $15,000 per year and allows for custom terms including volume discounts. @@ -48,3 +50,9 @@ This plan is paid by invoice and includes private, dedicated support via Slack a Please reach out to [sales@devicecloud.dev](mailto:sales@devicecloud.dev) for more info. +### Without a subscription + +New teams get $20 of free credits to try DeviceCloud. Without a subscription, runs are paid from that prepaid balance and there's no overage: new runs are refused once the balance runs out. See [Credits](test-run-billing.md#credits). + +A new team without a subscription can run up to 5 tests at once on iOS `default`, Android `cpu1` and Android `m1`, and up to 2 on iOS `m4`, with no Concurrency Protection. + diff --git a/billing/test-run-billing.md b/billing/test-run-billing.md index a366612..c4be8c1 100644 --- a/billing/test-run-billing.md +++ b/billing/test-run-billing.md @@ -1,7 +1,7 @@ # Test Run Billing ::: info -All amounts exclude Sales Tax - this will be added at checkout for your country by our Merchant of Record, Paddle. +All prices exclude Sales Tax. On the Pro and Max plans, tax is added at checkout for your country by our Merchant of Record, Paddle. On the Enterprise plan, tax is added to your invoice where applicable. ::: DeviceCloud charges your Team's account per test run. This happens as soon as you run `dcd cloud`. @@ -20,16 +20,20 @@ Details of charges made to your account can be found on the [billing page](https | Advanced Android | Any runs on our `m1` [runner type](../configuration/runner-type.md), and any Tablet, Pixel 10 Pro Fold or Play device runs | $0.15 | ::: info -Enterprise customers with volume discounts or grandfathered users with older pricing may have different pricing. You can view your account's test run cost in the [billing page](https://console.devicecloud.dev/billing) +Enterprise customers with volume discounts, and customers on older pricing, may pay different rates. Your team's rates, with any discount applied, are under **Flow Run Cost** on the [billing page](https://console.devicecloud.dev/billing). ::: ### Extended runtime A flow that opts into [extended runtime](../configuration/extended-runtime.md) (up to 20 minutes instead of 10) is charged at 2× its rate above, whether or not it uses the extra time. Flows that don't opt in are charged at the normal rate. +### Live and device sessions + +[Live sessions](../cli/dcd-live.md) and [Agent Devices](../mcp/agent-devices.md) sessions aren't charged per test run. They cost $0.03 a minute, charged in 30-second steps from when a device is assigned to the session until the session ends. Time spent queued isn't charged, and your team's discount applies. + ### Credits -New users are given $20 in free credits to test the service. +New teams are given $20 in free credits to test the service. Historically, DeviceCloud users purchased credits in advance and these were drawn down via usage. Credits can no longer be purchased or topped up — [subscriptions](subscriptions.md) have replaced them — but any prepaid balance you still hold doesn't expire. If you also have a subscription, your prepaid balance (including any remaining free credits) is spent first, before your plan's included usage. diff --git a/billing/usage-alerts.md b/billing/usage-alerts.md new file mode 100644 index 0000000..2abd5a7 --- /dev/null +++ b/billing/usage-alerts.md @@ -0,0 +1,81 @@ +# Usage Alerts & Limits + +Usage alerts tell your team when usage reaches an amount you choose, by email, Slack or webhook. Turn on **Hard stop** on an alert and DeviceCloud also refuses new runs that would take usage past it. + +Alerts work alongside your [Overage Limit](overage.md#overage-limit). The Overage Limit caps overage for the whole billing period. An alert can watch a day, a week or the billing period, and a hard stop can refuse runs well before the Overage Limit would. + +::: info +Usage alerts need an active subscription. They count only usage that your plan pays for, so runs paid from a prepaid credit balance don't count towards them. +::: + +## Adding an alert + +Owners and admins manage alerts on the [billing page](https://console.devicecloud.dev/billing), in the **Usage Alerts & Limits** card: + +1. Pick a window: **Daily**, **Weekly** or **Billing period**. +2. For a billing-period alert, pick **Dollar amount** or **% of allowance**. Daily and weekly alerts always use a dollar amount. +3. Enter the threshold. +4. Under **Notify**, select **Email**, **Slack**, **Webhook**, or any mix of them. +5. To refuse runs that would go over the threshold, turn on **Hard stop**. +6. Select **Add alert**. + +Each alert in the list has a switch to turn it off or on, and a **Delete** button. A team can have up to 20 alerts. + +## How usage is measured + +* **Daily** and **Weekly** windows are UTC calendar days and weeks. A week starts on Monday. +* **Billing period** is your subscription's current billing period. +* Usage is what your plan has paid for in the window, from included credits and overage, after [refunds](test-run-billing.md#cancelled-tests). +* **% of allowance** is a share of your included credits plus your Overage Limit. For example, 80% of the Pro plan's default allowance ($25 + $200) is $180. This option isn't available if your team has no Overage Limit. + +## When an alert is sent + +Usage is checked each time a run is charged. An alert is sent the first time usage in its window reaches the threshold, and at most once per window. Changing an alert's window or threshold resets it for the current window. + +Every channel gets the same summary: usage so far in the window, the threshold and what's left of it, your billing period's usage against your allowance, and, when it can be estimated, when you'll reach the allowance at your current rate. + +* **Email** goes to your team's billing email address, or to its owners and admins if none is set. It's sent from hello@devicecloud.dev. +* **Slack** posts to the channel connected under **Settings → Notifications**, whatever its **Only notify on failures** setting. See [Slack Notifications](../notifications/slack-notifications.md). +* **Webhook** sends a [`usage.alert` event](../notifications/webhook-notifications.md#usage-alert) to your webhook URL. + +## Hard stop + +With **Hard stop** on, DeviceCloud checks each new run before it starts. If the run's cost would take usage in the alert's window past the threshold, the whole upload is refused and none of its tests run. Tests already queued or running aren't affected. + +`dcd cloud` reports the refusal as an error and exits with code `1`. The API responds with HTTP `402` and `"error": "USAGE_LIMIT_EXCEEDED"`, the same as a refusal by the [Overage Limit](overage.md#when-a-run-would-go-over-the-limit). The message names the window and the limit, and says when new runs can start again: + +```text +✗ Error: Failed to submit test flows: Usage limit exceeded: this run ($3.30) would take usage today (2026-11-17, UTC) to $51.20, past your hard stop of $50.00. … (HTTP 402) +``` + +A refused run also sends the alert on its channels, unless it has already been sent in this window. A hard stop with no channels refuses runs without telling anyone. + +To start testing again, raise the threshold, turn the hard stop off, or wait for the window to end. + +Hard stops apply to test runs. They don't stop [Live sessions](../cli/dcd-live.md) or [Agent Devices](../mcp/agent-devices.md) sessions. + +## When the Overage Limit refuses a run + +Your Overage Limit still applies on top of your alerts. When it refuses a run, DeviceCloud sends every billing-period alert that the run would have taken usage past, marked as a refused run, whether or not the alert is a hard stop. As with any alert, each one is sent at most once per billing period. So an alert set at 100% of your allowance still reaches you when the Overage Limit stops your tests. + +## Through the API + +You can manage the same alerts with the [REST API](../api/overview.md): + +| Method | Path | What it does | +| --- | --- | --- | +| `GET` | `/usage-alerts` | List your team's alerts | +| `POST` | `/usage-alerts` | Add an alert | +| `PATCH` | `/usage-alerts/{id}` | Change an alert | +| `DELETE` | `/usage-alerts/{id}` | Delete an alert | + +Any member can list alerts. Adding, changing and deleting them needs an owner or admin, or an API key. An alert has these fields: + +| Field | Values | +| --- | --- | +| `window_type` | `day`, `week` or `period` | +| `threshold` | Dollars, or a percentage when `threshold_type` is `percent` | +| `threshold_type` | `credits` (dollars, the default) or `percent`. `percent` is only allowed with `period` | +| `channels` | Any of `email`, `slack` and `webhook`. Defaults to `["email"]`. Leave it empty for a hard stop that sends nothing | +| `hard_stop` | `true` refuses runs that would go over the threshold. Defaults to `false` | +| `enabled` | Defaults to `true` | diff --git a/ci-cd/any-ci.md b/ci-cd/any-ci.md index 34fd67a..cc54291 100644 --- a/ci-cd/any-ci.md +++ b/ci-cd/any-ci.md @@ -1,15 +1,80 @@ # Any CI -As DeviceCloud uses a simple CLI, you can run it in any CI service using a basic script in bash (or any lang). +The DeviceCloud CLI runs anywhere Node 22 or later is installed, so you can call it from any CI service in a single script step. We recommend using npx so you don't need to install the npm package. In CI, authenticate with an [API key](../getting-started/api-keys.md) — set `DEVICE_CLOUD_API_KEY` as a secret, or pass `--api-key`. For example: ```bash -npx --yes @devicecloud.dev/dcd@latest cloud sample.zip ios-flow.yaml --quiet --api-key "$DEVICE_CLOUD_API_KEY" +npx --yes @devicecloud.dev/dcd@latest cloud --app-file build/app-release.apk --flows .maestro --quiet ``` -If your code is on GitHub, add `--metadata gh_repo= --metadata gh_sha=` and DeviceCloud will post a [check](github-checks.md) on that commit. When a commit is tested more than once, add `--metadata gh_check_name=iOS` to each run so they post separately named checks (`DeviceCloud / iOS`) that branch protection can require independently. +The CLI reads `DEVICE_CLOUD_API_KEY` from the environment, so you don't need `--api-key` when the secret is exposed under that name. `--quiet` leaves out the progress updates while the run is polled, which keeps CI logs short. -If you need advice - please ask in [Discord](https://discord.gg/gm3mJwcNw8), we'd be happy to provide pointers. +## Pass or fail -Want a specific CI integration build? Please request it in [GitHub Discussions](https://github.com/orgs/devicecloud-dev/discussions) +`dcd cloud` waits for the run to finish and sets its exit code from the result, so the CI step fails when your tests do: + +| Exit code | Meaning | +|---|---| +| `0` | Every flow passed, or a newer run superseded this one through [`--cancel-previous`](../advanced/cancel-previous.md). | +| `2` | The run failed: a flow failed or was cancelled. | +| `1` | A CLI or infrastructure error, for example a wrong path, a network failure or a run the API refused to start. | + +Two flags change this. With `--async`, the CLI exits `0` as soon as the run is submitted, whatever the result. With `--json-file`, it exits `0` even when the run fails, so don't use it on a step that should gate your pipeline. See [Exit Codes](../advanced/exit-codes.md). + +## GitLab CI + +Add `DEVICE_CLOUD_API_KEY` as a masked variable under **Settings > CI/CD > Variables**. A variable marked **Protected** only reaches pipelines on protected branches and tags. + +```yaml +# .gitlab-ci.yml +e2e: + stage: test + image: node:lts + needs: [build] # your job that builds the APK and keeps it as an artifact + script: + - npx --yes @devicecloud.dev/dcd@latest cloud --app-file build/app-release.apk --flows .maestro --name "$CI_COMMIT_SHORT_SHA" --quiet +``` + +## CircleCI + +Add `DEVICE_CLOUD_API_KEY` under **Project Settings > Environment Variables**, or in a context. + +```yaml +# .circleci/config.yml +version: 2.1 + +jobs: + e2e: + docker: + - image: cimg/node:lts + steps: + - checkout + - attach_workspace: # the APK that an earlier job saved with persist_to_workspace + at: . + - run: npx --yes @devicecloud.dev/dcd@latest cloud --app-file build/app-release.apk --flows .maestro --name "$CIRCLE_SHA1" --quiet + +workflows: + test: + jobs: + - build # your job that builds the APK + - e2e: + requires: [build] +``` + +## GitHub checks + +If your code is on GitHub and the [DeviceCloud GitHub App](github-checks.md) is connected, pass the repository and the commit, and DeviceCloud posts a check on that commit: + +```bash +npx --yes @devicecloud.dev/dcd@latest cloud --app-file build/app-release.apk --flows .maestro \ + --repo-name acme/my-app --commit-sha "$COMMIT_SHA" +``` + +Use the commit that your pull request shows. On CircleCI that's `$CIRCLE_SHA1`, with `--repo-name "$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"`. In a GitHub Actions `pull_request` run it's `${{ github.event.pull_request.head.sha }}`, not `GITHUB_SHA`: that one is a temporary merge commit, and a check posted on it never shows on the PR. + +When a commit is tested more than once, add `--metadata gh_check_name=iOS` (a different name per job) so each run posts its own check (`DeviceCloud / iOS`) that branch protection can require on its own. + +## Need help? + +Ask in [Discord](https://discord.gg/gm3mJwcNw8). To request an integration for your CI provider, post in [GitHub Discussions](https://github.com/orgs/devicecloud-dev/discussions). diff --git a/ci-cd/bitbucket-pipelines.md b/ci-cd/bitbucket-pipelines.md index f058442..d9b762c 100644 --- a/ci-cd/bitbucket-pipelines.md +++ b/ci-cd/bitbucket-pipelines.md @@ -56,30 +56,40 @@ Find your API key at [console.devicecloud.dev/settings](https://console.devicecl ## Variables -Most pipe variables map to the [`dcd cloud`](../cli/dcd-cloud.md) CLI flag of the same name, e.g. `ANDROID_API_LEVEL` sets `--android-api-level`. The full list for version 1.5.0 lives in the pipe's [README](https://bitbucket.org/devicecloud-dev/device-cloud-for-bitbucket/src/v1.5.0/README.md). Required: `API_KEY`. Common ones: +Most pipe variables map to the [`dcd cloud`](../cli/dcd-cloud.md) CLI flag of the same name, e.g. `ANDROID_API_LEVEL` sets `--android-api-level`. The full list for version 1.6.1 lives in the pipe's [README](https://bitbucket.org/devicecloud-dev/device-cloud-for-bitbucket/src/v1.6.1/README.md). Required: `API_KEY`. Common ones: | Variable | Description | |---|---| | `API_KEY` | DeviceCloud API key (required, secured). | -| `APP_FILE` | Path to the app binary to upload. | +| `APP_FILE` | Path to the app binary to upload. Set one of `APP_FILE`, `APP_BINARY_ID` or `APP_URL`. | | `APP_BINARY_ID` | Reuse a previously uploaded binary. | -| `WORKSPACE` / `FLOWS` | Path to your Maestro flows folder/file. | +| `APP_URL` | Signed URL of an Expo iOS simulator build (`.tar.gz`). The CLI downloads and extracts it. | +| `WORKSPACE` / `FLOWS` | Path to your Maestro flows folder or file. If you set both, `FLOWS` wins. | | `ANDROID_DEVICE`, `ANDROID_API_LEVEL` | Android device + API level. | | `IOS_DEVICE`, `IOS_VERSION` | iOS device + version. | +| `DEVICE_LOCALE` | Device locale, e.g. `de_DE`. See [Device Locale](../configuration/device-locale.md). | +| `GOOGLE_PLAY` | `"true"` to run on Android devices with Google Play. | +| `MAESTRO_VERSION` | Maestro version to run your flows with. See [Maestro Versions](../configuration/maestro-versions.md). | +| `CONFIG` | Path to a custom Maestro config file. | +| `NAME` | Name for the run in the console. | | `ENV_LIST` | Newline-separated `KEY=VALUE` env vars injected into flows. | +| `METADATA` | Newline-separated `key=value` metadata attached to the run. | | `INCLUDE_TAGS` / `EXCLUDE_TAGS` | Filter flows by Maestro tag. | -| `REPORT` | `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated and will be removed on 7 December 2026. See [Report Formats](../artifacts/report-formats.md). | +| `RETRY` | Number of retries on failure, up to `2`. Retries are free. | +| `REPORT` | `junit` or `html`. `html-detailed` and `allure` are deprecated, see [Report Formats](../artifacts/report-formats.md). | | `JUNIT_PATH` | Where to write the JUnit report (default `./report.xml`). | | `DOWNLOAD_ARTIFACTS` | `ALL` or `FAILED` — downloads logs/screenshots/videos. | +| `JSON_FILE` | `"true"` to write the results to `_dcd.json`. | | `ASYNC` | `"true"` to fire-and-forget. | | `CANCEL_PREVIOUS` | `"true"` to cancel the previous run's still-queued tests when this one starts (from pipe 1.5.0). See [Cancelling superseded runs](../advanced/cancel-previous.md). | | `PRIORITY` | `low`, `normal` (default) or `high` (from pipe 1.6.0). Reorders only your organisation's own queued runs, see [Run Priority](../configuration/run-priority.md). | -| `RUNNER_TYPE` | `default`, `cpu1`, `m1` or `m4`. `m1` and `m4` are premium runners, see [Runner Type](../configuration/runner-type.md). | +| `CHECK_NAME` | Names the GitHub check this run posts, see [Bitbucket context auto-attached](#bitbucket-context-auto-attached). | +| `RUNNER_TYPE` | `default`, `cpu1`, `m1` or `m4`. `m1` and `m4` are premium runners, see [Runner Types](../configuration/runner-type.md). | | `RENDER_ENGINE` | Android only: `lavapipe` or `swiftshader`, the software renderer the emulator boots with on the default Android runner. Leave unset to let DeviceCloud choose (`swiftshader` for apps built with Flutter, otherwise `lavapipe`). | ## Bitbucket context auto-attached -The pipe auto-attaches Bitbucket context (commit SHA, repo, branch, PR number) as metadata on every run and are included on the Console UI so you know what triggered each run. +The pipe attaches each run's Bitbucket context as metadata: the commit, repository, branch, build number and, for a pull request, the PR number and URL. The console shows it with the run, so you can see what triggered it. If you would prefer not to include this metadata, set `INCLUDE_BITBUCKET_CONTEXT: 'false'`. diff --git a/ci-cd/bitrise-steps.md b/ci-cd/bitrise-steps.md index 16da373..029f5ec 100644 --- a/ci-cd/bitrise-steps.md +++ b/ci-cd/bitrise-steps.md @@ -1,31 +1,23 @@ -# BitRise Steps +# Bitrise Steps -DeviceCloud includes a BitRise step to allow automatic triggering of tests via your BitRise CI process. This page describes version 1.4.0 of the step; where something is newer than 1.2.0, the version it arrived in is noted. +The **Device Cloud for Maestro** step runs your Maestro flows on DeviceCloud from a Bitrise workflow. This page describes version 1.5.0 of the step. Where something is newer than 1.2.0, the version it arrived in is noted. +## Set up the step - -**How to configure the integration:** - -1. Edit your workflow in BitRise to add a new step. +1. Edit your workflow in Bitrise to add a new step. 2. Search for 'Device Cloud for Maestro' and select the step. ![Searching for the Device Cloud for Maestro step in Bitrise](../assets/bitrise-add-step.png) -3. The step will now appear in your workflow +3. The step now appears in your workflow. ![The Device Cloud for Maestro step added to a Bitrise workflow](../assets/bitrise-workflow-step.png) 4. Populate the API key using a BitRise secret and set any variables. Most inputs correspond to a [`dcd cloud`](../cli/dcd-cloud.md) flag — see that reference for accepted values. Not every flag has an input: device matrices, for example, aren't available in the step. -**Render Engine** (`render_engine`, from 1.3.0) picks the software renderer the Android emulator boots with on the default Android runner: `lavapipe` or `swiftshader`. Leave it empty to let DeviceCloud choose (`swiftshader` for apps built with Flutter, otherwise `lavapipe`). - -The `priority` input sets the run's [priority](../configuration/run-priority.md): `low`, `normal` (the default) or `high`. It reorders only your organisation's own queued runs. - -### GitHub context - -From 1.4.0, when your app's repository is on GitHub the step attaches the build's GitHub context to the run as metadata, read from Bitrise's environment: the repository (`gh_repo`), commit (`gh_sha`), branch (`gh_branch`) and, for pull request builds, the PR number and URL (`gh_pr_number`, `gh_pr_url`). That is what [GitHub checks](github-checks.md) need, so there's nothing to add. Keys you set yourself in the **Metadata** input take precedence, and **Include GitHub Context** (`include_github_context`) set to `false` turns this off. +![The Device Cloud for Maestro step inputs in Bitrise](../assets/bitrise-step-config.png) -On 1.2.0 and 1.3.0 the step doesn't attach these, so add `gh_repo` and `gh_sha` in the **Metadata** input (one `key=value` per line) or no check is posted: +In `bitrise.yml`, a step that runs an Android build looks like this: ```yaml - device-cloud-for-maestro@1: @@ -33,28 +25,112 @@ On 1.2.0 and 1.3.0 the step doesn't attach these, so add `gh_repo` and `gh_sha` - api_key: $DEVICE_CLOUD_API_KEY - app_file: $BITRISE_APK_PATH - workspace: .maestro - - metadata: |- - gh_repo=my-org/my-app - gh_sha=$BITRISE_GIT_COMMIT + - env_list: |- + USERNAME=test@example.com + PASSWORD=$TEST_PASSWORD ``` +`@1` runs the latest 1.x release of the step. Store the API key and any passwords as Bitrise secrets: Bitrise fills in `$DEVICE_CLOUD_API_KEY` and `$TEST_PASSWORD` before the step runs. + +## Inputs + +The step runs from `$BITRISE_SOURCE_DIR`, so relative paths start there. An input left empty uses the default shown. + +### App and flows + +| Input | Key | Default | Description | +|---|---|---|---| +| Device Cloud API Key | `api_key` | — | Required. Your DeviceCloud API key, from a Bitrise secret. | +| App File Path | `app_file` | — | Path to the app binary: an `.apk`, a simulator `.app` or `.zip`, or an Expo iOS `.tar.gz`. | +| App Binary ID | `app_binary_id` | — | ID of a binary you've already uploaded, used instead of `app_file`. Needs step 1.5.1 or later. | +| Expo App URL | `app_url` | — | Signed URL of an Expo iOS build (`.tar.gz`), used instead of `app_file`. The CLI downloads and extracts it. Expo's URLs expire after about an hour. | +| Workspace Folder | `workspace` | — | Required. Path to your flows folder, or to a single flow file, e.g. `.maestro`. | +| Include Tags | `include_tags` | — | Only run flows with these Maestro tags (comma-separated). | +| Exclude Tags | `exclude_tags` | — | Skip flows with these tags (comma-separated). | +| Exclude Flows | `exclude_flows` | — | Subfolders to leave out. | +| Config File | `config` | `config.yaml` in the flows folder | Path to a custom Maestro config file. | +| Environment Variables | `env_list` | — | Variables to pass into your flows, one `KEY=VALUE` per line. See [Environment Variables](../configuration/environment-variables.md). | + +### Devices + +For the devices and OS versions you can pass, and which combinations work, see [Devices & OS Versions](../getting-started/devices-configuration.md). + +| Input | Key | Default | Description | +|---|---|---|---| +| Android Device | `android_device` | `pixel-10` | Android device, e.g. `pixel-8`. | +| Android API Level | `android_api_level` | `36` | Android API level, e.g. `34`. | +| iOS Device | `ios_device` | `iphone-16` | iOS device, e.g. `iphone-17`. | +| iOS Version | `ios_version` | `26` | Major iOS version, e.g. `18`. | +| Device Locale | `device_locale` | — | E.g. `de_DE`. See [Device Locale](../configuration/device-locale.md). | +| Device Orientation | `orientation` | `0` | Android only. `0` (portrait) or `90` (landscape). | +| Google Play | `google_play` | `false` | Android only. Run on devices with Google Play. | +| Runner Type | `runner_type` | `default` | `default`, `cpu1`, `m1` or `m4`. `m1` and `m4` incur premium pricing. See [Runner Types](../configuration/runner-type.md). | +| Render Engine | `render_engine` | — | Android only, from 1.3.0. `lavapipe` or `swiftshader`, the software renderer the emulator boots with on the default Android runner. Leave it empty to let DeviceCloud choose (`swiftshader` for apps built with Flutter, otherwise `lavapipe`). | +| Android No Snapshot | `android_no_snapshot` | `false` | Android only. Force a cold boot. Already on for API 34 and later. | +| Maestro Chrome Onboarding | `maestro_chrome_onboarding` | `false` | Android only. See [Chrome Onboarding](../advanced/chrome-onboarding.md). | +| Show Crosshairs | `show_crosshairs` | `false` | Android only. Show crosshairs where the flow taps. | +| Disable Animations | `disable_animations` | `false` | Turn off device animations (Reduce Motion on iOS). See [Animations](../configuration/disable-animations.md). | + +### Running the tests + +| Input | Key | Default | Description | +|---|---|---|---| +| Test Run Name | `name` | — | Name for the run in the console. | +| Maestro Version | `maestro_version` | DeviceCloud's default | See [Maestro Versions](../configuration/maestro-versions.md). | +| Retry Count | `retry` | `0` | Retries on failure, up to `2`. Retries are free. | +| Priority | `priority` | `normal` | From 1.5.0. `low`, `normal` or `high`: which of your team's queued runs starts first. It never moves your runs ahead of other customers. See [Run Priority](../configuration/run-priority.md). | +| Cancel Previous Run | `cancel_previous` | `false` | From 1.4.0. Cancel the previous run's still-queued tests when this one starts. See [Cancelling superseded runs](#cancelling-superseded-runs). | +| Async Execution | `async` | `false` | Don't wait for the results: the step passes once the run is submitted. See [Async Execution](../advanced/async-execution.md). | +| Dry Run | `dry_run` | `false` | List the flows that would run without starting a run. | +| Ignore SHA Check | `ignore_sha_check` | `false` | Upload the binary even if the same file was uploaded before. Not recommended. | + +### Reports and output + +| Input | Key | Default | Description | +|---|---|---|---| +| Report Format | `report` | — | `junit` or `html`. `html-detailed` and `allure` are deprecated, see [Report Formats](../artifacts/report-formats.md). | +| JUnit Report Path | `junit_path` | `./report.xml` | Where to save the JUnit report. | +| HTML Report Path | `html_path` | `./report.zip` | Where to save the HTML report, a ZIP of the report and its files. | +| Allure Report Path | `allure_path` | `./report.html` | Where to save the Allure report. | +| Download Artifacts | `download_artifacts` | — | `ALL` or `FAILED`: download the logs, screenshots and videos as a ZIP. With the default `artifacts_path`, the step also unzips them into `$BITRISE_DEPLOY_DIR`. | +| Artifacts Path | `artifacts_path` | `./artifacts.zip` | Where to save the artifacts ZIP. | +| JSON Output | `json` | `false` | Print the results as JSON. The step still fails a failed run. | +| JSON File Output | `json_file` | `false` | Write the results to `_dcd.json`. See [Pass or fail](#pass-or-fail). | +| JSON File Name | `json_file_name` | — | Another name, or a relative path, for that file. | +| Debug Mode | `debug` | `false` | Verbose CLI output. | +| Use Beta CLI | `use_beta` | `false` | Run the beta CLI instead of the latest stable release. | + +### GitHub checks and metadata + +| Input | Key | Default | Description | +|---|---|---|---| +| Include GitHub Context | `include_github_context` | `true` | From 1.4.0. Attach the build's GitHub context to the run, see [GitHub context](#github-context). | +| GitHub Check Name | `check_name` | — | Names the GitHub check this run posts. | +| Metadata | `metadata` | — | Extra `key=value` pairs for the run, one per line. | + +## GitHub context + +From 1.4.0, when your app's repository is on GitHub the step attaches the build's GitHub context to the run as metadata, read from Bitrise's environment: the repository (`gh_repo`), commit (`gh_sha`), branch (`gh_branch`) and, for pull request builds, the PR number and URL (`gh_pr_number`, `gh_pr_url`). That is what [GitHub checks](github-checks.md) need, so there's nothing to add. Keys you set yourself in the **Metadata** input take precedence, and **Include GitHub Context** (`include_github_context`) set to `false` turns this off. + +On 1.2.0 and 1.3.0 the step doesn't attach these. Add `gh_repo=` and `gh_sha=$BITRISE_GIT_COMMIT` to the **Metadata** input, one per line, or no check is posted. + The **GitHub Check Name** input (`check_name`) names the check a run posts — `iOS` gives `DeviceCloud / iOS`. Set it when a commit is tested by more than one workflow, so each gets a check you can require separately in branch protection. -### Outputs +## Outputs | Output | Description | |--------|-------------| | `DEVICE_CLOUD_CONSOLE_URL` | URL to view the run in the DeviceCloud console. | | `DEVICE_CLOUD_UPLOAD_STATUS` | `PASSED` or `FAILED` once the run has finished, or `PENDING`, `QUEUED` or `RUNNING` if it hadn't (an async run reports whatever it had reached at submission). `ERROR` if the status couldn't be read. `SUPERSEDED` when a newer run replaced this one through [`cancel_previous`](../advanced/cancel-previous.md); the step passes. | | `DEVICE_CLOUD_FLOW_RESULTS` | JSON array with one entry per flow: `name`, `status` and, for a failed flow, `failReason`. | -| `DEVICE_CLOUD_APP_BINARY_ID` | ID of the uploaded app binary, to reuse with `app_binary_id` in a later step. | +| `DEVICE_CLOUD_APP_BINARY_ID` | ID of the uploaded app binary. To reuse it in a later step through `app_binary_id`, you need step 1.5.1 or later. | Before 1.4.0 the status, flow results and binary ID outputs are empty; only the console URL is set. -### Pass or fail +## Pass or fail -The step fails when the run fails. From 1.4.0 that also holds with **JSON File** (`json_file`) turned on, where the CLI itself exits `0`: the step decides from the run's status instead. On earlier versions, leave `json_file` off if the step's result gates your workflow. +The step fails when the run fails. From 1.4.0 that also holds with **JSON File Output** (`json_file`) turned on, where the CLI itself exits `0`: the step decides from the run's status instead. On earlier versions, leave `json_file` off if the step's result gates your workflow. -From 1.4.0, to cancel the previous run's still-queued tests when a new build starts, set the **Cancel Previous Run** input (`cancel_previous`) to `true` — see [Cancelling superseded runs](../advanced/cancel-previous.md). The step attaches the context this needs for a GitHub repository (see [GitHub context](#github-context)) and the pipeline's ID as the run ID, so invocations in one pipeline don't cancel each other. For a repository hosted elsewhere, add `gh_repo=` and `gh_branch=$BITRISE_GIT_BRANCH` to the **Metadata** input, one per line; without them nothing is cancelled. +## Cancelling superseded runs -![The Device Cloud for Maestro step inputs in Bitrise](../assets/bitrise-step-config.png) +From 1.4.0, to cancel the previous run's still-queued tests when a new build starts, set the **Cancel Previous Run** input (`cancel_previous`) to `true` — see [Cancelling superseded runs](../advanced/cancel-previous.md). The step attaches the context this needs for a GitHub repository (see [GitHub context](#github-context)) and the pipeline's ID as the run ID, so invocations in one pipeline don't cancel each other. For a repository hosted elsewhere, add `gh_repo=` and `gh_branch=$BITRISE_GIT_BRANCH` to the **Metadata** input, one per line; without them nothing is cancelled. If one build runs the step more than once (iOS and Android, say), give each its own **GitHub Check Name**, or one platform's new run cancels the other's previous run. diff --git a/ci-cd/eas-workflows.md b/ci-cd/eas-workflows.md index d345bc9..e7e1a00 100644 --- a/ci-cd/eas-workflows.md +++ b/ci-cd/eas-workflows.md @@ -61,8 +61,10 @@ jobs: DCD_EAS_BUILD_ID: ${{ needs.build_android.outputs.build_id }} DCD_EAS_PLATFORM: ${{ needs.build_android.outputs.platform }} DCD_EAS_APP_VERSION: ${{ needs.build_android.outputs.app_version }} + DCD_GH_REPO: acme/my-app # your repository, as owner/repo DCD_GH_SHA: ${{ github.sha }} DCD_GH_BRANCH: ${{ github.ref_name }} + DCD_CHECK_NAME: Android outputs: console_url: ${{ steps.dcd.outputs.console_url }} status: ${{ steps.dcd.outputs.upload_status }} @@ -99,8 +101,10 @@ jobs: DCD_EAS_BUILD_ID: ${{ needs.build_ios.outputs.build_id }} DCD_EAS_PLATFORM: ${{ needs.build_ios.outputs.platform }} DCD_EAS_APP_VERSION: ${{ needs.build_ios.outputs.app_version }} + DCD_GH_REPO: acme/my-app # your repository, as owner/repo DCD_GH_SHA: ${{ github.sha }} DCD_GH_BRANCH: ${{ github.ref_name }} + DCD_CHECK_NAME: iOS outputs: console_url: ${{ steps.dcd.outputs.console_url }} status: ${{ steps.dcd.outputs.upload_status }} @@ -158,9 +162,11 @@ The build artifact itself is downloaded by `eas/download_build` and passed via ` | `DCD_GH_RUN_ID` | `${{ workflow.id }}` | `gh_run_id` metadata — the EAS workflow run ID, the same on every job of one workflow run (EAS has no `github.run_id`) | | `DCD_GH_PR_NUMBER` | `${{ github.event.pull_request.number }}` | `gh_pr_number` metadata | | `DCD_GH_PR_URL` | `${{ github.event.pull_request.html_url }}` | `gh_pr_url` metadata | -| `DCD_GH_REPO` | `${{ github.repository }}` | `gh_repo` metadata | +| `DCD_GH_REPO` | `${{ github.repository }}`, or a fixed `owner/repo` string | `gh_repo` metadata | | `DCD_CHECK_NAME` | a fixed string, e.g. `iOS` | `gh_check_name` metadata — names the [GitHub check](github-checks.md) this job posts (`DeviceCloud / iOS`) | +To post a [GitHub check](github-checks.md), set both `DCD_GH_REPO` and `DCD_GH_SHA`, and connect the DeviceCloud GitHub App. Without both, no check is posted. A fixed `owner/repo` string for `DCD_GH_REPO`, as in the [Platform Examples](#platform-examples), stays valid on manual runs, where `${{ github.repository }}` doesn't (see the warning below). + Set `DCD_CHECK_NAME` when a commit is tested by more than one job, so each gets a check of its own that can be required separately in branch protection. Keep it fixed per job — GitHub matches required checks by name. ::: warning @@ -201,18 +207,20 @@ Anything you pass on the command line after `npx @devicecloud.dev/eas-workflow@v ### Device Configuration +For the devices and OS versions you can pass, and which combinations work, see [Devices & OS Versions](../getting-started/devices-configuration.md). + | Flag | Description | |------|-------------| -| `--android-device ` | `pixel-6`, `pixel-7` (deprecated), `pixel-8`, `pixel-10`, `pixel-10-pro`, `pixel-10-pro-xl`, `pixel-10-pro-fold`, `pixel-11`, `generic-tablet`. Default `pixel-10`. | -| `--android-api-level ` | `32` – `37`. Default `36`. | -| `--ios-device ` | `iphone-14`, `iphone-16`, `iphone-16-pro` (deprecated), `iphone-17`, `iphone-air`, `iphone-18-pro`, `iphone-18-pro-max`, `iphone-duo`, `ipad-pro-m5-11`, `ipad-pro-m5-13`. | -| `--ios-version ` | `17` (deprecated), `18`, `26`, `27`. Default `26`. | +| `--android-device ` | Android device, e.g. `pixel-8`. Default `pixel-10`. | +| `--android-api-level ` | Android API level, e.g. `34`. Default `36`. | +| `--ios-device ` | iOS device, e.g. `iphone-17`. Default `iphone-16`. | +| `--ios-version ` | Major iOS version, e.g. `18`. Default `26`. | +| `--android-device-matrix `, `--ios-device-matrix ` | Run every flow once per device and OS pair, e.g. `pixel-8:34`. Repeatable. See [Device Matrix](../configuration/device-matrix.md). | | `--device-locale ` | E.g. `de_DE`. See [Device Locale](../configuration/device-locale.md). | | `--orientation ` | Android only. `0` or `90`. | | `--google-play` | Android only. Run on Google Play devices. | | `--runner-type ` | `default`, `cpu1`, `m1`, `m4`. `m1` and `m4` incur premium pricing. See [Runner Types](../configuration/runner-type.md). | - -See the [Devices & OS Versions](../getting-started/devices-configuration.md) page for the full availability matrix. +| `--render-engine ` | Android only. `lavapipe` or `swiftshader`, the software renderer the emulator boots with on the default Android runner. Leave it out to let DeviceCloud choose (`swiftshader` for apps built with Flutter, otherwise `lavapipe`). | ### Test Configuration @@ -221,8 +229,10 @@ See the [Devices & OS Versions](../getting-started/devices-configuration.md) pag | `--maestro-version ` | Maestro CLI version. See [Maestro Versions](../configuration/maestro-versions.md). | | `--env KEY=value` | Inject environment variables into your flows. Repeatable. | | `--name ` | Custom name for this test run. | +| `--metadata key=value` | Extra metadata for the run. Repeatable. | | `--retry ` | Number of automatic retries on failure (max `2`). Retries are free. | -| `--report ` | `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated and will be removed on 7 December 2026. See [Report Formats](../artifacts/report-formats.md). | +| `--report ` | `junit` or `html`, saved in the working directory as `report.xml` or `report.zip`. `html-detailed` and `allure` are deprecated, see [Report Formats](../artifacts/report-formats.md). | +| `--junit-path `, `--html-path ` | Save the report somewhere else. | ### Execution Options @@ -231,7 +241,8 @@ See the [Devices & OS Versions](../getting-started/devices-configuration.md) pag | `--async` | Exit immediately without waiting for results (exit code `0` regardless). See [Async Execution](../advanced/async-execution.md). | | `--cancel-previous` | Cancel the still-queued tests of the previous run of this job on the same branch or PR. Needs `DCD_GH_REPO` plus `DCD_GH_BRANCH` or `DCD_GH_PR_NUMBER`; set `DCD_CHECK_NAME` per job. See [Cancelling superseded runs](../advanced/cancel-previous.md). | | `--priority ` | `low`, `normal` (default) or `high`. Reorders only your organisation's own queued runs. See [Run Priority](../configuration/run-priority.md). | -| `--download-artifacts ` | Download logs/screenshots/videos. Options: `ALL`, `FAILED`. | +| `--download-artifacts ` | Download logs/screenshots/videos as `artifacts.zip` in the working directory. Options: `ALL`, `FAILED`. `--artifacts-path` saves it somewhere else. | +| `--json-file` | Write the results to `_dcd.json`. The job still fails when the run fails. | | `--disable-animations` | Disable device animations. See [Animations](../configuration/disable-animations.md). | | `--maestro-chrome-onboarding` | Android only. See [Chrome Onboarding](../advanced/chrome-onboarding.md). | | `--android-no-snapshot` | Force cold boot. Auto-enabled for API 34+. | @@ -288,10 +299,10 @@ jobs: | Code | Meaning | |------|---------| -| `0` | All flows passed, or run started successfully in async mode. | -| `1` | At least one flow failed, the run was cancelled, or the wrapper hit an internal error. | +| `0` | Every flow passed, a newer run superseded this one through [`--cancel-previous`](../advanced/cancel-previous.md), or, with `--async`, the run was submitted. | +| `1` | A flow failed or was cancelled, the CLI hit an error, or the wrapper couldn't read the run's status. | -See [Exit Codes](../advanced/exit-codes.md) for the full list. +The wrapper only exits `0` or `1`: it turns the CLI's `2` (the run failed) into `1`. See [Exit Codes](../advanced/exit-codes.md) for what `dcd cloud` itself returns. --- @@ -341,11 +352,13 @@ jobs: ### Pass secrets into flows -Set the secret as an EAS env var first: +Set each secret as an EAS env var first: ```bash eas env:create --scope project --environment production \ --name TEST_USERNAME --visibility secret --type string --value +eas env:create --scope project --environment production \ + --name TEST_PASSWORD --visibility secret --type string --value ``` Then reference it as a regular env var in the wrapper invocation: @@ -374,7 +387,7 @@ Then reference it as a regular env var in the wrapper invocation: ## Migrating from `maestro-cloud` -EAS's built-in `maestro-cloud` job is closed-source and hardcoded to Maestro Cloud. To switch to DeviceCloud, replace the whole job with a custom job that calls the wrapper: +EAS's built-in `maestro-cloud` job only runs your flows on Maestro Cloud. To switch to DeviceCloud, replace the whole job with a custom job that calls the wrapper: ```yaml # Before @@ -384,7 +397,6 @@ e2e: build_id: ${{ needs.build.outputs.build_id }} maestro_project_id: proj_xxx flows: ./.maestro - maestro_api_key: ${{ secrets.MAESTRO_CLOUD_API_KEY }} # After e2e: @@ -404,6 +416,25 @@ e2e: Then store your DeviceCloud API key as a project secret (as shown in [Quick Start](#quick-start)). +Move the other `maestro-cloud` params like this: + +| `maestro-cloud` param | In the new job | +|---|---| +| `build_id` | `build_id` on the `eas/download_build` step, which hands the file to `--app-file` | +| `maestro_project_id`, `maestro_api_key` | Remove them. The wrapper uses `DEVICE_CLOUD_API_KEY`. | +| `flows` | `--flows` | +| `include_tags`, `exclude_tags` | `--include-tags`, `--exclude-tags` | +| `maestro_version` | `--maestro-version`, see [Maestro Versions](../configuration/maestro-versions.md) | +| `maestro_config` | `--config` | +| `device_locale` | `--device-locale` | +| `device_model` | `--android-device` or `--ios-device`, with DeviceCloud's device names, e.g. `pixel-8` or `iphone-16` | +| `device_os` | `--android-api-level` (e.g. `34`) or `--ios-version` (the major version, e.g. `18`) | +| `name` | `--name` | +| `branch` | `DCD_GH_BRANCH` in the job's `env:` | +| `async` | `--async` | +| `skip_build_check` | Not needed. | +| `environment` | Keep it on the new job: it picks the EAS environment that `DEVICE_CLOUD_API_KEY` is read from. A custom job uses `production` unless you set it, while `maestro-cloud` defaults to `preview`. | + ## Source The wrapper is open source and can be found here: [github.com/devicecloud-dev/device-cloud-for-eas](https://github.com/devicecloud-dev/device-cloud-for-eas). diff --git a/ci-cd/github-actions.md b/ci-cd/github-actions.md index c6a32fb..6a4efb5 100644 --- a/ci-cd/github-actions.md +++ b/ci-cd/github-actions.md @@ -2,7 +2,7 @@ The DeviceCloud GitHub Action is a drop-in replacement for the [Maestro Cloud Action](https://github.com/mobile-dev-inc/action-maestro-cloud). The inputs are identical where practical, so switching is straightforward. -Additionally, you can set up our GitHub App to use GitHub Checks to manage pull requests and blocking. Read more [here](github-checks.md). +To get a pass/fail check on each pull request, which you can require before merging, install the DeviceCloud GitHub App. See [GitHub Checks](github-checks.md). ## Quick Start @@ -57,7 +57,7 @@ If you still need it, allow the event for that workflow in an Actions policy, se app-file: app/build/outputs/apk/debug/app-debug.apk ``` -From v2.6.0, `app-file` also accepts a glob pattern such as `build/**/*.apk`. When a pattern matches several files, the first in sorted order is used. +`app-file` also accepts a glob pattern such as `build/**/*.apk`. When a pattern matches several files, the first in sorted order is used. ### iOS @@ -68,7 +68,7 @@ From v2.6.0, `app-file` also accepts a glob pattern such as `build/**/*.apk`. Wh app-file: .zip ``` -`app-file` must point to an Apple silicon compatible Simulator `.app` build, or a zipped `.zip` bundle. From v2.6.0 it can also be a glob pattern, as for Android. +`app-file` must point to an Apple silicon compatible Simulator `.app` build, or a zipped `.zip` bundle. It can also be a glob pattern, as for Android. ### iOS with Expo @@ -78,6 +78,8 @@ If you build with EAS, download the build artifact in an earlier step and pass t ## Inputs Reference +`@v2` always runs the latest 2.x release of the Action, so every input below is available. + ### Authentication | Input | Required | Description | @@ -88,7 +90,7 @@ If you build with EAS, download the build artifact in an earlier step and pass t | Input | Required | Default | Description | |-------|----------|---------|-------------| -| `app-file` | No* | — | Path to the app binary (`.apk`, `.app`/`.zip`, or an Expo iOS `.tar.gz`), or from v2.6.0 a glob pattern (first match in sorted order). *Either `app-file` or `app-binary-id` is required. | +| `app-file` | No* | — | Path to the app binary (`.apk`, `.app`/`.zip`, or an Expo iOS `.tar.gz`), or a glob pattern (first match in sorted order). *Set exactly one of `app-file` and `app-binary-id`. | | `app-binary-id` | No* | — | ID of a previously uploaded app binary. Skips the upload step. | | `ignore-sha-check` | No | `false` | Skip the SHA hash check that prevents duplicate uploads. Not recommended. | @@ -105,19 +107,19 @@ If you build with EAS, download the build artifact in an earlier step and pass t ### Device Configuration +For the devices and OS versions you can pass, and which combinations work, see [Devices & OS Versions](../getting-started/devices-configuration.md). + | Input | Required | Default | Description | |-------|----------|---------|-------------| -| `android-device` | No | `pixel-10` | Android device model. Options: `pixel-6`, `pixel-7` (deprecated), `pixel-8`, `pixel-10`, `pixel-10-pro`, `pixel-10-pro-xl`, `pixel-10-pro-fold`, `pixel-11`, `generic-tablet`. | -| `android-api-level` | No | `36` | Android API level. Options: `32`, `33`, `34`, `35`, `36`, `37`. | -| `ios-device` | No | — | iOS device model. Options: `iphone-14`, `iphone-16`, `iphone-16-pro` (deprecated), `iphone-17`, `iphone-air`, `iphone-18-pro`, `iphone-18-pro-max`, `iphone-duo`, `ipad-pro-m5-11`, `ipad-pro-m5-13`. | -| `ios-version` | No | `26` | Major iOS version. Options: `17` (deprecated), `18`, `26`, `27`. | +| `android-device` | No | `pixel-10` | Android device model, e.g. `pixel-8`. | +| `android-api-level` | No | `36` | Android API level, e.g. `34`. | +| `ios-device` | No | `iphone-16` | iOS device model, e.g. `iphone-17`. | +| `ios-version` | No | `26` | Major iOS version, e.g. `18`. | | `device-locale` | No | — | Device locale in `ISO-639-1_ISO-3166-1` format (e.g. `de_DE`). See [Device Locale](../configuration/device-locale.md). | | `orientation` | No | `0` | Android only. Device orientation in degrees. Options: `0`, `90`. | | `google-play` | No | `false` | Android only. Run flows against Google Play devices. | | `runner-type` | No | `default` | Runner type. Options: `default`, `cpu1`, `m1`, `m4`. `m1` and `m4` incur premium pricing. See [Runner Types](../configuration/runner-type.md). | -See the [Devices & OS Versions](../getting-started/devices-configuration.md) page for the full availability matrix. - ### Test Configuration | Input | Required | Default | Description | @@ -126,7 +128,7 @@ See the [Devices & OS Versions](../getting-started/devices-configuration.md) pag | `env` | No | — | Multiline list of environment variables (`KEY=value`) to inject into flows. | | `name` | No | PR title or commit message | Custom name for this test run, visible in the console. Defaults to the pull request's title on PR events, the commit message on push events, and the commit SHA otherwise. | | `retry` | No | `0` | Number of retries on failure (max `2`). Retries are free — same as pressing retry in the UI. | -| `report` | No | — | Report format. Options: `junit`, `html`, and from v2.6.0 `html-detailed`. `html-detailed` is deprecated and will be removed on 7 December 2026. See [Report Formats](../artifacts/report-formats.md). | +| `report` | No | — | Report format: `junit` or `html`, saved in the working directory as `report.xml` or `report.zip`. `html-detailed` still works but is deprecated. See [Report Formats](../artifacts/report-formats.md). | ### Android-Specific Options @@ -149,17 +151,17 @@ The action automatically attaches Git and pull request metadata to each run, rea | Input | Required | Default | Description | |-------|----------|---------|-------------| | `include-github-context` | No | `true` | Automatically attach GitHub/PR context (branch, commit SHA, PR number, PR URL, run ID, repository) to the run as metadata. Set to `false` to opt out. | -| `check-name` | No | — | Names the [GitHub check](github-checks.md) this run posts — `iOS` gives a check called `DeviceCloud / iOS`. Use it when a PR runs more than once so each run gets its own check. Keep it fixed for a given job. | +| `check-name` | No | — | Names the [GitHub check](github-checks.md) this run posts — `iOS` gives a check called `DeviceCloud / iOS`. Use it when a PR runs more than once so each run gets its own check. Keep it fixed for a given job. It's ignored when `include-github-context` is `false`, because the run then carries no commit to post a check on. | ### Execution Options | Input | Required | Default | Description | |-------|----------|---------|-------------| | `async` | No | `false` | Exit immediately without waiting for results. Returns exit code `0` regardless of test outcome. See [Async Execution](../advanced/async-execution.md). | -| `cancel-previous` | No | `false` | Cancel the still-queued tests of the previous run of this job on the same branch or PR (from v2.6.0). See [Cancelling superseded runs](../advanced/cancel-previous.md). | +| `cancel-previous` | No | `false` | Cancel the still-queued tests of the previous run of this job on the same branch or PR. See [Cancelling superseded runs](../advanced/cancel-previous.md). | | `priority` | No | `normal` | Run priority: `low`, `normal` or `high`. Reorders only your organisation's own queued runs. See [Run Priority](../configuration/run-priority.md). | -| `quiet` | No | `true` | Quieter output, without progress updates while the run is polled. Set to `false` to see them. Before v2.6.0 this input had no effect and the output was always quiet. | -| `download-artifacts` | No | — | Download logs, screenshots, and videos after the run. Options: `ALL`, `FAILED`. | +| `quiet` | No | `true` | Quieter output, without progress updates while the run is polled. Set to `false` to see them. | +| `download-artifacts` | No | — | Download logs, screenshots, and videos after the run, as `artifacts.zip` in the working directory. Options: `ALL`, `FAILED`. | | `json-file` | No | `false` | Write test results to `_dcd.json` in the working directory. See [Save JSON results file](#save-json-results-file). | | `debug` | No | `false` | Enable verbose debug output. | | `use-beta` | No | `false` | Use the beta version of the DCD CLI. | @@ -182,9 +184,11 @@ Add an `id` to the step to reference its outputs in later steps: |--------|-------------| | `DEVICE_CLOUD_CONSOLE_URL` | URL to view the test results in the DeviceCloud console. | | `DEVICE_CLOUD_FLOW_RESULTS` | JSON array with results for each flow: `[{ "name": "...", "status": "PASSED" }]`. Empty (`[]`) with `async: true`. | -| `DEVICE_CLOUD_UPLOAD_STATUS` | Overall status of the test run: `PASSED` or `FAILED` once it has finished (a run with a cancelled flow counts as `FAILED`). `PENDING`, `QUEUED` or `RUNNING` if it hadn't finished when the status was read, and always `PENDING` with `async: true`. `ERROR` if the Action couldn't read the status. `SUPERSEDED` (from v2.6.0) when a newer run replaced this one through [`cancel-previous`](../advanced/cancel-previous.md); the job passes. | +| `DEVICE_CLOUD_UPLOAD_STATUS` | Overall status of the test run: `PASSED` or `FAILED` once it has finished (a run with a cancelled flow counts as `FAILED`). `PENDING`, `QUEUED` or `RUNNING` if it hadn't finished when the status was read, and always `PENDING` with `async: true`. `ERROR` if the Action couldn't read the status; the job then fails. `SUPERSEDED` when a newer run replaced this one through [`cancel-previous`](../advanced/cancel-previous.md); the job passes. | | `DEVICE_CLOUD_APP_BINARY_ID` | ID of the uploaded app binary. Reuse this in subsequent jobs to skip re-uploading. Not set with `async: true`. | +If `dcd cloud` itself exits with an error (exit code `1`), the job fails and no outputs are set. + --- ## Using Outputs @@ -200,34 +204,39 @@ Add an `id` to the step to reference its outputs in later steps: - name: Post Test Results to Slack if: always() - uses: slackapi/slack-github-action@v1.24.0 + uses: slackapi/slack-github-action@v4.0.0 with: - channel-id: 'test-results' - slack-message: | - Test Run Status: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_UPLOAD_STATUS }} - View Results: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_CONSOLE_URL }} - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ secrets.SLACK_CHANNEL_ID }} + text: "Test run status: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_UPLOAD_STATUS }}\nView results: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_CONSOLE_URL }}" ``` +DeviceCloud can also post every run to Slack itself, without a workflow step. See [Slack Notifications](../notifications/slack-notifications.md). + ### Save results as a workflow artifact ```yaml - name: Save Test Results if: always() - run: | - echo '${{ steps.devicecloud.outputs.DEVICE_CLOUD_FLOW_RESULTS }}' > test-results.json + env: + FLOW_RESULTS: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_FLOW_RESULTS }} + run: printf '%s\n' "$FLOW_RESULTS" > test-results.json - name: Upload Results - uses: actions/upload-artifact@v4 + if: always() + uses: actions/upload-artifact@v7 with: name: test-results path: test-results.json ``` +Passing the output through `env:` rather than writing `${{ }}` into the script keeps a flow name with a quote in it from breaking the command. + ### Reuse the uploaded binary in a later job -This needs the first job to wait for its results: with `async: true`, `DEVICE_CLOUD_APP_BINARY_ID` isn't set. +This needs the first job to wait for its results: with `async: true`, `DEVICE_CLOUD_APP_BINARY_ID` isn't set. The second job runs only if the first one passed. ```yaml jobs: @@ -236,16 +245,23 @@ jobs: outputs: binary-id: ${{ steps.devicecloud.outputs.DEVICE_CLOUD_APP_BINARY_ID }} steps: + - uses: actions/checkout@v7 + + - name: Build app + run: ./gradlew assembleDebug + - uses: devicecloud-dev/device-cloud-for-maestro@v2 id: devicecloud with: api-key: ${{ secrets.DCD_API_KEY }} - app-file: app.apk + app-file: app/build/outputs/apk/debug/app-debug.apk test-another-suite: needs: upload-and-test runs-on: ubuntu-latest steps: + - uses: actions/checkout@v7 + - uses: devicecloud-dev/device-cloud-for-maestro@v2 with: api-key: ${{ secrets.DCD_API_KEY }} @@ -327,7 +343,7 @@ This writes `_dcd.json` to the job's working directory, for example ` "status": "FAILED", "tests": [ { - "device": { "name": "Pixel 7", "osVersion": "34", "googlePlay": false }, + "device": { "name": "Pixel 10", "osVersion": "36", "googlePlay": false }, "durationSeconds": 48, "fileName": "./login.yaml", "flowName": "Login", @@ -336,7 +352,7 @@ This writes `_dcd.json` to the job's working directory, for example ` "tags": ["smoke"] }, { - "device": { "name": "Pixel 7", "osVersion": "34", "googlePlay": false }, + "device": { "name": "Pixel 10", "osVersion": "36", "googlePlay": false }, "durationSeconds": 95, "failReason": "Element not found: Text matching regex: Pay now", "fileName": "./checkout.yaml", @@ -357,13 +373,14 @@ This writes `_dcd.json` to the job's working directory, for example ` ## Migrating from Maestro Cloud -Replace the `uses` value, then check your inputs against the table below: +Replace the `uses` value, then check your inputs and outputs against the tables below: ```yaml # Before -- uses: mobile-dev-inc/action-maestro-cloud@v2 +- uses: mobile-dev-inc/action-maestro-cloud@v3 with: api-key: ${{ secrets.MCLOUD_API_KEY }} + project-id: proj_xxx app-file: app.apk # After @@ -375,14 +392,24 @@ Replace the `uses` value, then check your inputs against the table below: Update your secret name from `MCLOUD_API_KEY` to `DCD_API_KEY` (or whatever name you choose when storing your DeviceCloud API key). -These Maestro Cloud inputs work unchanged: `api-key`, `app-file`, `app-binary-id`, `workspace`, `name`, `env`, `async`, `android-api-level`, `ios-version`, `device-locale`, `include-tags` and `exclude-tags`. The ones below aren't supported. GitHub only warns about inputs an action doesn't recognise, so remove or replace them. In particular, `device-model` and `device-os` are ignored, so until you replace them your flows run on the [default device](../getting-started/devices-configuration.md#default-devices). +These Maestro Cloud inputs work unchanged: `api-key`, `app-file`, `app-binary-id`, `workspace`, `name`, `env`, `async`, `android-api-level`, `ios-version`, `device-locale`, `priority`, `include-tags` and `exclude-tags`. The ones below aren't supported. GitHub only warns about inputs an action doesn't recognise, so remove or replace them. In particular, `device-model` and `device-os` are ignored, so until you replace them your flows run on the [default device](../getting-started/devices-configuration.md#default-devices). | Maestro Cloud input | DeviceCloud equivalent | |---------------------|------------------------| | `project-id` | Not needed: runs belong to the team that owns the API key. | -| `device-model` | `ios-device` or `android-device` | -| `device-os` | `ios-version` or `android-api-level` | +| `api-url` | Remove it. Left in place, it points the Action at another API. | +| `device-model` | `ios-device` or `android-device`, with DeviceCloud's device names, e.g. `iphone-16` or `pixel-8` | +| `device-os` | `ios-version` (the major version, e.g. `18`) or `android-api-level` (e.g. `34`) | | `maestro-cli-version` | `maestro-version` | | `timeout` | None. The Action waits until the run finishes; use `async: true` to return straight away. | | `branch` | None. The branch is attached automatically with the rest of the [GitHub / PR context](#github-pr-context). | | `mapping-file` | Not supported. | + +The outputs have new names, so update any step that reads them: + +| Maestro Cloud output | DeviceCloud output | +|----------------------|--------------------| +| `MAESTRO_CLOUD_CONSOLE_URL` | `DEVICE_CLOUD_CONSOLE_URL` | +| `MAESTRO_CLOUD_APP_BINARY_ID` | `DEVICE_CLOUD_APP_BINARY_ID` | +| `MAESTRO_CLOUD_UPLOAD_STATUS` | `DEVICE_CLOUD_UPLOAD_STATUS`. Its values differ too: a finished run is `PASSED` or `FAILED`, not `SUCCESS`, `ERROR`, `CANCELED`, `WARNING` or `STOPPED`. See [Outputs Reference](#outputs-reference). | +| `MAESTRO_CLOUD_FLOW_RESULTS` | `DEVICE_CLOUD_FLOW_RESULTS`. Each entry has the flow's `name` and `status`. | diff --git a/ci-cd/github-checks.md b/ci-cd/github-checks.md index 1dcf4a2..13dd903 100644 --- a/ci-cd/github-checks.md +++ b/ci-cd/github-checks.md @@ -1,6 +1,6 @@ # GitHub Checks -Install the DeviceCloud GitHub App and every test run posts a pass/fail check on the pull request that started it. It works best with the Action's [`async`](github-actions.md#execution-options) mode where your workflow submits the run and exits after a few seconds, we run the tests on our own devices, and the result will land on the PR when it's ready. Nothing sits waiting on a runner, so you're not burning CI minutes while the tests execute. +Install the DeviceCloud GitHub App and every test run posts a pass/fail check on the pull request that started it. It works best with the Action's [`async`](github-actions.md#execution-options) mode. Your workflow submits the run and exits after a few seconds, our devices run the tests, and the result lands on the PR when it's ready. Nothing waits on a runner, so you don't spend CI minutes while the tests run. ::: info You do not need to install our Checks app to use the GitHub Action, and you don't need the Action to use Checks: any run that carries `gh_repo` and `gh_sha` metadata posts a check. The Action attaches these for you; elsewhere you pass them yourself, see [Any CI](any-ci.md), [Bitrise](bitrise-steps.md), [Bitbucket Pipelines](bitbucket-pipelines.md) and [EAS Workflows](eas-workflows.md). @@ -8,17 +8,21 @@ You do not need to install our Checks app to use the GitHub Action, and you don' ## How it works -The Action submits your tests and either polls for results or if you set `async: true`, returns straight away. DeviceCloud posts an in-progress check against the PR's commit and updates it to passed or failed once every flow has finished. The check links back to the full run in the console, and because it's an ordinary GitHub check you can require it in branch protection to keep failing builds out of your main branch. +The Action submits your tests. Without `async: true` it waits for the results; with it, it returns straight away. DeviceCloud posts an in-progress check on the PR's commit and updates it to passed or failed once every flow has finished. The check links back to the full run in the console. Because it's an ordinary GitHub check, you can require it in branch protection to keep failing builds out of your main branch. + +If a newer run replaces this one through [`cancel-previous`](../advanced/cancel-previous.md), DeviceCloud closes this run's check as `skipped`, so it can't block the PR. ## Connect the App -Open **Settings → Integrations** in the [console](https://console.devicecloud.dev/settings) and click **Connect GitHub**. GitHub asks you to authorize DeviceCloud, and what happens next depends on whether you already have the App: +Open **Settings → Integrations** in the [console](https://console.devicecloud.dev/settings?section=integrations) and click **Connect GitHub**. GitHub asks you to authorize DeviceCloud, and what happens next depends on whether you already have the App: - **First time.** GitHub sends you on to install the App and choose which repositories it can see. Once you're done you land back on the Integrations page, connected to your current team. -- **Already installed** (for example, connected to another of your teams). We reconnect to your existing installation and return you straight to the console — no reinstall, and no repository step. Your existing repository selection carries over; change it any time with **Manage repositories on GitHub** on the Integrations card. +- **Already installed** (for example, you installed it from the App's page on GitHub first). We connect your team to that installation and return you straight to the console, with no reinstall and no repository step. Your existing repository selection carries over; change it any time with **Manage repositories on GitHub** on the Integrations card. If you have the App installed on more than one GitHub account or organization, we'll ask which one to connect. +An installation can be connected to one DeviceCloud team at a time. To move it to another team, disconnect it from the first team, then connect from the new one. Disconnecting also uninstalls the App from that GitHub account or organization, so the new team goes through the install step again (see [Managing the connection](#managing-the-connection)). + The App (**DeviceCloud for GitHub**) asks for two repository permissions: **Checks** (read and write), to post and update checks, and **Metadata** (read-only), which GitHub requires for every App. It subscribes to check run events so the **Re-run failed tests** button works. A few things worth knowing: @@ -35,7 +39,7 @@ Changes take effect immediately; we track GitHub's repository events, so the con ## Run your tests -Run the [Action](github-actions.md) on your pull requests with `async: true`. It attaches the branch, commit, and PR number for you, which is how DeviceCloud knows where to post the check, so ensure you do not disable [`include-github-context`](github-actions.md#github-pr-context) (it's enabled by default). +Run the [Action](github-actions.md) on your pull requests with `async: true`. It attaches the repository and commit for you, which is how DeviceCloud knows where to post the check, so leave [`include-github-context`](github-actions.md#github-pr-context) on (it's on by default). ```yaml on: @@ -46,7 +50,7 @@ jobs: mobile-e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # build your app, or download a prebuilt artifact from an earlier job - uses: devicecloud-dev/device-cloud-for-maestro@v2 with: @@ -94,7 +98,7 @@ To make the check a merge gate, add it to a branch protection rule: your repo's ## Re-running failures -A failed check has a **Re-run failed tests** button. It re-runs only the flows that failed and is completely free, just like retries from the CI. It'll move the check back to in-progress until they finish. +A failed check has a **Re-run failed tests** button. It re-runs only the flows that failed (not cancelled ones) and is free, like retries from the CI. GitHub's own **Re-run** on the check does the same. Either one moves the check back to in-progress until the re-run finishes. ## What the check shows @@ -111,6 +115,8 @@ Because disconnecting uninstalls the App, connecting again later takes you throu Usually it's one of these: - **Nothing posts on the PR.** The App isn't installed on that repo, isn't connected to your team, the run used a different team's API key, or the run didn't carry `gh_repo` and `gh_sha` metadata. Check **Settings → Integrations**, and confirm the repo is in scope under **Manage repositories on GitHub**. +- **The check is on a commit the PR doesn't show.** `gh_sha` must be the PR's head commit. In a GitHub Actions `pull_request` run, `GITHUB_SHA` is a temporary merge commit, so pass `${{ github.event.pull_request.head.sha }}` instead. The Action does this for you. +- **Connecting fails for a GitHub account that another team uses.** An installation can be connected to one team at a time. Disconnect it from the other team first, then connect again. - **Connect GitHub lands on a GitHub 404.** That's a configuration problem on our side, not yours — nothing you can change will fix it. Get in touch and we'll sort it. - **The check is stuck in progress.** The run probably hasn't finished yet. Look it up in the console; the check only resolves once every flow reaches a final state. - **"That GitHub account isn't linked."** Link your GitHub identity under **Settings → Account**, then connect. diff --git a/ci-cd/overview.md b/ci-cd/overview.md index 5b18512..8d123f5 100644 --- a/ci-cd/overview.md +++ b/ci-cd/overview.md @@ -1,14 +1,15 @@ # CI/CD Integration -DeviceCloud supports a wide range of CI/CD options. If you don't see your provider here, please let us know. +DeviceCloud has integrations for the CI providers below. For any other provider, call the CLI directly, as described in [Any CI](any-ci.md). To ask for a new integration, post in [GitHub Discussions](https://github.com/orgs/devicecloud-dev/discussions). ### Integration Guides -* [GitHub Actions](github-actions.md) - Full GitHub Actions integration with all options -* [Bitrise](bitrise-steps.md) - Bitrise integration -* [Bitbucket Pipelines](bitbucket-pipelines.md) - Bitbucket Pipelines integration -* [EAS Workflows](eas-workflows.md) - EAS integration -* [Any CI](any-ci.md) - Generic integration using the CLI directly +* [GitHub Actions](github-actions.md) - The DeviceCloud GitHub Action, with every input and output +* [GitHub Checks](github-checks.md) - A pass/fail check on each pull request, whichever CI started the run +* [Bitrise Steps](bitrise-steps.md) - The Device Cloud for Maestro step +* [EAS Workflows](eas-workflows.md) - A custom job for Expo's EAS Workflows +* [Bitbucket Pipelines](bitbucket-pipelines.md) - The DeviceCloud pipe +* [Any CI](any-ci.md) - The CLI on its own, with GitLab CI and CircleCI examples ### Useful Features For CI/CD @@ -18,9 +19,9 @@ DeviceCloud supports a wide range of CI/CD options. If you don't see your provid * [dcd status](../cli/dcd-status.md) - Poll for results after an async run * [Report Formats](../artifacts/report-formats.md) - Generate JUnit/HTML reports for your CI system * [Artifacts & Downloads](../artifacts/artifacts.md) - Access logs, screenshots, and videos +* [Exit Codes](../advanced/exit-codes.md) - Gate your pipeline on the result ### Configuration * [Environment Variables](../configuration/environment-variables.md) - Pass secrets and config to your flows * [API Keys](../getting-started/api-keys.md) - Manage authentication -* [Exit Codes](../advanced/exit-codes.md) - Handle pass/fail in your pipeline diff --git a/cli/dcd-artifacts.md b/cli/dcd-artifacts.md index 3d666dc..f3d331b 100644 --- a/cli/dcd-artifacts.md +++ b/cli/dcd-artifacts.md @@ -6,13 +6,16 @@ Download artifacts or reports for a completed test run by upload ID. Use this co dcd artifacts --upload-id [flags] ``` +Pass exactly one of `--download-artifacts` or `--report`. + ## Flags ### Authentication | Flag | Description | |------|-------------| -| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var | +| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var. Optional if you've run [`dcd login`](dcd-login.md) | +| `--api-url ` | API base URL. Defaults to the environment you logged in to with `dcd login`, otherwise `https://api.devicecloud.dev` | ### Required @@ -31,8 +34,8 @@ dcd artifacts --upload-id [flags] | Flag | Description | |------|-------------| -| `--report ` | Download a test report. Options: `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated and will be removed on 7 December 2026. Mutually exclusive with `--download-artifacts` | -| `--allure-path ` | Output path for the Allure report (default: `./report.html`). Requires `--report allure`. Deprecated, removed on 7 December 2026 | +| `--report ` | Download a test report. Options: `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated, and we're targeting their removal on 7 December 2026 (see [Report Formats](../artifacts/report-formats.md)). Mutually exclusive with `--download-artifacts` | +| `--allure-path ` | Output path for the Allure report (default: `./report.html`). Requires `--report allure`. Deprecated, with removal targeted for 7 December 2026 | | `--html-path ` | Output path for the HTML report (default: `./report.zip`). Requires `--report html` or `html-detailed`. The HTML report downloads as a ZIP, so use a `.zip` path | | `--junit-path ` | Output path for the JUnit report (default: `./report.xml`). Requires `--report junit` | @@ -40,8 +43,11 @@ dcd artifacts --upload-id [flags] | Flag | Description | |------|-------------| +| `--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. + ## Examples **Download artifacts for all tests:** @@ -66,7 +72,7 @@ dcd artifacts --upload-id 123e4567-e89b-12d3-a456-426614174000 --report html --h ## Using with Async Runs -`dcd artifacts` is especially useful alongside `--async`. Submit the run without blocking, then retrieve artifacts later: +`dcd artifacts` is especially useful alongside `--async`, which skips `--download-artifacts` and `--report`. Submit the run without blocking, wait for it to finish ([`dcd status`](dcd-status.md#polling-an-async-run) shows how), then retrieve artifacts: ```bash # Submit tests and capture the upload ID diff --git a/cli/dcd-cloud.md b/cli/dcd-cloud.md index bdc014f..3ef179b 100644 --- a/cli/dcd-cloud.md +++ b/cli/dcd-cloud.md @@ -47,10 +47,10 @@ See [Authentication](../getting-started/api-keys.md) for the full picture. | `--device-locale ` | Device locale (see [Device Locale](../configuration/device-locale.md)) | | `--orientation ` | Device orientation, `0` (portrait) or `90` (landscape). Android only (see [Orientation](../configuration/orientation.md)) | | `--google-play` | Use a Google Play-enabled device. Android only (see [Google Play APIs](../configuration/google-play-apis.md)) | -| `--runner-type ` | Runner type to use (see [Runner Types](../configuration/runner-type.md)) | +| `--runner-type ` | Runner type to use: `default` (the default), `cpu1`, `m1` or `m4` (see [Runner Types](../configuration/runner-type.md)) | | `--render-engine ` | Android only. Software renderer the emulator boots with: `lavapipe` (default) or `swiftshader`. Try `swiftshader` if your app fails to render or the device drops out mid-run. Apps built with Flutter are detected and switched automatically | -| `--ios-device-matrix :` | Run every flow once on each listed iOS device, e.g. `iphone-16:18`. Repeat the flag for each device (see [Device Matrix](../configuration/device-matrix.md)) | -| `--android-device-matrix :` | Run every flow once on each listed Android device, e.g. `pixel-8:34`. Append `:play` for Google Play. Repeat the flag for each device (see [Device Matrix](../configuration/device-matrix.md)) | +| `--ios-device-matrix :` | Run every flow once on each listed iOS device, e.g. `iphone-16:18`. Repeat the flag for each device. Can't be combined with `--android-device-matrix` (see [Device Matrix](../configuration/device-matrix.md)) | +| `--android-device-matrix :` | Run every flow once on each listed Android device, e.g. `pixel-8:34`. Append `:play` for Google Play. Repeat the flag for each device. Can't be combined with `--ios-device-matrix` (see [Device Matrix](../configuration/device-matrix.md)) | ### Flows @@ -58,9 +58,9 @@ See [Authentication](../getting-started/api-keys.md) for the full picture. |------|-------------| | `--flows ` | Path to a flow file or a directory of flows (alternative to the positional `` argument) | | `--config ` | Path to a `config.yaml` workspace config file (see [Workspace Configuration](../configuration/workspace-config.md)) | -| `--exclude-flows ` | Comma-separated list of flow files or sub-directories to exclude | -| `--include-tags ` | Only run flows with these tags (comma-separated) | -| `--exclude-tags ` | Skip flows with these tags (comma-separated) | +| `--exclude-flows ` | Flow files or sub-directories to exclude. Comma-separated, or repeat the flag | +| `--include-tags ` | Only run flows with these tags. Comma-separated, or repeat the flag | +| `--exclude-tags ` | Skip flows with these tags. Comma-separated, or repeat the flag | ### Test Configuration @@ -70,7 +70,7 @@ See [Authentication](../getting-started/api-keys.md) for the full picture. | `--env `, `-e` | Environment variables to pass to the test. Repeat for multiple values (see [Environment Variables](../configuration/environment-variables.md)) | | `--metadata `, `-m` | Arbitrary metadata to attach to the run (shown in the console). Repeat for multiple values | | `--name ` | Name for this upload (shown in the console) | -| `--retry ` | Retry failed tests up to `n` times (free of charge). Max `2` (see [Retry Strategies](../advanced/retry-strategies.md)) | +| `--retry ` | Retry failed tests up to `n` times (free of charge). Max `2`: a higher value is reduced to `2` (see [Retry Strategies](../advanced/retry-strategies.md)) | ### GitHub / PR Context @@ -96,28 +96,79 @@ Attach Git and pull request metadata to a run. These values are displayed in the | Flag | Description | |------|-------------| -| `--disable-animations` | Disable device animations during test execution. On Android, disables system animation scales. On iOS, enables Reduce Motion | +| `--disable-animations` | Disable device animations during test execution. On Android, disables system animation scales. On iOS, enables Reduce Motion. Overrides `disableAnimations` in `config.yaml`, and `--no-disable-animations` keeps animations on even when `config.yaml` turns them off (see [Animations](../configuration/disable-animations.md)) | ### Output & Execution | Flag | Description | |------|-------------| -| `--async` | Submit tests and return immediately (exit `0`) without waiting for results (see [Async Execution](../advanced/async-execution.md)) | -| `--cancel-previous` | Cancel the still-queued tests of the previous run from the same CI context. Needs `--repo-name` plus `--branch` or `--pr-number` (see [Cancelling superseded runs](../advanced/cancel-previous.md)) | +| `--async` | Submit tests and return immediately (exit `0`) without waiting for results. `--download-artifacts` and `--report` do nothing with `--async`: download them later with [`dcd artifacts`](dcd-artifacts.md) (see [Async Execution](../advanced/async-execution.md)) | +| `--cancel-previous` | Cancel the still-queued tests of the previous run from the same CI context. Needs a repository plus a branch or PR: `--repo-name` with `--branch` or `--pr-number`, or the same values as `--metadata gh_repo=…` with `gh_branch=…` or `gh_pr_number=…` (see [Cancelling superseded runs](../advanced/cancel-previous.md)) | | `--priority ` | `low`, `normal` (default) or `high`. Reorders only your organisation's own queued runs (see [Run Priority](../configuration/run-priority.md)) | | `--quiet`, `-q` | Suppress per-test progress; print only the final summary | -| `--json` | Output results as JSON. Exits `0` on success, `2` on test failure, `1` on CLI/infrastructure errors. The output includes a `notices` array with any deprecation or other notices for the run. A run superseded through `--cancel-previous` has `status` `SUPERSEDED` and exits `0` | -| `--json-file` | Write JSON results to a file (`_dcd.json` by default). Exits `0` even if the test run fails; infrastructure errors still exit `1` | +| `--json` | Output results as JSON (see [JSON output](#json-output)). Exits `0` on success, `2` on test failure, `1` on CLI/infrastructure errors. The output includes a `notices` array with any deprecation or other notices for the run. A run superseded through `--cancel-previous` has `status` `SUPERSEDED` and exits `0` | +| `--json-file` | Write JSON results to a file (`_dcd.json` by default). Exits `0` even if the test run fails; infrastructure errors still exit `1`. Also turns on `--quiet` | | `--json-file-name ` | Custom name (or relative path) for the JSON file. Requires `--json-file` | | `--dry-run` | Simulate the run without uploading or triggering a test — useful for debugging workflow issues | -| `--report `, `--format` | Generate and download a report. Options: `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated and will be removed on 7 December 2026 (see [Report Formats](../artifacts/report-formats.md)) | +| `--report `, `--format` | Generate and download a report. Options: `junit`, `html`, `html-detailed`, `allure`. `html-detailed` and `allure` are deprecated, and we're targeting their removal on 7 December 2026. After that, runs that pass them still run (see [Report Formats](../artifacts/report-formats.md)) | | `--junit-path ` | Output path for the JUnit report (requires `--report junit`) | | `--html-path ` | Output path for the HTML report (requires `--report html` or `html-detailed`). The HTML report downloads as a ZIP, so use a `.zip` path such as `./report.zip` | -| `--allure-path ` | Output path for the Allure report (requires `--report allure`). Deprecated, removed on 7 December 2026 | +| `--allure-path ` | Output path for the Allure report (requires `--report allure`). Deprecated, with removal targeted for 7 December 2026 | | `--download-artifacts ` | Download test artifacts after completion (see [Artifacts](../artifacts/artifacts.md)) | | `--artifacts-path ` | Output path for the artifacts zip (default `./artifacts.zip`). Requires `--download-artifacts` | | `--debug` | Enable verbose debug logging | +## JSON output + +`--json` prints one JSON object on stdout when the run has finished. `--json-file` writes the same object to `_dcd.json`, or to the path you give with `--json-file-name`. + +```json +{ + "consoleUrl": "https://console.devicecloud.dev/results?upload=3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b8c9a01&result=4500", + "status": "FAILED", + "tests": [ + { + "device": { "name": "Pixel 8", "osVersion": "34", "googlePlay": false }, + "durationSeconds": 48, + "fileName": "./login.yaml", + "flowName": "Login", + "name": "./login.yaml", + "status": "PASSED", + "tags": ["smoke"] + }, + { + "device": { "name": "Pixel 8", "osVersion": "34", "googlePlay": false }, + "durationSeconds": 95, + "failReason": "Element not found: Text matching regex: Pay now", + "fileName": "./checkout.yaml", + "flowName": "Checkout", + "name": "./checkout.yaml", + "status": "FAILED", + "tags": [] + } + ], + "uploadId": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b8c9a01", + "notices": [] +} +``` + +| Field | Description | +|---|---| +| `status` | `PASSED` when every test passed, `SUPERSEDED` when a newer run replaced this one through `--cancel-previous`, otherwise `FAILED`. With `--async` it's `PENDING`, because the CLI doesn't wait for the run | +| `uploadId` | The run's upload ID, for [`dcd status`](dcd-status.md) and [`dcd artifacts`](dcd-artifacts.md) | +| `consoleUrl` | The run in the console | +| `tests[]` | One entry per flow and device. When a test was [retried](../advanced/retry-strategies.md), the entry is its last attempt | +| `tests[].name`, `tests[].fileName` | The flow's path within the upload, such as `./login.yaml` | +| `tests[].flowName` | The flow's `name:`, or its file name without the extension | +| `tests[].status` | The test's own status, such as `PASSED`, `FAILED` or `CANCELLED`. With `--async`, its status when it was submitted | +| `tests[].durationSeconds` | How long the test ran, in seconds, or `null` if that isn't known. Not included with `--async` | +| `tests[].failReason` | Why the test failed. Only on failed tests | +| `tests[].tags` | The flow's tags | +| `tests[].device` | The device the test ran on: `name`, `osVersion` and `googlePlay`. Left out when the API doesn't report it | +| `notices[]` | Deprecation and other notices for the run, each with `slug`, `level`, `title`, `body` and `learnMoreUrl` | + +If the CLI itself fails, for example on a bad flag, a network error or a run the API refuses to start, `--json` prints `{"status": "FAILED", "error": "…"}` and exits `1`. That's the same `status` as a failed run, so check the exit code, or look for an `error` field, before you treat `FAILED` as a test failure. `--json-file` writes no file in that case. + ## Examples **Android:** diff --git a/cli/dcd-device.md b/cli/dcd-device.md index 9ed1f95..0372e2a 100644 --- a/cli/dcd-device.md +++ b/cli/dcd-device.md @@ -38,7 +38,7 @@ dcd device stop | Code | Meaning | |---|---| | `0` | Done | - | `1` | Called wrongly: a bad flag or value, or no session to pick | + | `1` | Called wrongly: a bad flag or value, no session to pick, or credentials the API rejected | | `2` | It ran and failed: a flow or launch failed, or the API couldn't do it | | `3` | A limit was hit: concurrent sessions, spend cap, or rate limit | | `4` | The session has ended, or there is no such session | @@ -111,7 +111,11 @@ Tap one thing on the screen, by exactly one target. Answers once the screen has ## `dcd device type [id] --text ` -Type into the focused field (tap it first). `--sensitive` keeps the text secret: it is stored encrypted, never shown, and masked in the output. +Type into the focused field (tap it first). `--sensitive` treats the text as a secret: DeviceCloud stores it encrypted and masks it in the output. + +::: warning +CLI 5.13.0 also sends the text you type with `dcd device type` in its usage [telemetry](overview.md#telemetry), with or without `--sensitive`. Until the next CLI release, which leaves it out, don't type real passwords or codes this way, or set `DCD_TELEMETRY_DISABLED=1` first. +::: ## `dcd device swipe [id] ` @@ -127,6 +131,8 @@ Each of these sends one [typed action](../api/device-sessions.md). For several s Run Maestro on the device and wait for the result. A failed flow exits `2`. Maestro's output is printed either way, and after a failure, so is the app's visible text. +A device session runs the common Maestro commands, not all of them. It refuses flow scripts (`runScript`, `evalScript`, and JavaScript conditions or expressions), and doesn't run `addMedia`, `copyTextFrom`, `pasteText`, `inputRandom*`, `setLocation` or `travel`. A flow that uses one fails before its first step, and the error names the line. See [What a session runs](../mcp/agent-devices.md#what-a-session-runs) for the full list. + | Flag | Description | |------|-------------| | `` | One flow file, run whole | @@ -135,7 +141,7 @@ Run Maestro on the device and wait for the result. A failed flow exits `2`. Maes | `--yaml ` | The flow inline, instead of a file | | `--env KEY=VALUE` | A variable for the flow, used as `${KEY}`. Repeat it for more. Values are encrypted before they're stored, and masked in the output | -For a directory, only the YAML files and the files the flows use, such as scripts and media, are uploaded, up to 50 MB. +For a directory, only the YAML files, the files the flows refer to and the `includedPaths` in its `config.yaml` are uploaded, up to 50 MB. ## `dcd device logs [id]` diff --git a/cli/dcd-list.md b/cli/dcd-list.md index f7d84d2..c923b52 100644 --- a/cli/dcd-list.md +++ b/cli/dcd-list.md @@ -13,9 +13,10 @@ dcd list [flags] | `--limit ` | `20` | Maximum number of uploads to return | | `--offset ` | `0` | Number of uploads to skip (for pagination) | | `--name ` | | Filter by upload name. Supports `*` as a wildcard — always quote wildcards to prevent shell expansion | -| `--from ` | | Return uploads created on or after this date (ISO 8601, e.g. `2024-01-01`) | +| `--from ` | | Return uploads created on or after this date (ISO 8601, e.g. `2026-11-01`) | | `--to ` | | Return uploads created on or before this date (ISO 8601) | -| `--api-key ` | | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var | +| `--api-key ` | | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var. Optional if you've run [`dcd login`](dcd-login.md) | +| `--api-url ` | | API base URL. Defaults to the environment you logged in to with `dcd login`, otherwise `https://api.devicecloud.dev` | | `--json` | | Output results as JSON | ## Examples @@ -28,7 +29,7 @@ dcd list dcd list --name "nightly-*" # Filter by date range -dcd list --from 2024-01-01 --to 2024-01-31 +dcd list --from 2026-11-01 --to 2026-11-30 # Paginate dcd list --limit 10 --offset 20 diff --git a/cli/dcd-live.md b/cli/dcd-live.md index bf1da07..20fb4ab 100644 --- a/cli/dcd-live.md +++ b/cli/dcd-live.md @@ -23,7 +23,7 @@ dcd live run --session path/to/flow.yaml dcd live stop --session ``` -Every subcommand (except `start`) takes a `--session ` flag identifying the session, and accepts `--api-key` / `--api-url`. +Every subcommand (except `start`) takes a `--session ` flag identifying the session. Every subcommand accepts `--api-key` / `--api-url`, and `--json` to print its result as one JSON object. ## `dcd live start` diff --git a/cli/dcd-login.md b/cli/dcd-login.md index 6e142c2..267e7e8 100644 --- a/cli/dcd-login.md +++ b/cli/dcd-login.md @@ -2,6 +2,8 @@ These commands manage browser-based authentication and the team your runs are billed to. They're the recommended way to authenticate for local or interactive use. For CI and headless environments, you should use an [API key](../getting-started/api-keys.md) instead. +Each of these commands takes `--json`, which prints its result as one JSON object on stdout. + ## `dcd login` Authenticate with DeviceCloud via your browser. Run it once and the CLI stores your session, so subsequent commands don't need an API key. @@ -10,7 +12,9 @@ Authenticate with DeviceCloud via your browser. Run it once and the CLI stores y dcd login ``` -This opens your browser to complete sign-in (email OTP or Enterprise SSO). After you authorise the CLI, if you belong to more than one team you'll be prompted to pick the one to use. The picker starts on the team from your last login, so pressing Enter keeps it. Your session is then saved locally (see [Where credentials are stored](#where-credentials-are-stored)). +This opens your browser. Sign in with an email code, GitHub, Google, a passkey or your company's SSO, then choose **Authorize and finish login**. If you use two-factor authentication, or your team requires it, you'll also confirm with your authenticator app or a passkey. A session that doesn't meet a team's sign-in requirement can't reach that team's results (see [Sign-in and two-factor authentication](../security/security-overview.md#sign-in-and-two-factor-authentication)). If you belong to more than one team, the CLI then asks you to pick the one to use. The picker starts on the team from your last login, so pressing Enter keeps it. Your session is then saved locally (see [Where credentials are stored](#where-credentials-are-stored)). + +The CLI waits up to 10 minutes for you to finish in the browser. After that, it stops with "Login timed out", and you run `dcd login` again. ### Flags @@ -18,7 +22,9 @@ This opens your browser to complete sign-in (email OTP or Enterprise SSO). After |------|-------------| | `--no-browser` | Print the login URL instead of opening a browser. Useful over SSH or on machines without a browser. | | `--frontend-url ` | Override the frontend URL used to complete login | -| `--org ` | Use this team instead of picking one. Teams are matched by name (case-insensitive) or ID, and login fails if you're not a member. | +| `--org ` | Use this team instead of picking one. Teams are matched by name (case-insensitive), slug or ID, and login fails if you're not a member. | +| `--api-url ` | The API to log in to (default `https://api.devicecloud.dev`). Later commands use the same API until you log in to another one | +| `--json` | Print the result as one JSON object on stdout. The login URL and any prompts go to stderr | ::: info `dcd login` uses a PKCE browser flow with no local server, so it works over SSH and when you open the URL on a different device. A leaked login URL is inert and can't be used to claim your session. @@ -38,7 +44,7 @@ You still complete sign-in in a browser. Pass `--no-browser` to print the URL in ## `dcd logout` -Clear the stored session and revoke it server-side (best effort). +Delete the session stored on this machine. ```bash dcd logout @@ -46,6 +52,8 @@ dcd logout This only affects the `dcd login` session and it does not touch the environment variables or the `--api-key` flag. +`dcd logout` doesn't end the session on DeviceCloud's side: until it expires, anyone with a copy of the session file can still use it. To end a session for good, open **Settings → Account** in the console. Under **Active sessions**, sign out that device, or choose **Sign out of all devices** to end every session, including the console one you're using. + ## `dcd whoami` Show the user and team of your stored `dcd login` session. @@ -72,7 +80,7 @@ dcd switch-org dcd switch-org "example@example.com's Team" ``` -Teams are matched by name (case-insensitive). Without a terminal, such as in a script, pass the team name, because the picker needs a keypress. Requires an active `dcd login` session. It only changes the session's team: an exported `DEVICE_CLOUD_API_KEY` doesn't affect `switch-org`, but still takes precedence for every other command. +Teams are matched by name (case-insensitive), slug or ID. Without a terminal, such as in a script, pass the team name, because the picker needs a keypress. Requires an active `dcd login` session. It only changes the session's team: an exported `DEVICE_CLOUD_API_KEY` doesn't affect `switch-org`, but still takes precedence for every other command. ## Where credentials are stored diff --git a/cli/dcd-status.md b/cli/dcd-status.md index 6d94713..77c6d0e 100644 --- a/cli/dcd-status.md +++ b/cli/dcd-status.md @@ -7,7 +7,7 @@ dcd status --upload-id [flags] dcd status --name [flags] ``` -One of `--upload-id` or `--name` is required. If multiple uploads share the same name, the most recent is returned. +Pass either `--upload-id` or `--name`, not both. If multiple uploads share the same name, the most recent is returned. ## Flags @@ -15,11 +15,14 @@ One of `--upload-id` or `--name` is required. If multiple uploads share the same |------|-------------| | `--upload-id ` | UUID of the upload to check | | `--name ` | Name of the upload to check | -| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var | -| `--json` | Output results as JSON. Exits `0` once a result is retrieved (including a `FAILED` run); usage errors, such as omitting both `--upload-id` and `--name`, exit `1` | +| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var. Optional if you've run [`dcd login`](dcd-login.md) | +| `--api-url ` | API base URL. Defaults to the environment you logged in to with `dcd login`, otherwise `https://api.devicecloud.dev` | +| `--json` | Output results as JSON (see [JSON Output](#json-output) for its fields and exit codes) | The upload status is one of `PASSED`, `FAILED`, `RUNNING`, `PENDING` or `QUEUED`. It's never `CANCELLED`: a run with a cancelled test is reported as `FAILED`, while the test itself keeps its `CANCELLED` status. +`FAILED` doesn't mean the run has finished. The status turns `FAILED` as soon as any test has failed with no retries left, or has been cancelled, even while other tests are still queued or running. The run has finished when none of its tests is `QUEUED`, `PENDING` or `RUNNING`. + ## Examples ```bash @@ -83,6 +86,10 @@ dcd status --name "Nightly regression" --json } ``` +Each test's `device` is the device and OS version it ran on, as one string, such as `iPhone 16 - 18` or `pixel-8-api-34`. + +A run that a newer run superseded through [`--cancel-previous`](../advanced/cancel-previous.md) also has a `supersededBy` field: the newer run's upload ID. Its `status` is still `FAILED`, because its cancelled tests count against it, so check for `supersededBy` before you fail a CI job on `status`. + If the lookup itself fails — for example the upload ID doesn't exist, or the API can't be reached — `--json` prints a `FAILED` status with an `error` message instead, and still exits `0`: ```json @@ -94,7 +101,7 @@ If the lookup itself fails — for example the upload ID doesn't exist, or the A } ``` -Check for an `error` field before treating `FAILED` as a failed test run. +Other errors print the same `status` and `error` but exit `1`. These include passing neither `--upload-id` nor `--name`, or having no API key and no `dcd login` session. Either way, check for an `error` field before treating `FAILED` as a failed test run. Use with [jq](https://jqlang.github.io/jq/) to extract specific values: @@ -104,24 +111,43 @@ export BINARY_ID=$(dcd status --name "Nightly regression" --json | jq -r '.appBi ## Polling an Async Run -When using `dcd cloud --async`, use `dcd status` to poll for completion: +When using `dcd cloud --async`, use `dcd status` to poll for completion. Wait until no test is still queued, pending or running, rather than stopping at the first `FAILED`: -```bash +```yaml # GitHub Actions example -- name: Run tests - run: dcd cloud app.apk flows/ --async --name "CI-${{ github.run_id }}" - -- name: Wait for results - run: | - while true; do - STATUS=$(dcd status --name "CI-${{ github.run_id }}" --json | jq -r '.status') - echo "Status: $STATUS" - if [[ "$STATUS" == "PASSED" || "$STATUS" == "FAILED" ]]; then - break - fi - sleep 30 - done - [ "$STATUS" == "PASSED" ] +jobs: + test: + runs-on: ubuntu-latest + env: + DEVICE_CLOUD_API_KEY: ${{ secrets.DCD_API_KEY }} + steps: + # ... build app.apk ... + + - name: Install the DeviceCloud CLI + run: | + curl -fsSL https://get.devicecloud.dev/install.sh | sh + echo "$HOME/.dcd/bin" >> "$GITHUB_PATH" + + - name: Run tests + run: dcd cloud app.apk flows/ --async --name "CI-${{ github.run_id }}" + + - name: Wait for results + run: | + while true; do + RESULT=$(dcd status --name "CI-${{ github.run_id }}" --json) + if echo "$RESULT" | jq -e '.error' > /dev/null; then + echo "$RESULT" + exit 1 + fi + # Finished once no test is still queued, pending or running + if echo "$RESULT" | jq -e '[.tests[].status] | all(. == "PASSED" or . == "FAILED" or . == "CANCELLED")' > /dev/null; then + break + fi + sleep 30 + done + echo "Status: $(echo "$RESULT" | jq -r '.status')" + # Pass when every test passed, or when a newer run superseded this one + echo "$RESULT" | jq -e '.status == "PASSED" or .supersededBy != null' > /dev/null ``` See [Async Execution](../advanced/async-execution.md) for more patterns. diff --git a/cli/dcd-upload.md b/cli/dcd-upload.md index 3a9c3bb..4d685bc 100644 --- a/cli/dcd-upload.md +++ b/cli/dcd-upload.md @@ -12,13 +12,14 @@ dcd upload [flags] | Argument | Description | |----------|-------------| -| `` | Path to your app binary: `.apk` for Android, `.app` or `.zip` for iOS, or an Expo iOS build archive (`.tar.gz`), which is extracted automatically | +| `` | Path to your app binary: `.apk` for Android, `.app` or `.zip` for iOS, or an Expo iOS build archive (`.tar.gz`), which is extracted automatically. A signed URL to an Expo iOS build works here too, the same as `--app-url` | ## Flags | Flag | Description | |------|-------------| -| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var | +| `--api-key ` | Your DeviceCloud API key. Defaults to `DEVICE_CLOUD_API_KEY` env var. Optional if you've run [`dcd login`](dcd-login.md) | +| `--api-url ` | API base URL. Defaults to the environment you logged in to with `dcd login`, otherwise `https://api.devicecloud.dev` | | `--app-url ` | Signed URL to an Expo iOS build (`.tar.gz`), used instead of ``. The archive is downloaded and extracted automatically | | `--ignore-sha-check` | Force re-upload even if a binary with the same SHA already exists | | `--encrypt` / `--no-encrypt` | Envelope encryption is on by default: the binary is encrypted on your machine before upload, with its own key. Pass `--no-encrypt` (or set `DCD_ENCRYPT=0`) to turn it off; the upload is still encrypted in transit. See [Data Encryption](../security/security-overview.md#data-encryption) | diff --git a/cli/overview.md b/cli/overview.md index db31c56..992617d 100644 --- a/cli/overview.md +++ b/cli/overview.md @@ -4,10 +4,6 @@ The DCD CLI is the primary way to interact with DeviceCloud from your terminal o The CLI is published as `@devicecloud.dev/dcd` on npm and as a standalone binary. Both include `dcd mcp`, an [MCP server](../mcp/connect.md) that lets AI agents run cloud tests and read their results. The npm package also ships `dcd-mcp`, the [older MCP server](../mcp/overview.md). -::: info -**New in v5:** browser-based [`dcd login`](dcd-login.md) (no more passing a key on every command), a standalone binary installer with `dcd upgrade`, interactive [`dcd live`](dcd-live.md) device sessions, and an [MCP server](../mcp/overview.md). Existing API keys and `dcd cloud` usage continue to work unchanged. -::: - ## Installation The recommended install is the standalone binary — it has no dependencies and doesn't require Node. @@ -53,13 +49,15 @@ npm install -g @devicecloud.dev/dcd@latest ::: info `dcd upgrade` is only for binary installs. Automatic upgrade is not yet supported on Windows — re-run the PowerShell installer to update. + +`dcd upgrade` stays on the release channel you installed from: a beta upgrades to the latest beta. To go back to the stable release, run the installer again without `DCD_BETA`. ::: ## Authentication There are two ways to authenticate. See [Authentication](../getting-started/api-keys.md) for full detail. -- **`dcd login`** (recommended for local use) — authenticate once in your browser. The CLI stores a session, so you don't have to pass a key on every command, and it unlocks live test updates. +- **`dcd login`** (recommended for local use) — authenticate once in your browser. The CLI stores a session, so you don't have to pass a key on every command. - **API key** (recommended for CI/headless) — set the `DEVICE_CLOUD_API_KEY` environment variable, or pass `--api-key ` on any command. ```bash @@ -86,41 +84,44 @@ When both are present, precedence is: `--api-key` flag → `DEVICE_CLOUD_API_KEY | [`dcd whoami`](dcd-login.md#dcd-whoami) | Show the logged-in user and active organisation | | [`dcd switch-org`](dcd-login.md#dcd-switch-org) | Switch the active organisation | | [`dcd device`](dcd-device.md) | Lease a cloud device, drive it and release it (beta) | -| [`dcd mcp`](../mcp/agent-devices.md#headless-through-the-cli) | Run the DeviceCloud MCP server on stdio | +| [`dcd mcp`](../mcp/connect.md) | Run the DeviceCloud MCP server on stdio | +| [`dcd mcp install`](../mcp/connect.md#set-it-up) | Add the MCP server to Claude Code, Claude Desktop, Codex, Cursor or VS Code | | [`dcd live`](dcd-live.md) | Deprecated: use `dcd device` | | `dcd upgrade` | Upgrade the standalone binary in place | +Every command except the `dcd mcp` server takes `--json`, which prints one JSON object on stdout for scripts to read. Commands that call the API also take `--api-url`, which you only need for an environment other than production. See [Exit Codes](../advanced/exit-codes.md) for what each command's exit code means. + ## Environment Variables | Variable | Description | |----------|-------------| | `DEVICE_CLOUD_API_KEY` | API key to use when `--api-key` isn't passed. Takes precedence over a `dcd login` session | | `DCD_CONFIG_DIR` | Directory for the `dcd login` session file (default `$XDG_CONFIG_HOME/dcd`, or `~/.dcd`) | -| `DCD_ENCRYPT` | `dcd cloud`, `dcd upload` and the MCP server apply envelope encryption to the app binary, flows and `--env` values on your machine before upload by default. Set to `0` to turn it off, the same as passing `--no-encrypt`; uploads are still encrypted in transit. A flag on the command line takes precedence | +| `DCD_ENCRYPT` | `dcd cloud`, `dcd upload`, `dcd device` (when it uploads a local build) and the MCP server apply envelope encryption to the app binary, flows and `--env` values on your machine before upload by default. Set to `0` to turn it off, the same as passing `--no-encrypt`; uploads are still encrypted in transit. A flag on the command line takes precedence | | `DCD_TELEMETRY_DISABLED` | Set to `1` to turn off [telemetry](#telemetry) | | `DCD_API_URL` | MCP server only. The API base URL to use (CLI commands take `--api-url` instead) | -| `DCD_MCP_READONLY` | MCP server only. Set to `1` for [read-only mode](../mcp/overview.md#read-only-mode) | +| `DCD_MCP_READONLY` | MCP server only. Set to `1` to offer only the tools that change nothing, the same as `dcd mcp --read-only` (see [Read-only mode](../mcp/connect.md#read-only-mode)) | The standalone binary installers also read these: | Variable | Description | |----------|-------------| -| `DCD_VERSION` | Install a specific version instead of the latest stable release, e.g. `5.11.1` | +| `DCD_VERSION` | Install a specific version instead of the latest stable release, e.g. `5.13.0` | | `DCD_BETA` | Set to `1` to install the latest beta | | `DCD_INSTALL_DIR` | Where to install the binary (default `~/.dcd/bin`, or `$env:USERPROFILE\.dcd\bin` on Windows) | ```bash -curl -fsSL https://get.devicecloud.dev/install.sh | DCD_VERSION=5.11.1 sh +curl -fsSL https://get.devicecloud.dev/install.sh | DCD_VERSION=5.13.0 sh ``` ## Telemetry The CLI sends usage and error events to DeviceCloud to help us find and fix problems. Only commands that authenticate send anything — `--help`, `--version` and `dcd whoami`, for example, don't. Events include: -- the command and its arguments, with the values of `--api-key`, `--app-url` and `--env` / `-e` redacted +- the command and its arguments, with the values of `--api-key`, `--app-url` and `--env` / `-e` redacted. Other values are sent as you typed them, including the text you pass to `dcd device type`. The next CLI release redacts that text too. - how long the command took and its exit code - the error message and stack trace when a command fails -- the names, durations and errors of [MCP server](../mcp/overview.md) tool calls +- the names, durations and errors of [MCP server](../mcp/connect.md) tool calls - the CLI version, install method (binary or npm), Node version, operating system and architecture, a random ID for the invocation and, with `dcd login`, your email address and team ID To opt out, set `DCD_TELEMETRY_DISABLED=1`. diff --git a/configuration/app-management.md b/configuration/app-management.md index 3db0b9d..e6dedca 100644 --- a/configuration/app-management.md +++ b/configuration/app-management.md @@ -1,6 +1,6 @@ # App Management -Device Cloud provides several ways to manage your application binaries during test execution. +DeviceCloud provides several ways to manage your application binaries during test execution. ## App Binary Options @@ -24,7 +24,7 @@ dcd cloud --app-file ./path/to/your/app.apk flows/ dcd cloud --app-binary-id 67894274-b789-4c1e-80d4-da8998998999 flows/ ``` -Get a binary ID from an earlier run, or upload the binary on its own with [`dcd upload`](../cli/dcd-upload.md): +`dcd cloud` prints the binary ID when it uploads your app, or when it finds the same build already uploaded. You can also upload the binary on its own with [`dcd upload`](../cli/dcd-upload.md), which prints the ID: ```bash dcd upload ./path/to/your/app.apk @@ -44,14 +44,16 @@ The URL must point to an Expo iOS simulator build (`.tar.gz`). The CLI downloads |------|----------| | `.apk` | Android | | `.app` | iOS simulator build | -| `.zip` | iOS: a zip containing exactly one `.app` | +| `.zip` | iOS: a zip whose only top-level item is the `.app` (`__MACOSX` and `.DS_Store` entries are ignored) | | `.tar.gz` | iOS: an Expo simulator build archive, extracted automatically | +iOS runs need a simulator build. Device builds (`.ipa`) and Android App Bundles (`.aab`) aren't accepted, so build an `.apk` for Android. + ## Binary Management ### SHA Hash Checking -By default, Device Cloud checks the SHA hash of your binary to avoid redundant uploads (it will automatically work out the app-binary-id for you). Envelope-encrypted uploads (the default) are only matched against your earlier envelope-encrypted uploads, so a binary you previously uploaded with `--no-encrypt` is uploaded once more the first time it's envelope-encrypted. To override: +By default, DeviceCloud checks the SHA hash of your binary to avoid redundant uploads (it will automatically work out the app-binary-id for you). Envelope-encrypted uploads (the default) are only matched against your earlier envelope-encrypted uploads, so a binary you previously uploaded with `--no-encrypt` is uploaded once more the first time it's envelope-encrypted. To override: ```bash dcd cloud --app-file ./app.apk flows/ --ignore-sha-check diff --git a/configuration/device-datetime.md b/configuration/device-datetime.md index d62e788..f5256d8 100644 --- a/configuration/device-datetime.md +++ b/configuration/device-datetime.md @@ -1,12 +1,12 @@ # Device Date & Time -Run a flow with the device clock set to a chosen date and time, useful for testing expiry logic, subscription renewals, time‑gated features, free‑trial countdowns, or other date‑specific UI (birthdays, holidays, "new this week" etc). +Run a flow with the device clock set to a chosen date and time, useful for testing expiry logic, subscription renewals, time-gated features, free-trial countdowns, or other date-specific UI (birthdays, holidays, "new this week" etc). -By default our runners take the current time when booting. Our Android runners run UTC and our iOS runners match GMT/BST in accordance with Daylight Savings Time. +By default, a run uses the real current time. Our Android runners use UTC, and our iOS runners use UK time (GMT, or BST in summer). ## Usage -To set the time for a flow, set a DeviceCloud env variable in the flow's YAML. The value is an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date‑time string. +To set the time for a flow, set a DeviceCloud env variable in the flow's YAML. The value is an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time string. There's no `dcd cloud` flag for this, so it's set per flow. ```yaml # in your test.yaml @@ -18,7 +18,7 @@ env: # test steps ``` -* `DEVICECLOUD_OVERRIDE_DEVICE_DATETIME` — target date/time, ISO 8601 (e.g. `2030-01-01T09:00:00Z`). +* `DEVICECLOUD_OVERRIDE_DEVICE_DATETIME` — target date/time, ISO 8601 (e.g. `2030-01-01T09:00:00Z`). * `DEVICECLOUD_OVERRIDE_DEVICE_TIMEZONE` — optional [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g. `Europe/London`). Android only, and only applied together with `DEVICECLOUD_OVERRIDE_DEVICE_DATETIME`. Setting it needs a rootable image, so it isn't available on [Google Play](google-play-apis.md) images. If the value can't be parsed, it is ignored and the flow runs with the default @@ -26,15 +26,13 @@ If the value can't be parsed, it is ignored and the flow runs with the default Please note that due to platform limitations, this behaves very differently on Android and iOS. On Android it sets the real device clock, so the app sees the new time. -On iOS it only changes the cosmetic status‑bar clock — the app's own `Date()` is unaffected as iOS simulators share their host kernel. Read the platform notes below before relying on it. - -## Semantics - -On Android, the override sets the device's starting clock. The clock then ticks forward normally from there for the rest of the run as it is not a frozen clock. If you need time to stand still, you'll need to drive it from within your app/test instead. +On iOS it only changes the cosmetic status-bar clock — the app's own `Date()` is unaffected as iOS simulators share their host kernel. Read the platform notes below before relying on it. ## Android -Sets the real emulator clock, so `Date.now()`, `System.currentTimeMillis()`, date pickers, and anything else the app reads all see the new time. Auto‑time sync is disabled for the run so the value sticks. +Sets the real emulator clock, so `Date.now()`, `System.currentTimeMillis()`, date pickers, and anything else the app reads all see the new time. Auto-time sync is disabled for the run so the value sticks. + +The override sets the clock the run starts with. The clock then ticks forward normally for the rest of the run; it isn't frozen. If you need time to stand still, drive it from within your app or test instead. ::: info Please note that this is not available on Google Play images. [Google Play](google-play-apis.md) emulators are not rootable, so the clock cannot be set. Google Play flows will log a warning and continue on real time. Use the standard image if you need the date/time override. @@ -42,16 +40,11 @@ Please note that this is not available on Google Play images. [Google Play](goog ## iOS -iOS simulators read the host machine's clock and there is no per‑simulator API to change it, so: +iOS simulators read the host machine's clock and there is no per-simulator API to change it, so: -* The app's `Date()` / `NSDate` is not changed — your app logic will still see the real time. iOS cannot time‑travel app code. -* DeviceCloud applies a cosmetic status‑bar time only via the simulator status‑bar override. +* The app's `Date()` / `NSDate` is not changed — your app logic will still see the real time. iOS cannot time-travel app code. +* DeviceCloud applies a cosmetic status-bar time only via the simulator status-bar override. * The status bar shows the hour and minute of the requested time in UTC, so write the value with a `Z` suffix (e.g. `2030-01-01T09:30:00Z` shows `9:30`). `DEVICECLOUD_OVERRIDE_DEVICE_TIMEZONE` is ignored on iOS. * Apple's tooling only accepts whole `HH:MM` times and rejects a zero minute, so a requested time on the hour (e.g. `09:00`) is shown as `9:01`, and midnight (`00:xx` UTC) is left at the real time. -If you need real time‑travel on iOS, control the date from inside your app (e.g. a debug/launch argument) rather than relying on this override. - -## Precedence - -1. `DEVICECLOUD_OVERRIDE_DEVICE_DATETIME` (per test) -2. Default: the real current device time +If you need real time-travel on iOS, control the date from inside your app (e.g. a debug/launch argument) rather than relying on this override. diff --git a/configuration/device-locale.md b/configuration/device-locale.md index 157c8e5..50b4512 100644 --- a/configuration/device-locale.md +++ b/configuration/device-locale.md @@ -3,7 +3,7 @@ Set device language and region for localization testing. ::: info -The default locale for Android is `en_US` . The default locale for iOS is currently `en_GB` but will be changing to `en_US` later in 2026. +If you don't set a locale, Android runs use `en_US` and iOS runs use `en_GB`. Pass `--device-locale` to get the same locale on both. ::: ## Format @@ -45,8 +45,6 @@ env: # test steps ``` - - ## Common Locales ### European diff --git a/configuration/device-matrix.md b/configuration/device-matrix.md index 09e4b47..345b28f 100644 --- a/configuration/device-matrix.md +++ b/configuration/device-matrix.md @@ -8,7 +8,7 @@ invocation. Every flow runs once per device, all under one upload with one conso ## Usage -Pass `--ios-device-matrix :` (or `--android-device-matrix :`) once per device you want. Supported devices and operating systems are listed [here](../getting-started/devices-configuration.md). +Pass `--ios-device-matrix :` (or `--android-device-matrix :`) once per device you want. Supported devices and OS versions are listed in [Devices & OS Versions](../getting-started/devices-configuration.md). ### iOS @@ -59,7 +59,7 @@ A matrix runs one test per (flow x device), so a 4-device matrix over 10 flows i Pixel 10 · API 36 2 flows · $0.18 ``` -Rates are per device — iPad, iPhone Duo, Generic Tablet, Pixel 10 Pro Fold and Google Play flows are charged at the advanced rate, as per our [pricing](../billing/test-run-billing.md). +Rates are per device. iPad, iPhone Duo, Generic Tablet, Pixel 10 Pro Fold and Google Play flows, and flows on the `m4` or `m1` [runner type](runner-type.md), are charged at the advanced rate, as per our [pricing](../billing/test-run-billing.md). A flow with [extended runtime](extended-runtime.md) costs 2× on every device. The `est. cost` the CLI prints includes all of these. ## Results diff --git a/configuration/disable-animations.md b/configuration/disable-animations.md index 649bd58..7dda42b 100644 --- a/configuration/disable-animations.md +++ b/configuration/disable-animations.md @@ -14,7 +14,7 @@ Pass the flag on `dcd cloud`: dcd cloud ... --disable-animations ``` -Or set it once in the workspace `config.yaml`: +Or set it once in the workspace `config.yaml`, separately for each platform: ```yaml platform: @@ -24,14 +24,13 @@ platform: disableAnimations: true ``` -::: warning -**Known limitations of the whole-upload settings:** +The CLI reads the block for your app's platform: `platform.android` for an `.apk`, and `platform.ios` for an `.app`, `.zip` or Expo `.tar.gz` build. With `--app-binary-id` it can't see the app, so it uses `platform.ios` only when you pass `--ios-device`, `--ios-version` or `--ios-device-matrix`, and `platform.android` otherwise. -* The CLI picks `platform.ios` or `platform.android` from your device flags, not from your app. An iOS run only uses `platform.ios` when you pass `--ios-device` or `--ios-version` (or an iOS device matrix); otherwise the `platform.android` value applies. -* `--disable-animations` can only turn animations off. It can't override `disableAnimations: true` in `config.yaml`. +A flag on `dcd cloud` beats `config.yaml`. To keep animations on for a run, even where `config.yaml` turns them off, pass `--no-disable-animations`: -The per-test overrides below aren't affected, so use them if you need exact control. -::: +```bash +dcd cloud ... --no-disable-animations +``` ### Per test (both platforms) @@ -72,8 +71,9 @@ When more than one is set, the most specific wins: 1. `DEVICECLOUD_OVERRIDE__DISABLE_ANIMATIONS` (per test, this platform) 2. `DEVICECLOUD_OVERRIDE_DISABLE_ANIMATIONS` (per test, both platforms) -3. The upload-wide `--disable-animations` flag or `config.yaml` (either one turns animations off) -4. Default: animations are **on** +3. `--disable-animations` or `--no-disable-animations` on `dcd cloud` (whole upload) +4. `disableAnimations` in `config.yaml`, for the run's platform (whole upload) +5. Default: animations are **on** A `false` override is honoured the same as `true` — a test can opt out even when the upload-wide flag is set. diff --git a/configuration/environment-variables.md b/configuration/environment-variables.md index 1c0f21e..dfe6512 100644 --- a/configuration/environment-variables.md +++ b/configuration/environment-variables.md @@ -1,6 +1,6 @@ # Environment Variables -Device Cloud allows you to inject environment variables into your test flows, enabling dynamic configuration and secure credential management. +DeviceCloud allows you to inject environment variables into your test flows, enabling dynamic configuration and secure credential management. ## Setting Environment Variables @@ -62,12 +62,13 @@ Variables starting with `SIMCTL_CHILD_DYLD_` are blocked and never reach the app ## Built-in Variables -DeviceCloud also sets these variables on every run, so a flow can adapt to the device it runs on: +DeviceCloud also sets these variables for your flows. `DCD_DEVICE` and `DCD_PLATFORM` are set on every run, so a flow can adapt to the device it runs on: | Variable | Value | | --- | --- | | `DCD_DEVICE` | The device and OS version, lowercased and hyphenated — for example `pixel-8-api-34`, `pixel-8-api-34-play` on a Google Play device, `iphone-16-ios-18` or `iphone-17-ios-26`. | | `DCD_PLATFORM` | `android` or `ios`. | +| `DCD_CONTROL_URL` | The address of the run's device-control server. Set only on [foldable](foldable-devices.md) runs and on flows that set `DEVICECLOUD_OVERRIDE_DEVICE_CONTROL: "true"`. | Passing your own value with `-e` overrides the built-in one. [Visual Testing](../advanced/visual-testing.md#per-device-baselines) uses `DCD_DEVICE` to pick a baseline per device. diff --git a/configuration/foldable-devices.md b/configuration/foldable-devices.md index 511d245..cec15fc 100644 --- a/configuration/foldable-devices.md +++ b/configuration/foldable-devices.md @@ -2,7 +2,7 @@ DeviceCloud runs two foldables: the **iPhone Duo** on iOS 27 and the **Pixel 10 Pro Fold** on API levels 36 and 37. Each starts a run in one posture, and a flow can fold or unfold it part-way through, then tap, swipe and take screenshots on whichever screen is active. Foldable runs are charged at the advanced rate, see [pricing](../billing/test-run-billing.md). -| Device | Flags | Starts | Postures | Screens | +| Device | Flags | Starts | Postures | Screens (pixels) | | ----------------- | ---------------------------------------------------------- | ------------------------------ | ------------------------- | ----------------------------------------------- | | iPhone Duo | `--ios-device iphone-duo --ios-version 27` | `closed`, on the cover screen | `closed`, `book`, `open` | cover 1398 x 2034, plus the larger inner screen | | Pixel 10 Pro Fold | `--android-device pixel-10-pro-fold --android-api-level 36` | `open`, on the inner screen | `closed`, `half`, `open` | inner 2076 x 2152, cover 1080 x 2364 | @@ -74,7 +74,7 @@ Maestro's assertions keep working on the inner screen, but Maestro's own taps an ## Coordinates -`tap`, `longPress` and `swipe` take coordinates on the screen the app is currently on: interface points on iOS and pixels on Android, from the top-left corner of the whole screen, status bar included. Take a `screenshot` in that posture, or read `screen` from `state`, to find them. A point outside the active screen is refused. +`tap`, `longPress` and `swipe` take coordinates on the screen the app is currently on: interface points on iOS and pixels on Android, from the top-left corner of the whole screen, status bar included. Read `screen` from `state` for the active screen's size in those units. On Android a `screenshot` uses the same pixels, so you can measure on it directly. On iOS a screenshot is in pixels, not points, so divide what you measure on it by the screen's scale (the screenshot's `width` divided by `screen.width`). A point outside the active screen is refused with `422`. A control tap is not a Maestro command, so nothing waits for your app to be ready before it. Put an `assertVisible` on the element you are about to tap first. diff --git a/configuration/google-play-apis.md b/configuration/google-play-apis.md index e91dc5b..6400d0b 100644 --- a/configuration/google-play-apis.md +++ b/configuration/google-play-apis.md @@ -34,14 +34,14 @@ env: ``` Only that flow boots on a Google Play emulator; the rest of the upload uses the -standard image. Billing is per flow — Play-image flows are charged at the Google -Play rate, the others at the standard rate. +standard image. Billing is per flow — Play-image flows are charged at the advanced +rate, the others at the standard rate. -## Precedence +## Which flows use Google Play -1. `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY: true` (per test, opt-in) -2. The upload-wide `--google-play` flag -3. Default: standard Google APIs image +A flow runs on a Google Play image when the upload passes `--google-play` or the flow sets `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY: true`. Otherwise it uses the standard Google APIs image. + +A flow can't opt out of `--google-play`. `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY: false` has no effect, so the flow still runs on Google Play and is charged at the advanced rate. To put only some flows on Google Play, leave out `--google-play` and opt those flows in. In a [device matrix](device-matrix.md) upload, each cell's own setting decides instead (`:play` on the cell, or `--google-play` for every cell). A flow's `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY` is ignored there unless the flow also names its own device. @@ -67,7 +67,7 @@ dcd cloud ... --google-play --android-device pixel-8 --android-api-level 34 If you pass only one of them, DeviceCloud picks the other so the pair has a Google Play image: a device runs on its Google Play API level, and an API level runs on a Google Play device that offers it. If you pass neither, the run uses the default Android device, Pixel 10 on API 36, which has a Google Play image. A device with no Google Play image, or an API level no Google Play device offers, is rejected. -If only some flows opt in with `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY`, those flows are resolved the same way, from the device and API level the flow names, then the ones the upload names. A flow that opts in and names neither runs on Pixel 10 on API 36. To choose the device, pin it on the upload, or on those flows with [per-flow devices](per-flow-devices.md). +If only some flows opt in with `DEVICECLOUD_OVERRIDE_GOOGLE_PLAY`, those flows are resolved the same way, from the device and API level the flow names, then the ones the upload names. A flow that opts in runs on Pixel 10 on API 36 when neither the flow nor the upload names a device or API level. To choose the device, pin it on the upload, or on those flows with [per-flow devices](per-flow-devices.md). ## Moving to Apple Silicon (`m1`) diff --git a/configuration/maestro-versions.md b/configuration/maestro-versions.md index 78c8cac..b7d5f9b 100644 --- a/configuration/maestro-versions.md +++ b/configuration/maestro-versions.md @@ -1,6 +1,6 @@ # Maestro Versions -Device Cloud supports multiple Maestro versions to ensure compatibility with your test flows. +DeviceCloud supports multiple Maestro versions to ensure compatibility with your test flows. By default, tests run using Maestro 2.10.0. Pin `--maestro-version` if you need to stay on a specific version. @@ -8,7 +8,7 @@ Please note that we periodically remove support for older versions so we always ## Available Versions -We currently support the following versions of Maestro: +We support these versions of Maestro: * 2.2.0 (deprecated) * 2.6.1 @@ -30,7 +30,7 @@ Maestro 2.0.4, 2.0.9, 2.1.0, 2.5.0, 2.5.1 and 2.6.0 were removed on 19 October 2 You can specify a version using `--maestro-version `. -We additionally support the use of `--maestro-version latest` which will default to the most up-to-date version we support. This currently resolves to 2.12.1. +You can also pass `--maestro-version latest`, which runs the newest version in the list above. Note that Maestro 2.7.0 reorganised the per-flow debug output into a new bundle layout, with screenshots named `step--.png`. If you download and process test artifacts programmatically, check your tooling against a 2.7.0 or later run before switching. @@ -49,14 +49,14 @@ dcd cloud ... --maestro-version latest We will always aim to support the latest versions of Maestro and additionally continue to provide support for previous versions. Our policy for this is as follows: * We will always add support for new versions. -* Once a new minor version has been released (i.e. 2.x.0), we'll mark all previous patches of the previous minor (i.e. 2.6.x) bar the latest as deprecated. -* Once a minor version is five versions old, we'll mark it as deprecated. -* Deprecated versions are then removed after 30 days provided it's total usage over seven days is less than 0.5%. +* Once a new minor version is released (for example 2.7.0), we'll mark every patch of the previous minor version (2.6.x) except the newest as deprecated. +* Once a minor version is five or more minor versions old, we may mark it as deprecated. +* Deprecated versions are then removed after 30 days, provided their total usage over seven days is less than 1%. ::: info -For example, Maestro 2.0.0 received 10 patch releases (2.0.1 -> 2.0.10) and we provided support for all of them. Once Maestro 2.1.0 released, we would then deprecate support for 2.0.0 -> 2.0.9 and retain 2.0.10. +For example, Maestro 2.0.0 received 10 patch releases (2.0.1 to 2.0.10) and we supported all of them. Once Maestro 2.1.0 was released, we would deprecate 2.0.0 to 2.0.9 and keep 2.0.10. -Once Maestro 2.5.0 is released, we would then mark 2.0.10 as deprecated and look to remove it after 30 days, provided it's usage has dropped below 0.5%. +Once Maestro 2.5.0 is released, 2.0.10 is five minor versions old, so we may mark it as deprecated and remove it after 30 days, provided its usage has dropped below 1%. ::: We may update the default version from time to time and we will always provide at least 30 days of notice beforehand. diff --git a/configuration/orientation.md b/configuration/orientation.md index fcd406b..7e41802 100644 --- a/configuration/orientation.md +++ b/configuration/orientation.md @@ -2,16 +2,20 @@ Control Android device orientation during test execution. -> **Note**: Android only. iOS devices are always portrait. +::: info +Android only. `--orientation` is ignored on iOS, where devices stay in portrait. +::: ## Options * `0`: Portrait (default) * `90`: Landscape -> **Note**: Only `0` and `90` are supported. The legacy `180` and `270` values are no longer accepted. +Only `0` and `90` are accepted. The legacy `180` and `270` values are rejected. -> **Note**: Generic Tablet starts in landscape, so on it `0` (and the default) is landscape and `90` is portrait. +::: info +Generic Tablet starts in landscape, so on it `0` (and the default) is landscape and `90` is portrait. +::: ## Usage diff --git a/configuration/per-flow-devices.md b/configuration/per-flow-devices.md index a8a6d33..61a1a80 100644 --- a/configuration/per-flow-devices.md +++ b/configuration/per-flow-devices.md @@ -3,16 +3,16 @@ By default every flow in an upload runs on the same device, set by the `--ios-device`, `--ios-version`, `--android-device` and `--android-api-level` flags on `dcd cloud`. -Sometimes a single flow only matters on one device for example a flow you must verify on a +Sometimes a single flow only matters on one device: for example, a flow you must verify on a tablet, or a flow that has to work on your oldest supported OS. Rather than running a separate upload per flow, a flow can declare the device it needs directly in its YAML. A flow that declares a device runs as normal on that device. Flows that declare -nothing inherit the upload's device, exactly as before. Your run count does not change. +nothing inherit the upload's device. Your run count does not change. ## Usage -Set the device in the flow's `env:` block. You can find a list of supported devices and operating systems [here](../getting-started/devices-configuration.md). +Set the device in the flow's `env:` block. Supported devices and OS versions are listed in [Devices & OS Versions](../getting-started/devices-configuration.md). ### iOS diff --git a/configuration/run-priority.md b/configuration/run-priority.md index 614cf8a..3eddca0 100644 --- a/configuration/run-priority.md +++ b/configuration/run-priority.md @@ -24,6 +24,8 @@ Once you reach your maximum concurrency, extra tests are queued until you're bac * Priority takes effect when your team is at its maximum concurrency and runs are waiting in the queue. When you're under the limit, nothing is held back, so there is nothing to reorder. * Retries keep the original run's priority. This covers both automatic retries from [`--retry`](../advanced/retry-strategies.md) and retries you queue from the console. +* In an `executionOrder` sequence, priority only decides when the first flow starts. Each later flow in the sequence can start once the one before it finishes. +* Priority reorders your queued runs within each device. If a higher-priority run on one device takes the slot your queued run on another device would have used, that run goes back in its device's queue as if you had just submitted it. ## FAQ @@ -33,8 +35,8 @@ No. ### Do priority tests affect other teams and their tests? No, priority is scoped to only your team's queue. -### What happens to low runs that get bumped continously? -A run that has been queued for more than 6 hours is started first, no matter it's priority. A steady stream of `high` runs can delay your `low` runs, but can't hold them back indefinitely. +### What happens to low runs that get bumped continuously? +A run that has been queued for more than 6 hours is started first, no matter its priority. A steady stream of `high` runs can delay your `low` runs, but can't hold them back indefinitely. ## CI integrations diff --git a/configuration/runner-type.md b/configuration/runner-type.md index ad551bf..c71cb33 100644 --- a/configuration/runner-type.md +++ b/configuration/runner-type.md @@ -13,13 +13,13 @@ By default each test run uses the following underlying hardware specifications: Android runs use `cpu1` unless you choose another runner type. Default iOS runs usually run on M1 hosts, but an idle M4 host can also pick them up. -As modern simulators and emulators are becoming more resource intensive, we're gradually rolling out additional runner types to support more advanced/intensive test scenarios. +Simulators and emulators keep needing more resources, so we offer extra runner types for heavier apps and tests. ::: info -Additional runner types are currently in beta as we work to increase capacity. +The `m4` runner type is in beta while we add capacity. ::: -If your app or test is struggling with the default runner types, you can try the options below. Please note that non-default runner types are charged at the advanced run fee as per our [pricing](../billing/test-run-billing.md). +If your app or test struggles on the default runner types, try the options below. `m4` and `m1` runs are charged at the advanced rate, see our [pricing](../billing/test-run-billing.md). ## Available runners diff --git a/configuration/workspace-config.md b/configuration/workspace-config.md index d378a46..dd896e6 100644 --- a/configuration/workspace-config.md +++ b/configuration/workspace-config.md @@ -9,6 +9,8 @@ Place your `config.yaml` file at the root of the directory you pass to `dcd clou dcd cloud app.apk flows/ # flows/config.yaml is loaded automatically ``` +Auto-detection only works when you pass a folder. If you pass a single flow file, the CLI doesn't look for a `config.yaml`, so pass it with `--config`. `executionOrder` is ignored then, because there's only one flow. + ## Custom path Use `--config` to load a config file from a non-standard location: @@ -46,7 +48,7 @@ includedPaths: - certs/test-ca.pem ``` -Patterns use the same [NPM glob](https://www.npmjs.com/package/glob) syntax as `flows`, and are resolved **relative to the workspace folder you pass to `dcd cloud`** — not relative to the config file, even when you load it with `--config`. If you pass a single flow file with `--config` instead of a folder, patterns are resolved relative to that flow file's folder. +Patterns use the same glob syntax as `flows` (`*`, `**`, `?` and `{a,b}`), and are resolved **relative to the workspace folder you pass to `dcd cloud`** — not relative to the config file, even when you load it with `--config`. If you pass a single flow file with `--config` instead of a folder, patterns are resolved relative to that flow file's folder. Matched files keep their position relative to your flows when they are uploaded, so a baseline at `screenshots/home.png` sitting next to `visual.yaml` arrives next to that flow on the device. @@ -112,7 +114,7 @@ The bare-list form is not valid Maestro either. The CLI rejects it with an error ::: ::: info -If a flow name in `flowsOrder` doesn't match any discovered flow (e.g. after tag filtering), the CLI will emit a warning and lists the available names to help diagnose the mismatch. +If a flow name in `flowsOrder` doesn't match any discovered flow (e.g. after tag filtering), the CLI warns and lists the available names, so you can spot the mismatch. Unrecognised top-level keys are also warned about (and ignored), which catches typos like `flowOrder`, a `continueOnFailure` placed at the top level instead of under `executionOrder`, and `tags:` in place of `includeTags`/`excludeTags`. ::: @@ -136,7 +138,7 @@ notifications: ### `platform` -Per-platform settings. Currently supports disabling animations, which is equivalent to passing `--disable-animations` on the CLI but lets you control each platform independently. +Per-platform settings. The only setting is `disableAnimations`, which works like `--disable-animations` but lets you set each platform separately. ```yaml platform: @@ -146,14 +148,9 @@ platform: disableAnimations: true # enables Reduce Motion on the simulator ``` -::: warning -**Known limitations:** - -* The CLI picks `platform.ios` or `platform.android` from your device flags, not from your app. An iOS run only uses `platform.ios` when you pass `--ios-device` or `--ios-version` (or an iOS device matrix); otherwise the `platform.android` value applies. -* `--disable-animations` can only turn animations off. It can't override `disableAnimations: true` set here. +The CLI reads the block for your app's platform, which it works out from the app file. With `--app-binary-id` it can't see the app, so it uses `platform.ios` only when you pass `--ios-device`, `--ios-version` or `--ios-device-matrix`, and `platform.android` otherwise. -The per-flow `DEVICECLOUD_OVERRIDE_*` settings described in [Animations](disable-animations.md) aren't affected. -::: +`--disable-animations` or `--no-disable-animations` on `dcd cloud` beats this setting, and a flow's own `DEVICECLOUD_OVERRIDE_*` setting beats both. See [Animations](disable-animations.md). ### `local` diff --git a/getting-started/api-keys.md b/getting-started/api-keys.md index 0d2bf97..bc161a3 100644 --- a/getting-started/api-keys.md +++ b/getting-started/api-keys.md @@ -4,19 +4,19 @@ DeviceCloud supports two ways to authenticate the CLI: **browser login** (best f ## `dcd login` (recommended for local use) -Run `dcd login` once and authenticate in your browser. The CLI stores the resulting session locally, so you don't need to pass a key on every command — and it unlocks live test updates and a smoother experience. +Run `dcd login` once and authenticate in your browser. The CLI stores the resulting session locally, so you don't need to pass a key on every command. ```bash dcd login ``` -This opens your browser, where you sign in (email OTP or Enterprise SSO) and authorise the CLI. If you belong to more than one organisation, you'll be prompted to pick one. The session is stored at: +This opens your browser, where you sign in with an email code, GitHub, Google, a passkey or your company's SSO, then choose **Authorize and finish login**. If you use two-factor authentication, or your team requires it, you'll also confirm with your authenticator app or a passkey. If you belong to more than one team, you'll be prompted to pick one. The session is stored at: - `$DCD_CONFIG_DIR/config.json`, if `DCD_CONFIG_DIR` is set, or - `$XDG_CONFIG_HOME/dcd/config.json`, or - `~/.dcd/config.json` if `XDG_CONFIG_HOME` is not set -The file is written with `0600` permissions (owner read/write only). The CLI keeps the session fresh while you use it, but a session ends 30 days after you log in, or after 7 days without a `dcd` command, whichever comes first. Then the CLI tells you to run `dcd login` again. API keys don't expire this way, so use one for CI and for processes that keep running, such as the [MCP server](../mcp/connect.md). See [Session limits](../security/security-overview.md#sessions). +The file is written with `0600` permissions (owner read/write only). The CLI keeps the session fresh while you use it, but a session ends 30 days after you log in, or after 7 days without a `dcd` command, whichever comes first. Then the CLI tells you to run `dcd login` again. These limits don't apply to API keys: a key lasts until its expiry date, if you set one, or until you revoke it. So use a key for CI and for processes that keep running, such as the [MCP server](../mcp/connect.md). See [Session limits](../security/security-overview.md#sessions). ::: info No browser on the box (e.g. over SSH)? Run `dcd login --no-browser` and the CLI prints a URL to open elsewhere. @@ -30,9 +30,10 @@ In CI and other non-interactive environments, use an API key. ### Getting an API key -1. Log in to the [console](https://console.devicecloud.dev/settings) -2. Open **Settings → API Keys** -3. Copy the key +1. Log in to the [console](https://console.devicecloud.dev/settings). +2. Open **Settings → API Keys** and choose **Create API key**. +3. Give it a **Name**, and choose its **Access** and **Expiry**. **Full access** suits CI and scripts. **Device sessions only** suits AI agents that use [Agent Devices](../mcp/agent-devices.md): such a key can start and drive device sessions and upload builds, but can't start test runs or read results. You can't change a key's access later. +4. Copy the key. It's shown only once, so store it straight away, for example as a CI secret. ### Using an API key diff --git a/getting-started/concurrency-and-parallel-runs.md b/getting-started/concurrency-and-parallel-runs.md index cf56904..5226a8d 100644 --- a/getting-started/concurrency-and-parallel-runs.md +++ b/getting-started/concurrency-and-parallel-runs.md @@ -19,7 +19,7 @@ The `gpu1` runner type was removed on 9 November 2026. Runs that still pass it r Google Play runs move to `m1` on 14 December 2026, after which they count towards the `m1` limit rather than `cpu1`. Runs you move there early with `--runner-type m1` count towards `m1` already. See [Google Play APIs](../configuration/google-play-apis.md#moving-to-apple-silicon-m1). ::: -Cheaper plans typically have no Concurrency Protection, which means that during busy periods when runner capacity is stretched, you may need to wait for runner availability or experience less concurrency than your maximum. +The Pro plan has no Concurrency Protection, so during busy periods, when runner capacity is stretched, your tests may wait for a runner or run with less concurrency than your maximum. Once you reach your maximum concurrency for a runner type, additional tests enter a queued state and sit in a backlog until you're under your concurrency limits. At that point, they automatically move to pending and are processed by the runners. To choose which of your own queued runs starts first, see [Run Priority](../configuration/run-priority.md). diff --git a/getting-started/devices-configuration.md b/getting-started/devices-configuration.md index 5534fc7..74cee3b 100644 --- a/getting-started/devices-configuration.md +++ b/getting-started/devices-configuration.md @@ -55,7 +55,7 @@ Pixel 10 runs API levels 36 and 37 only. To run on API level 32-35, pass `--andr | `pixel-10-pro-xl` | Pixel 10 Pro XL | 1344 x 2992 | 36, 37 | | `pixel-10-pro-fold` | Pixel 10 Pro Fold (starts unfolded) | 2076 x 2152 | 36, 37 | | `pixel-11` | Pixel 11 | 1080 x 2424 | 37 | -| `generic-tablet` | Generic Tablet (Note: starts in landscape by default, use orientation=90 for portrait) | 2560 x 1440 | 36, 37 | +| `generic-tablet` | Generic Tablet (starts in landscape; pass `--orientation 90` for portrait) | 2560 x 1440 | 36, 37 | Generic Tablet and Pixel 10 Pro Fold runs are billed at the Advanced Android rate, see [pricing](../billing/test-run-billing.md). @@ -119,7 +119,7 @@ iPad and iPhone Duo runs are billed at the Advanced iOS rate, see [pricing](../b iPhone 16 Pro is deprecated and we're targeting removal on 7 December 2026; this is subject to change based on usage. Runs that target it will be rejected once it's removed, so move them to `iphone-16` (the default), `iphone-17`, `iphone-air`, `iphone-18-pro` or `iphone-18-pro-max`. ::: -iPhone 16 Pro Max was removed on 9 November 2026, and runs that target it are rejected. Move them to `iphone-16` (the default), `iphone-17`, `iphone-air`, `iphone-18-pro` or `iphone-18-pro-max`. `iphone-18-pro` and `iphone-18-pro-max` run iOS 27 only, so pass `--ios-version 27` with them. +iPhone 16 Pro Max was removed on 9 November 2026, and runs that target it are rejected. Move them to one of the devices above. `iphone-18-pro` and `iphone-18-pro-max` run iOS 27 only, so pass `--ios-version 27` with them. iPhone 15, iPhone 16 Plus and iPad Pro (6th Generation) were removed on 2 November 2026. @@ -147,13 +147,13 @@ If you need a device or OS that we don't currently offer, please feel free to re We will always aim to support the latest versions of iOS and additionally continue to provide support for previous versions. Our policy for this is as follows: -* The latest even-numbered iPhone model & its variations, i.e. iPhone 18, 18e, 18 Pro & 18 Pro Max. We support the ones Apple has actually released; at the time of writing that is the iPhone 18 Pro and 18 Pro Max. +* The latest even-numbered iPhone model & its variations, e.g. iPhone 18, 18e, 18 Pro & 18 Pro Max, once Apple has released them. The table above lists the ones available now. * The previous two supported (i.e. even-numbered) generations of base-model iPhones, i.e. iPhone 16 & iPhone 14. Variations such as Plus, Pro and Pro Max are covered only for the latest even-numbered generation, so they fall out of support when a new even-numbered generation arrives. * The latest "un-numbered" iPhones provided their screen dimensions are noticeably different from currently supported devices, i.e. iPhone Air and iPhone Duo. * The latest odd-numbered, base-model iPhone, i.e. iPhone 17. * The latest generation of iPad Pro, in both screen sizes. * Once a device is to be no longer supported, we'll mark it as deprecated. -* Deprecated devices are then removed after 30 days provided its total usage over seven days is less than 1%. +* Deprecated devices are then removed after 30 days, provided their total usage over seven days is less than 1%. #### iOS Versions @@ -161,8 +161,8 @@ We will always aim to support the latest versions of iOS and additionally contin * We will always support the latest version plus the previous two. * Supported versions will always be the latest point release (i.e. 26.x rather than 26.0). Point releases change without notice; you target a major version such as `--ios-version 26` and we run it on the newest 26.x we hold. -* Once a version is two major versions old, we'll mark it as deprecated. -* Deprecated versions are then removed after 30 days provided it's total usage over seven days is less than 1%. +* Once a version is no longer one of the latest three, we'll mark it as deprecated. +* Deprecated versions are then removed after 30 days, provided its total usage over seven days is less than 1%. It may be possible in some cases to provide support for a beta version however this will be on a case-by-case basis; please contact our Support team if you would like to request this. @@ -179,7 +179,7 @@ We will always aim to support the latest devices and additionally continue to pr * The latest odd-numbered, base-model Pixel i.e. Pixel 11. * A generic-tablet model. * Once a device is to be no longer supported, we'll mark it as deprecated. -* Deprecated devices are then removed after 30 days provided its total usage over seven days is less than 1%. +* Deprecated devices are then removed after 30 days, provided their total usage over seven days is less than 1%. #### Android Versions @@ -187,7 +187,7 @@ We will always aim to support the latest versions of Android and additionally co * We will always support the latest version. * Once a version is no longer supported by Google, we'll mark it as deprecated. -* Deprecated versions are then removed after 30 days provided it's total usage over seven days is less than 1%. +* Deprecated versions are then removed after 30 days, provided its total usage over seven days is less than 1%. * We consider API versions unsupported once they are no longer included in [Android Security Bulletins](https://source.android.com/docs/security/bulletin). It may be possible in some cases to provide support for a beta version however this will be on a case-by-case basis; please contact our Support team if you would like to request this. diff --git a/getting-started/flows-and-workspaces.md b/getting-started/flows-and-workspaces.md index aa14e3b..b8fccb4 100644 --- a/getting-started/flows-and-workspaces.md +++ b/getting-started/flows-and-workspaces.md @@ -20,11 +20,7 @@ dcd cloud Where: -* `` is one of: - * `.app` - * `.zip` - * `.apk` - * `.tar.gz` (an Expo iOS build) +* `` is an iOS simulator build (`.app`, a `.zip` of one, or an Expo `.tar.gz`) or an Android `.apk`. See [App Management](../configuration/app-management.md) for details. * `` is one of: * `.yaml` * `.yml` @@ -37,8 +33,8 @@ dcd cloud Where `` is either: -* an absolute path, i.e. `/path/from/root` -* a relative path, i.e. `./` or `path/from/currentDir` +* an absolute path, e.g. `/path/from/root` +* a relative path, e.g. `./` or `path/from/currentDir` The CLI will inspect all YAML files at the top level of the directory (sub-directories are not scanned) and create a test for each. To pick up flows in sub-directories, use `flows` glob patterns in a workspace config file (see below). @@ -48,7 +44,7 @@ The CLI takes a single flow path, not a glob. A quoted glob such as `"./**/*.yam ### 3. Executing flows using a Workspace Config file -For complex setups, a `config.yaml` file is recommended. Place it in the top-level directory you pass to the CLI and it will be detected automatically. Its `flows` field accepts glob patterns such as `./**/*.yaml`, so you can select flows in sub-directories. +For complex setups, a `config.yaml` file is recommended. Place it in the top-level directory you pass to the CLI and it will be detected automatically. It's only picked up when you pass a directory: with a single flow file, point at the config with `--config`. Its `flows` field accepts glob patterns such as `./**/*.yaml`, so you can select flows in sub-directories. ``` dcd cloud diff --git a/getting-started/quickstart.md b/getting-started/quickstart.md index ea90439..cfda93e 100644 --- a/getting-started/quickstart.md +++ b/getting-started/quickstart.md @@ -37,13 +37,15 @@ npm install -g @devicecloud.dev/dcd ### 2. Authenticate -Log in once in your browser — the CLI remembers your session, so you don't need to pass a key on every command: +Log in once in your browser. The CLI remembers your session, so you don't need to pass a key on every command: ```bash dcd login ``` -Running in CI or a headless environment? Use an API key instead. Find it in the [console settings](https://console.devicecloud.dev/settings) page and set it as an environment variable: +No account yet? Sign up at the [console](https://console.devicecloud.dev) first. New accounts get $20 of free credits. + +Running in CI or a headless environment? Use an API key instead. Create one under **Settings → API Keys** in the [console](https://console.devicecloud.dev/settings). The key is shown only once, so copy it straight into an environment variable or your CI secrets: ```bash export DEVICE_CLOUD_API_KEY=your-api-key @@ -53,19 +55,19 @@ See [Authentication](api-keys.md) for more detail. ### 3. Run your first flow -**iOS** +**iOS** needs a simulator build: an `.app` folder, a `.zip` of one, or an Expo simulator build (`.tar.gz`). Device builds (`.ipa`) aren't supported. ```bash dcd cloud .app ``` -**Android** +**Android** needs an `.apk`. App bundles (`.aab`) aren't supported. ```bash dcd cloud .apk ``` -That's it! Questions? Issues? Head to our [Discord](https://discord.gg/gm3mJwcNw8). +See [App Management](../configuration/app-management.md) for every accepted file type and how to reuse an uploaded build. Questions? Head to our [Discord](https://discord.gg/gm3mJwcNw8). --- diff --git a/mcp/agent-devices-skill.md b/mcp/agent-devices-skill.md index 280f18e..439161b 100644 --- a/mcp/agent-devices-skill.md +++ b/mcp/agent-devices-skill.md @@ -4,7 +4,7 @@ Your agent works better with [Agent Devices](agent-devices.md) when it knows the ## `AGENTS.md` -Codex, Cursor, Claude Code and most other agents read an `AGENTS.md` file at the root of your repository. Add this section to it: +Codex, Cursor and most other agents read an `AGENTS.md` file at the root of your repository. Add this section to it: ````markdown ## Testing on a device (DeviceCloud) @@ -20,8 +20,11 @@ Use the DeviceCloud MCP tools to check app changes on a real iOS simulator or An Never write passwords or tokens into the YAML. Pass them in `run`'s `env` and use `${NAME}` in the flow. Read the `warnings` in every result's session block: they say when the idle timeout or the session's time is running out. +If a command answers `LIVE_HUMAN_IN_CONTROL`, a person has taken control: stop sending commands and poll `get_human_status` until it is handed back. ```` +Claude Code reads `AGENTS.md` only when your repository has no `CLAUDE.md` or `CLAUDE.local.md`. If it has one, add the line `@AGENTS.md` to your `CLAUDE.md`, or put the section in `CLAUDE.md` instead. + ## Claude Code skill To load the instructions only when they're needed, save this as `.claude/skills/devicecloud-devices/SKILL.md` in your repository: @@ -42,6 +45,7 @@ description: Check app changes on a real cloud iOS simulator or Android emulator 6. Always `stop_device` when done, even after a failure. Pass secrets in `run`'s `env` and use `${NAME}` in the flow; never write them into YAML. +If a command answers `LIVE_HUMAN_IN_CONTROL`, a person has taken control: stop sending commands and poll `get_human_status` until it is handed back. ```` -Both assume the DeviceCloud MCP server is connected: see [Connect your agent](agent-devices.md#connect-your-agent). +Both assume your agent has the device tools, through the hosted server or `dcd mcp`: see [Connect your agent](agent-devices.md#connect-your-agent). diff --git a/mcp/agent-devices-tools.md b/mcp/agent-devices-tools.md index bcfa8c8..49071d5 100644 --- a/mcp/agent-devices-tools.md +++ b/mcp/agent-devices-tools.md @@ -1,18 +1,19 @@ # Agent Devices tool reference -These are the tools DeviceCloud's hosted MCP server (`https://api.devicecloud.dev/mcp`) offers for [Agent Devices](agent-devices.md). Each description below is the one your agent sees. Every tool except `list_devices` and `cheat_sheet` takes an optional `session_id`. You can leave it out when your organization has exactly one open session. +These are the tools DeviceCloud's hosted MCP server (`https://api.devicecloud.dev/mcp`) offers for [Agent Devices](agent-devices.md). Each description below is the one your agent sees. Every tool except `list_devices`, `start_device` and `cheat_sheet` takes an optional `session_id`. You can leave it out when your team has exactly one open session. With none open, or several, the tool answers `LIVE_SESSION_REQUIRED`. A [read-only connection](agent-devices.md#read-only) offers only the tools marked **Read-only**. [`dcd mcp`](agent-devices.md#headless-through-the-cli) serves the same tools, and adds `app_path` to `install_app` and `path` to `run` for files on your machine. ## The session block -Every result includes a `session` block, so the agent never needs a separate call to stay oriented: +Every result about a session includes a `session` block, so the agent never needs a separate call to stay oriented: | Field | What it says | |-------|--------------| | `id` | The session id, such as `brave-teal-otter` | -| `state` | `queued`, `provisioning`, `ready`, `active`, `needs_human`, `released`, `expired` or `failed` | -| `release_reason` | Why the session ended, once it has | +| `live_id` | The session's internal number. Tools take `id`, not this. REST API paths accept either | +| `state` | `queued`, `provisioning`, `ready`, `active` or `needs_human` while it's open. Once it has ended: `released` (stopped, or ended for another reason), `expired` (it reached a time limit or the spend cap) or `failed` (the device failed) | +| `release_reason` | Why the session ended, once it has: `user_stop`, `idle_timeout`, `max_duration`, `queue_timeout`, `spend_cap`, `needs_human_timeout`, `runner_error`, `heartbeat_lost` or `other` | | `platform`, `model` | The device, such as `ios` and `iphone-16-ios-26.5` | | `client_label` | Who is driving, such as `claude-code` | | `created_at`, `started_at`, `released_at` | When the session was asked for, got its device, and ended | @@ -99,7 +100,9 @@ Launch an app on the device: the installed build by default, or any app by id (e The current screen as compact JSON: every element of the app with text, an id, a label or a hint, with its bounds and any state (checked, selected, focused, enabled: false). Use it before tapping, and copy txt and rid values exactly into run commands (tapOn text / id). Shows the result of your last command. The on-screen keyboard's keys and the System UI (status bar, navigation bar) are left out and counted in `hidden`; keyboard_open says a keyboard is showing. -While a keyboard is open, some apps report their own fields and buttons with clipped accessibility bounds, and those elements are then missing from inspect_screen even with `all`, while the screenshot still shows them. Seen with React Native apps on Android that slide an input bar up above the keyboard. Hide the keyboard first, with `run` and `- hideKeyboard`, then inspect_screen again. Typing does not need the keyboard on screen: `inputText` goes to the focused field. +::: info +This note isn't part of the tool's description, but the `cheat_sheet` tool tells agents the same. While a keyboard is open, some apps report their own fields and buttons with clipped accessibility bounds, and those elements are then missing from inspect_screen even with `all`, while the screenshot still shows them. Seen with React Native apps on Android that slide an input bar up above the keyboard. Hide the keyboard first, with `press_key` and `back` on Android, or with `run` and `- hideKeyboard`, then inspect_screen again. Typing does not need the keyboard on screen: `inputText` goes to the focused field. +::: Read-only. @@ -125,8 +128,8 @@ Tap one thing on the screen: an element by its text (txt or a11y from inspect_sc | Input | Type | Required | Description | |-------|------|----------|-------------| | `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. | -| `text` | string | No | The element's text, label or hint, copied from inspect_screen. | -| `id` | string | No | The element's resource id (rid in inspect_screen). | +| `text` | string, up to 1000 characters | No | The element's text, label or hint, copied from inspect_screen. | +| `id` | string, up to 1000 characters | No | The element's resource id (rid in inspect_screen). | | `x` | number, 0 to 100 | No | x as a percentage of the screen, 0 to 100. | | `y` | number, 0 to 100 | No | y as a percentage of the screen, 0 to 100. | @@ -137,7 +140,7 @@ Type into the focused field (tap_on the field first). Answers once the screen ha | Input | Type | Required | Description | |-------|------|----------|-------------| | `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. | -| `text` | string | Yes | What to type, as the user would. | +| `text` | string, up to 1000 characters | Yes | What to type, as the user would. | | `sensitive` | boolean | No | The text is a secret: a password, a code. Default false. | ## `swipe` diff --git a/mcp/agent-devices.md b/mcp/agent-devices.md index d814ec0..1285f60 100644 --- a/mcp/agent-devices.md +++ b/mcp/agent-devices.md @@ -3,7 +3,7 @@ Agent Devices give your AI agent a real cloud iOS simulator or Android emulator to work on. Through DeviceCloud's hosted MCP server, an agent such as Claude Code, Cursor or Codex can start a device, install your app, look at the screen, tap and type, run Maestro flows, read the device logs, and ask a person for help when it gets stuck. You can watch every session live in the console and take over the device at any time. ::: warning -**Agent Devices are in a closed beta** and are billed at **$0.03/min**, excluding Sales Tax, the same as [Live sessions](../cli/dcd-live.md). Access is by request: contact support to have it turned on for your organization. Until it is, the hosted server offers your agent no tools. +**Agent Devices are in a closed beta** and are billed at **$0.03/min**, excluding Sales Tax, the same as sessions you start with [`dcd device`](../cli/dcd-device.md). Access is by request: contact support to have it turned on for your organization. Until it is, the hosted server offers your agent no tools. ::: ::: warning @@ -12,9 +12,9 @@ We accept no liability for anything your agent may read or execute on a device. ## Connect your agent -The server is at `https://api.devicecloud.dev/mcp` (Streamable HTTP). The first time your MCP client connects, it opens the DeviceCloud console in your browser: sign in, pick the organization the agent should use, and click **Connect**. +The server is at `https://api.devicecloud.dev/mcp` (Streamable HTTP). The first time your MCP client connects, it opens the DeviceCloud console in your browser: sign in, pick the organization the agent should use, and click **Connect**. Your client stays signed in while you use it. If it goes unused for 30 days, you sign in again. -In the console, **Settings → AI agents** shows these steps for your client, with one-click install links for Cursor and VS Code. +In the console, **Settings → AI agents** shows these steps for your client when you choose **Hosted**, with one-click install links for Cursor and VS Code. ### Claude Code @@ -93,10 +93,10 @@ claude mcp add --scope user devicecloud -e DEVICE_CLOUD_API_KEY="$DEVICE_CLOUD_A `dcd mcp` runs on your machine over stdio and passes the hosted server's tools through. It adds what only a local process can do: `install_app` takes `app_path`, a build on your machine to upload, and `run` takes `path`, a flow file or a directory of flows. It also serves the `dcd_*` tools for cloud test runs. Add `--read-only` after `mcp` to offer only the tools that change nothing. -On your own machine, `dcd mcp` can use your [`dcd login`](../cli/dcd-login.md) session instead of a key. `dcd mcp install` adds it to Claude Code, Claude Desktop, Cursor or VS Code for you. +On your own machine, `dcd mcp` can use your [`dcd login`](../cli/dcd-login.md) session instead of a key. `dcd mcp install` adds it to Claude Code, Claude Desktop, Codex, Cursor or VS Code for you: see [Connect an AI Agent](connect.md). ::: info -When you create a key for an agent, choose **Device sessions only** under **Access**. Such a key can start and drive devices and upload builds, but it can't start test runs or read results. You can't change a key's access later. +When you create a key for an agent, choose **Device sessions only** under **Access**. Such a key can start and drive devices and upload builds, but it can't start test runs or read results. You can't change a key's access later. With such a key, `dcd mcp` still lists its `dcd_*` tools, but they fail. Use a key with full access for an agent that also runs cloud tests. ::: ## Connected apps @@ -111,13 +111,13 @@ Every client you sign in shows up under **Settings → Account → Connected app 4. The agent loops: `inspect_screen` to see what's on screen, then `tap_on`, `input_text`, `swipe` or `press_key` for one step, or `run` for several Maestro commands, then `inspect_screen` again. `take_screenshot` shows the screen as an image, and `get_logs` reads the app's device log. 5. `stop_device` releases the device when it's done. -Every response carries a short **session** block: the session's state, how long it has left, its cost so far, its page in the console, and plain-English warnings, such as an upcoming idle timeout or the app having crashed. The agent never needs a separate call to stay oriented. Agents are told to give you the session's console link as soon as they have it, so you can watch. +Every response about a session carries a short **session** block: the session's state, how long it has left, its cost so far, its page in the console, and plain-English warnings, such as an upcoming idle timeout or the app having crashed. The agent never needs a separate call to stay oriented. Agents are told to give you the session's console link as soon as they have it, so you can watch. The full list of tools is in the [tool reference](agent-devices-tools.md). To teach your agent this loop, add the [agent instructions](agent-devices-skill.md) to your project. ## What a session runs -A session takes Maestro YAML and runs the common Maestro commands: `tapOn`, `doubleTapOn`, `longPressOn`, `inputText`, `eraseText`, `hideKeyboard`, `pressKey` (`Back`, `Home` and `Enter`), `swipe`, `scroll`, `scrollUntilVisible`, `assertVisible`, `assertNotVisible`, `extendedWaitUntil`, `waitForAnimationToEnd`, `launchApp`, `stopApp`, `killApp`, `clearState`, `openLink`, `takeScreenshot`, `back`, and `runFlow`, `repeat` and `retry`. +A session takes Maestro YAML and runs the common Maestro commands: `tapOn`, `doubleTapOn`, `longPressOn`, `inputText`, `eraseText`, `hideKeyboard`, `pressKey` (`Back`, `Home` and `Enter`), `swipe`, `scroll`, `scrollUntilVisible`, `assertVisible`, `assertNotVisible`, `extendedWaitUntil`, `waitForAnimationToEnd`, `launchApp`, `stopApp`, `killApp`, `clearState`, `openLink`, `takeScreenshot`, `back`, and `runFlow`, `repeat` and `retry`. Conditions on `visible`, `notVisible` and `platform` work. It doesn't run flow scripts: `runScript`, `evalScript`, or a JavaScript condition or expression. Only `${NAME}` variables from `env` are filled in. It also doesn't run `copyTextFrom`, `pasteText`, `inputRandom*`, `setLocation`, `travel` or `addMedia`, or other `pressKey` keys. A flow with a command it doesn't run fails before its first step, and the error names the line. @@ -149,6 +149,8 @@ The **Devices** page in the console lists your organization's sessions: those th Open one to watch it: the device's screen, and a script of every step the agent took, with the result of each and the screen after it. To step in, click **Pause agent**, or click the screen. While you have control, the agent's steps wait and run after you hand back, and any new command it sends is refused until then. Click the screen to tap, drag to swipe, use the buttons beside and under it (such as **Home**, **Back** on Android, and **Enter**), or type into the focused field. Tick **Secret** to keep what you type out of the timeline. **Resume agent** hands control back. +While you have control, you can also add Maestro lines to the script to run them, and remove the agent's held steps so they don't run. Pausing the agent starts the same 30-minute wait as a request for help: the session shows under **Needs you**, and it ends if you don't resume the agent in time. + ## Secrets Never put a password or token into a flow's YAML. Pass it in `run`'s `env` and refer to it by name: @@ -176,6 +178,8 @@ Each session is recorded on video by default (`record: false` on `start_device` The idle timeout is fixed, and no session can run longer than 60 minutes. Contact support to change the other limits for your organization, or to set a monthly spend cap on device sessions. +Each session also has rate limits on commands and reads: see [Rate limits](../api/device-sessions.md#rate-limits). + ## Pricing Device time is billed at $0.03 per minute, in 30-second steps, from when a device is assigned to the session until the session ends. Time spent queued isn't billed. Your organization's discount applies. diff --git a/mcp/connect.md b/mcp/connect.md index cbfb95a..75c7210 100644 --- a/mcp/connect.md +++ b/mcp/connect.md @@ -4,7 +4,15 @@ description: "Connect Claude Code, Cursor, VS Code, Claude Desktop, Codex or ano # Connect an AI Agent -`dcd mcp` is DeviceCloud's [MCP](https://modelcontextprotocol.io) server. It lets an AI agent, such as Claude Code, Cursor, VS Code, Claude Desktop or Codex, run cloud tests and read their results. It comes with the [CLI](../cli/overview.md), and it works the same on your machine and headless, such as in CI. +DeviceCloud has three [MCP](https://modelcontextprotocol.io) servers. Most setups need only `dcd mcp`, which this page sets up. + +| Server | Where it runs | What it serves | +|---|---|---| +| `dcd mcp` | On your machine or in CI, started by your MCP client. It comes with the [CLI](../cli/overview.md) | The `dcd_*` [cloud test tools](tools.md). Teams in the [Agent Devices](agent-devices.md) beta also get the device tools through it | +| `https://api.devicecloud.dev/mcp` | Hosted by DeviceCloud. Your MCP client signs in through your browser | The device tools only, for teams in the Agent Devices beta. See [Connect your agent](agent-devices.md#connect-your-agent) | +| `dcd-mcp` | On your machine, from the npm package only | The `dcd_*` tools only. It's the [older server](overview.md): new setups use `dcd mcp` | + +`dcd mcp` lets an AI agent, such as Claude Code, Cursor, VS Code, Claude Desktop or Codex, run cloud tests and read their results. It works the same on your machine and headless, such as in CI. You don't run it yourself. You add it to your MCP client's config, and the client starts it. @@ -22,7 +30,9 @@ We accept no liability for anything your agent may read or execute. LLMs are a n dcd mcp install claude-code # or claude-desktop, codex, cursor, vscode ``` -If your dcd has no `dcd mcp`, or `dcd mcp install` doesn't list your client, update the CLI first (`dcd upgrade`, or `npm install -g @devicecloud.dev/dcd` for the npm package). Leave out the client to pick from a list. Add `--read-only` for a server that offers only the tools that change nothing, or `--print` to see what it would add without changing anything. For Claude Code, Codex and VS Code it runs their own `mcp add` command. For Claude Desktop and Cursor it adds an entry to their config file and keeps everything else in it. Restart the app afterwards. +If your dcd has no `dcd mcp`, or `dcd mcp install` doesn't list your client, update the CLI first (`dcd upgrade`, or `npm install -g @devicecloud.dev/dcd` for the npm package). Leave out the client to pick from a list. Add `--read-only` for a server that offers only the tools that change nothing, or `--print` to see what it would add without changing anything. + +For Claude Code, Codex and VS Code, `dcd mcp install` runs the client's own command: `claude mcp add`, `codex mcp add` or `code --add-mcp`. For Claude Desktop and Cursor, it adds an entry to their config file and keeps everything else in it. In Claude Code, Codex, Claude Desktop and Cursor, it replaces an entry already named `devicecloud`, such as one for the hosted server. Restart the app afterwards. ## Headless, with an API key @@ -52,9 +62,11 @@ Store the key as a secret in your CI provider (for example, a GitHub Actions sec ## Setting it up by hand -Start dcd by its **full path**. Desktop apps are usually opened from the Dock or Start menu, so they don't see the `PATH` your shell sets up, and a bare `dcd` fails with "command not found". The installer prints the path when it finishes. It's `~/.dcd/bin/dcd` by default, written out in full, because config files don't expand `~`. +Start dcd by its **full path**. Desktop apps are usually opened from the Dock or Start menu, so they don't see the `PATH` your shell sets up, and a bare `dcd` fails with "command not found". The installer prints the path when it finishes. It's `~/.dcd/bin/dcd` by default, or `%USERPROFILE%\.dcd\bin\dcd.exe` on Windows. Write it out in full, because config files don't expand `~`. -Claude Desktop (`claude_desktop_config.json`) and Cursor (`~/.cursor/mcp.json`): +The examples below use a macOS path. On Windows, write each backslash twice inside the quotes, as in `"C:\\Users\\you\\.dcd\\bin\\dcd.exe"`. + +Claude Desktop (`claude_desktop_config.json`, in `~/Library/Application Support/Claude/` on macOS or `%APPDATA%\Claude\` on Windows) and Cursor (`~/.cursor/mcp.json`): ```json { @@ -100,12 +112,22 @@ To run the npm package instead of an installed dcd, use `npx` as the command, wi `dcd mcp` signs in like the CLI: with your `dcd login` session, which it renews as it runs, or with `DEVICE_CLOUD_API_KEY`. A `dcd login` session still ends 30 days after you log in, or after 7 days without use, so use an API key for a server that stays running. See [Session limits](../security/security-overview.md#sessions). +With a `dcd login` session, the server works in your active team, the one [`dcd switch-org`](../cli/dcd-login.md#dcd-switch-org) sets. After you switch teams, restart your MCP client: a running server can keep using the old team for up to an hour. + ## Tools -`dcd mcp` serves the `dcd_*` tools: list devices, submit a cloud test run, follow its status and download its artifacts. The [Tools Reference](tools.md) describes each one. +::: warning +The `dcd_*` tools are in beta, so they may change. +::: + +`dcd mcp` serves the `dcd_*` tools: list devices, submit a cloud test run, list recent runs, check a run's status and download its artifacts. [Cloud Test Tools](tools.md) describes each one. + +If your team is in the [Agent Devices](agent-devices.md) beta, `dcd mcp` also serves the device tools, which start and drive cloud devices. It passes them through from the hosted server, and adds what only a local process can do: `install_app` takes `app_path`, a build on your machine, and `run` takes `path`, a flow file or a directory of flows. [Agent Devices Tools](agent-devices-tools.md) describes each one. + +## Read-only mode -`dcd_run_cloud_test` starts a test run, which is billable. For an agent that should only look, add `--read-only` after `mcp` in the arguments, or set `DCD_MCP_READONLY=1`. The server then leaves out every tool that changes anything. +`dcd_run_cloud_test` starts a test run, which is billable. For an agent that should only look, add `--read-only` after `mcp` in the arguments, or set `DCD_MCP_READONLY=1`. The server then leaves out every tool that changes anything, including the device tools that start, drive or stop a device. `dcd_download_artifacts` stays, because it only writes files on your machine. ## The older `dcd-mcp` server -The npm package also has `dcd-mcp`, an older server with the same `dcd_*` tools. `dcd mcp` covers it, so you only need `dcd-mcp` for a setup that already uses it. See [MCP Server](overview.md). +The npm package also has `dcd-mcp`, an older server with the same `dcd_*` tools but no device tools. `dcd mcp` covers it, so you only need `dcd-mcp` for a setup that already uses it. See [Older dcd-mcp Server](overview.md). diff --git a/mcp/overview.md b/mcp/overview.md index 9893ad5..944ef5f 100644 --- a/mcp/overview.md +++ b/mcp/overview.md @@ -1,18 +1,16 @@ -# MCP Server +# Older dcd-mcp Server -The `@devicecloud.dev/dcd` package ships a second binary, `dcd-mcp` — a [Model Context Protocol](https://modelcontextprotocol.io) server that lets AI agents (Claude, Cursor, VS Code, and other MCP clients) drive DeviceCloud directly: list devices, submit cloud test runs, check status, and download artifacts. +`dcd-mcp` is the older DeviceCloud MCP server. New setups use `dcd mcp`, the MCP server in the CLI: see [Connect an AI Agent](connect.md). -::: warning -The MCP server is a new, beta capability. The tool surface may change. -::: +`dcd-mcp` is a second binary in the `@devicecloud.dev/dcd` npm package. It serves the same `dcd_*` [cloud test tools](tools.md) as `dcd mcp`: list devices, submit cloud test runs, check their status and download artifacts. It doesn't serve the [Agent Devices](agent-devices.md) tools, and it has no `install` command. You only need it for a setup that already uses it. ::: warning -Please note that we accept no liability for anything your agent(s) may read or execute when using our MCP server. LLMs are a new technology and should be used with caution at your own risk. +We accept no liability for anything your agent may read or execute. LLMs are a new technology: use them with care and at your own risk. ::: ## Setup -Add the server to your MCP client's configuration. It runs over stdio via `npx` (Node 22 or newer), so there's nothing to install separately: +Add the server to your MCP client's configuration. It runs over stdio through `npx`, which needs Node 22 or later: ```jsonc { @@ -29,7 +27,7 @@ Add the server to your MCP client's configuration. It runs over stdio via `npx` The `--package=` form matters: it tells `npx` to run the package's `dcd-mcp` binary. Without it, `npx` runs the `dcd` CLI instead, which rejects `dcd-mcp` as an unknown command. ::: info -The MCP server ships in the npm package only. The standalone `dcd` binary doesn't include it, so you need Node even if you installed the CLI with the binary installer. +`dcd-mcp` is in the npm package only, so it needs Node even if you installed the CLI with the binary installer. The standalone `dcd` binary has `dcd mcp` instead: see [Connect an AI Agent](connect.md). ::: ## Authentication @@ -39,7 +37,7 @@ Auth is inherited from the CLI: - Set `DEVICE_CLOUD_API_KEY` in the server's `env` (as above) — **recommended**, **or** - Run [`dcd login`](../cli/dcd-login.md) once and the server will pick up the stored session. -When both are present, the environment variable wins. +When both are present, the environment variable wins. With a `dcd login` session, the server works in your active team, the one [`dcd switch-org`](../cli/dcd-login.md#dcd-switch-org) sets. After you switch teams, restart your MCP client: a running server can keep using the old team for up to an hour. Credentials are resolved lazily on the first tool call, not at startup — so your client can connect and enumerate the tools before you've supplied a key, and a bad credential surfaces as a tool error rather than a server that won't start. @@ -59,7 +57,7 @@ The server exposes five tools. Four are read-only; `dcd_run_cloud_test` submits | [`dcd_download_artifacts`](tools.md#dcd-download-artifacts) | Download a run's artifacts zip, and optionally a report, to disk | | [`dcd_run_cloud_test`](tools.md#dcd-run-cloud-test) | Submit a flow to run on the cloud (**billable**) | -See [Tools Reference](tools.md) for every parameter, default, and return shape. +See [Cloud Test Tools](tools.md) for every parameter, default, and return shape. ## Read-only mode diff --git a/mcp/tools.md b/mcp/tools.md index 925130a..40a42ff 100644 --- a/mcp/tools.md +++ b/mcp/tools.md @@ -1,22 +1,22 @@ -# Tools Reference +# Cloud Test Tools -Every tool the [MCP server](overview.md) exposes, with its parameters and return shape. +The `dcd_*` tools run Maestro tests in the cloud and read their results. [`dcd mcp`](connect.md) serves them, and so does the [older `dcd-mcp` server](overview.md). This page lists each tool's parameters and return shape. The tools that drive a cloud device are in [Agent Devices Tools](agent-devices-tools.md). All tools return pretty-printed JSON as their text payload. Failures come back as an error result the agent can read and react to — a failing tool never tears down the server, so an agent can recover and retry. ::: warning -The MCP server is a new, beta capability. The tool surface may change. +The `dcd_*` tools are in beta, so they may change. ::: -## dcd_list_devices +## dcd_list_devices -Discover the devices, OS versions, and Maestro versions available to your organisation. Agents should call this **before** `dcd_run_cloud_test` so they pass valid device values. +Discover the devices, OS versions, and Maestro versions available on DeviceCloud. Agents should call this **before** `dcd_run_cloud_test` so they pass valid device values. Takes no parameters. -Returns `{ ios, android, androidPlay, maestro }`, where each platform maps an OS version to its supported device list. See [Devices & OS Versions](../getting-started/devices-configuration.md) and [Maestro Versions](../configuration/maestro-versions.md). +Returns `{ ios, android, androidPlay, maestro }`. `ios`, `android` and `androidPlay` each map a device, such as `pixel-10`, to the OS versions it runs. `androidPlay` covers the [Google Play](../configuration/google-play-apis.md) images: a device with an empty list has none. `maestro` holds `supportedVersions`, `defaultVersion` and `latestVersion`. See [Devices & OS Versions](../getting-started/devices-configuration.md) and [Maestro Versions](../configuration/maestro-versions.md). -## dcd_list_runs +## dcd_list_runs List recent flow uploads for your organisation, most recent first. @@ -30,7 +30,7 @@ List recent flow uploads for your organisation, most recent first. Returns `{ uploads: [{ id, name, created_at, consoleUrl }], total, limit, offset }`. Use a returned `id` with `dcd_get_status` or `dcd_download_artifacts`. -## dcd_get_status +## dcd_get_status Get the status and per-test results of a single upload. This is the polling primitive: after an async `dcd_run_cloud_test`, call this until `status` leaves `PENDING` / `QUEUED` / `RUNNING`. @@ -43,26 +43,26 @@ Provide **exactly one** of `uploadId` or `name` — passing both, or neither, is Returns `{ status, name, createdAt, tests: [{ name, status, durationSeconds, failReason }] }`. -## dcd_download_artifacts +## dcd_download_artifacts -Download a completed run's artifacts zip (videos, logs and screenshots) to local disk, plus a formatted report if you ask for one. The artifacts zip is always downloaded; `report` adds a report on top of it. It reads cloud state and writes local files, so it stays available in [read-only mode](overview.md#read-only-mode). +Download a completed run's artifacts zip (videos, logs and screenshots) to local disk, plus a formatted report if you ask for one. The artifacts zip is always downloaded; `report` adds a report on top of it. It reads cloud state and writes local files, so it stays available in [read-only mode](connect.md#read-only-mode). | Parameter | Type | Description | |-----------|------|-------------| | `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`) | -| `report` | `junit` \| `allure` \| `html` | Also download a formatted report of this type. `allure` is deprecated and will be removed on 7 December 2026 | -| `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 | +| `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 | +| `report` | `junit` \| `allure` \| `html` | Also download a formatted report of this type. `allure` is deprecated, and we're targeting its removal on 7 December 2026 | +| `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. A relative path works as for `artifactsPath` | Returns `{ uploadId, artifactsPath, reportPath, warnings }`. A **non-empty `warnings` array means a download could not be produced** — most often because the run has no results yet. An empty array means success. See [Artifacts & Downloads](../artifacts/artifacts.md) and [Report Formats](../artifacts/report-formats.md). -## dcd_run_cloud_test +## dcd_run_cloud_test Submit a Maestro flow, or a directory of flows, to run on DeviceCloud. ::: warning -This tool consumes test credits. It's annotated as destructive so clients can prompt before calling it, and it's hidden entirely in [read-only mode](overview.md#read-only-mode). +This tool consumes test credits. It's annotated as destructive so clients can prompt before calling it, and it's hidden entirely in [read-only mode](connect.md#read-only-mode). ::: | Parameter | Type | Description | @@ -91,7 +91,7 @@ This tool consumes test credits. It's annotated as destructive so clients can pr | `wait` | boolean | Block until the run completes instead of returning immediately (default `false`) | | `waitTimeoutSeconds` | integer | Max seconds to wait when `wait` is true, 30–3600 (default `600`). A flow with [extended runtime](../configuration/extended-runtime.md) can run for up to 20 minutes, so raise this when the run includes one | -You must provide either `appFile` or `appBinaryId` — not both, and not neither. Use [`dcd upload`](../cli/dcd-upload.md) or a previous run to get a reusable `appBinaryId`. +You must provide either `appFile` or `appBinaryId` — not both, and not neither. A `dryRun` needs neither. Use [`dcd upload`](../cli/dcd-upload.md) or a previous run to get a reusable `appBinaryId`. ### Async by default diff --git a/notifications/email-notifications.md b/notifications/email-notifications.md index afd99e9..52e6bf5 100644 --- a/notifications/email-notifications.md +++ b/notifications/email-notifications.md @@ -69,7 +69,7 @@ If you are not receiving emails for your test runs, try adding **hello@deviceclo ### Disabling emails -Simply set `enabled: false` (or remove the `notifications.email` block) from your `config.yaml`. +Set `enabled: false`, or remove the `notifications.email` block from your `config.yaml`. ```yaml # config.yaml @@ -81,3 +81,7 @@ notifications: - sam@example.com - devs@example.com ``` + +### Usage alert emails + +[Usage alerts](../billing/usage-alerts.md) are separate from run summaries. They're set up on the billing page, not in `config.yaml`, and go to your team's billing email address, or to its owners and admins if none is set. diff --git a/notifications/slack-notifications.md b/notifications/slack-notifications.md index 64e621e..ba4ba79 100644 --- a/notifications/slack-notifications.md +++ b/notifications/slack-notifications.md @@ -11,13 +11,15 @@ Slack is configured once per organization from the DeviceCloud console — there 3. After you approve, you'll be returned to the console. 4. Pick the **channel** you want notifications posted to and click **Save**. +The channel list shows every public channel. A private channel only appears once the DeviceCloud app is in it: add the app to the channel in Slack (for example with `/invite` in that channel), then reload the settings page. + ::: info DeviceCloud requests only the permissions it needs to list your channels and post messages. It cannot read your messages. ::: #### Sending a test message -Once a channel is selected, use **Send test** to post a sample message to that channel and confirm everything is wired up. The test uses data from your most recent run when available. +Once you've saved a channel, use **Send test** to post a sample message to that channel and confirm everything is wired up. The test uses data from your most recent run when available. #### Only notify on failures @@ -60,7 +62,11 @@ dcd cloud app.apk flows/ \ --pr-url "https://github.com/owner/repo/pull/123" ``` -The line only appears when at least one of these values is present, and the commit/PR become clickable GitHub links when a `--repo-name` is supplied. +The line only appears when at least one of these values is present. The commit links to GitHub when `--repo-name` is set. The pull request links to `--pr-url`, or to the pull request built from `--repo-name` and `--pr-number`. + +### Usage alerts + +If a [usage alert](../billing/usage-alerts.md) includes **Slack**, it's posted to the same channel, whatever your **Only notify on failures** setting. ### Disconnecting diff --git a/notifications/webhook-notifications.md b/notifications/webhook-notifications.md index 6fdb6bd..705c5aa 100644 --- a/notifications/webhook-notifications.md +++ b/notifications/webhook-notifications.md @@ -4,13 +4,13 @@ DeviceCloud can send a POST request to a URL of your choice when a set of tests ### Enabling Webhooks -Head to the [console settings](https://console.devicecloud.dev/settings?section=notifications) page, open the **Notifications** section and find **Webhooks**. Enter your webhook URL there. +Head to the [console settings](https://console.devicecloud.dev/settings?section=notifications) page, open the **Notifications** section and find **Webhooks**. Enter your webhook URL there and select **Save**. **Delete** removes the webhook. ::: info -Only HTTPS URLs are supported. The hostname must resolve to a public IP address. Redirects aren't followed, so use the final URL: a `3xx` response counts as a failed delivery. +Only HTTPS URLs are supported, up to 2,048 characters. The hostname must resolve to a public IP address, and ports 22, 25, 53, 3306, 5432, 6379 and 27017 aren't allowed. Redirects aren't followed, so use the final URL: a `3xx` response counts as a failed delivery. ::: -You can also send a test request from the console to verify that your endpoint processes webhooks correctly. The test payload will contain information from your most recent job (or sample data if there isn't one yet), is marked with `"test": true`, and uses an `upload_id` prefixed with `test_` and a webhook ID prefixed with `wh_test_`. +Select **Test** to send a test request and verify that your endpoint processes webhooks correctly. The test payload will contain information from your most recent job (or sample data if there isn't one yet), is marked with `"test": true`, and uses an `upload_id` prefixed with `test_` and a webhook ID prefixed with `wh_test_`. ### Webhook Structure @@ -18,7 +18,7 @@ You can also send a test request from the console to verify that your endpoint p ``` Content-Type: application/json -X-DeviceCloud-Secret: DeviceCloud_ +X-DeviceCloud-Secret: X-DeviceCloud-Webhook-ID: wh_ X-DeviceCloud-Timestamp: User-Agent: DeviceCloud-Webhooks/1.0 @@ -71,7 +71,7 @@ User-Agent: DeviceCloud-Webhooks/1.0 | Field | Description | | --- | --- | -| `event` | `upload.completed` for a finished run. Device sessions add [`device.needs_human`](#device-needs-human). | +| `event` | `upload.completed` for a finished run. Device sessions add [`device.needs_human`](#device-needs-human), and usage alerts add [`usage.alert`](#usage-alert). | | `status` | Overall run outcome: `PASSED` only when every test passed, otherwise `FAILED`. Use this to gate a deploy or set a commit status. | | `device` | Device and runner context for the run: `name`, `osVersion`, `runnerType`, and `maestroVersion`. Individual fields are omitted when unavailable — `name` and `osVersion` are left out when the run's flows used more than one device. | | `summary` | Aggregate counts (`totalTests`, `passed`, `failed`, and optional `cancelled`/`queued`/`pending`/`running`) plus `durationSeconds`, `wallClockDurationSeconds`, and `retryCount`. | @@ -108,9 +108,9 @@ Property values must be scalars. Maestro rejects a flow whose `properties:` cont ### Delivery * Each attempt times out after 10 seconds, so respond with a `2xx` quickly and do any slow processing afterwards. -* Only timeouts are retried, up to 3 attempts in total (1 second, then 2 seconds apart). Every attempt carries the same `X-DeviceCloud-Webhook-ID`, so you can use it to ignore duplicates. -* Any HTTP response ends delivery, including a `4xx` or `5xx`, and so does any other connection error — these aren't retried. -* The URL's address is checked before every delivery. URLs that resolve to private, loopback, link-local or other reserved addresses are rejected, as are ports 22, 25, 53, 3306, 5432, 6379 and 27017. +* Timeouts and connection errors, such as a refused or reset connection or a failed DNS lookup, are retried, up to 3 attempts in total (1 second, then 2 seconds apart). Every attempt carries the same `X-DeviceCloud-Webhook-ID`, so you can use it to ignore duplicates. +* Any HTTP response ends delivery, including a `3xx`, `4xx` or `5xx`. These aren't retried. +* The URL's address is checked again before every delivery. If the hostname now resolves to a private, loopback, link-local or other reserved address, nothing is sent. * The console doesn't keep a delivery log, so log incoming requests on your side if you need a record. ### Repeat Deliveries After Retries @@ -144,6 +144,50 @@ When an [Agent Devices](../mcp/agent-devices.md) session asks for a person's hel `reason` is what the agent asked for. `expires_at` is when the session ends unless someone hands it back. `console_url` opens the session in the console, where you can take control and hand it back. +### Usage alert + +When a [usage alert](../billing/usage-alerts.md) that includes **Webhook** is sent, your webhook receives a `usage.alert` event, with the same headers and delivery as `upload.completed`: + +```json +{ + "event": "usage.alert", + "timestamp": "2026-11-17T09:12:44.000Z", + "alert": { + "id": 42, + "window_type": "day", + "threshold": 50, + "threshold_type": "credits", + "hard_stop": true + }, + "blocked": true, + "blocked_by": "hard_stop", + "window": { + "start": "2026-11-17T00:00:00.000Z", + "end": "2026-11-18T00:00:00.000Z", + "used": 48.6, + "limit": 50, + "remaining": 1.4 + }, + "period": { + "start": "2026-11-03T10:21:07.000Z", + "end": "2026-12-03T10:21:07.000Z", + "used": 212.4, + "allowance": 225, + "remaining": 12.6, + "estimated_cap_at": "2026-11-18T14:02:11.000Z" + }, + "billing_url": "https://console.devicecloud.dev/settings?section=billing" +} +``` + +| Field | Description | +| --- | --- | +| `alert` | The alert that fired: its `window_type` (`day`, `week` or `period`), `threshold`, `threshold_type` (`credits` for dollars, or `percent`) and whether it's a `hard_stop`. | +| `blocked` | `true` when a run was refused, rather than usage reaching the threshold. | +| `blocked_by` | What refused the run: `hard_stop` (this alert) or `overage_cap` (your [Overage Limit](../billing/overage.md#overage-limit)). `null` when nothing was refused. | +| `window` | The alert's window (UTC), the usage in it so far, the threshold in dollars (`limit`) and what's left before it. Amounts are in dollars. | +| `period` | The billing period: its usage, your `allowance` (included credits plus Overage Limit), what's left, and `estimated_cap_at`, when you'll reach the allowance at your current rate (`null` if it can't be estimated). `period` is `null` when your team has no Overage Limit. | + ### Webhook Secrets Every request includes the secret shown on your DeviceCloud console, sent as-is in the `X-DeviceCloud-Secret` header. To verify a request came from DeviceCloud, compare that header with your secret using a constant-time comparison (such as `crypto.timingSafeEqual` in Node.js or `hmac.compare_digest` in Python) and reject the request if they don't match. diff --git a/public/openapi.yaml b/public/openapi.yaml index fe1f2ba..2dab51a 100644 --- a/public/openapi.yaml +++ b/public/openapi.yaml @@ -31,9 +31,10 @@ info: ## Rate limits - The API accepts up to 60 requests a minute. Over the limit it answers `429` - with a `Retry-After` header. These endpoints aren't rate limited, so they're - safe to poll: `GET /results/{uploadId}`, `GET /uploads/status` and + Each endpoint accepts up to 60 requests a minute. Over the limit it answers + `429` with a `Retry-After` header: wait that many seconds, then retry, and + back off further if you get `429` again. These endpoints aren't counted, so + they're safe to poll: `GET /results/{uploadId}`, `GET /uploads/status` and `GET /ip-addresses`. The device session endpoints have their own limits, described on each one. @@ -315,10 +316,10 @@ paths: duration_seconds: 32 fail_reason: 'Element not found: Text matching regex next.* not found' cancellation_reason: null - simulator_name: pixel-7-api-34 + simulator_name: pixel-10-api-36 config: - deviceName: Pixel 7 - osVersion: '34' + deviceName: Pixel 10 + osVersion: '36' full: summary: Full view (config and result_files shortened) value: @@ -333,11 +334,11 @@ paths: duration_seconds: 32 fail_reason: 'Element not found: Text matching regex next.* not found' cancellation_reason: null - simulator_name: pixel-7-api-34 + simulator_name: pixel-10-api-36 platform: android config: - deviceName: Pixel 7 - osVersion: '34' + deviceName: Pixel 10 + osVersion: '36' maestroVersion: 2.10.0 result_files: id: 9120 @@ -377,7 +378,7 @@ paths: example: | - + @@ -586,14 +587,18 @@ paths: operationId: getFlowRuns tags: [Flows] summary: Get runs for a flow - description: Every run of one flow file, newest first. + description: | + The newest runs of one flow file, up to `limit`. Neither date has a + default, so without them runs of any age count. `uploadName` is `Unknown` for an + upload that was given no name. parameters: - name: fileName in: query required: true description: | - The flow's path exactly as `GET /flows` returns it in `file_name`: - relative to the flows folder that was run, starting with `./`. + The flow's path exactly as `GET /flows` returns it in `file_name`, + starting with `./`. It's relative to the flows folder that was run, + unless the flows use files outside that folder. schema: type: string example: ./auth/login.yaml @@ -854,8 +859,9 @@ paths: message: Not enough credits to start a live session. '403': description: >- - `LIVE_NOT_ENABLED`: device sessions aren't enabled for your organization. A missing or invalid API - key also answers 403 (see the shared `Forbidden` response). + `LIVE_NOT_ENABLED`: device sessions aren't enabled for your organization. They're in a closed beta: + contact support to have them turned on. A missing or invalid API key also answers 403 (see the + shared `Forbidden` response). content: application/json: schema: @@ -945,7 +951,7 @@ paths: monitor_url: https://console.devicecloud.dev/device/brave-teal-otter - id: calm-blue-heron live_id: 4177 - state: released + state: expired release_reason: idle_timeout platform: ios model: iphone-16-ios-26.4 @@ -2995,7 +3001,8 @@ components: name: x-dcd-org description: | The team (organization) ID to act as, with a Bearer token. The signed-in - user must be a member of that team. + user must be a member of that team. The ID is a number: `dcd whoami --json` + shows it as `org.id`. parameters: UploadId: name: uploadId @@ -3060,7 +3067,7 @@ components: message: This API key is limited to device_sessions and can't reach /uploads/list. Use a key with full access for this. error: API_KEY_SCOPE RateLimited: - description: Over 60 requests a minute. Wait for `Retry-After` seconds. + description: Over 60 requests a minute to this endpoint. Wait `Retry-After` seconds, then retry with backoff. headers: Retry-After: $ref: '#/components/headers/RetryAfter' @@ -3374,7 +3381,7 @@ components: durationSeconds: 32 failReason: 'Element not found: Text matching regex next.* not found' createdAt: '2026-01-15T10:30:04+00:00' - device: pixel-7-api-34 + device: pixel-10-api-36 UploadStatusTest: type: object required: [name, status] @@ -3395,7 +3402,7 @@ components: format: date-time device: type: string - description: The device the test ran on, such as `pixel-7-api-34` or `iPhone 16 - 18`. + description: The device the test ran on, such as `pixel-10-api-36` or `iPhone 16 - 18`. ResultsResponse: type: object required: [statusCode, results] @@ -3437,8 +3444,9 @@ components: status: $ref: '#/components/schemas/TestStatus' description: | - The test's state. This endpoint still reports a queued test as - `PENDING` rather than `QUEUED`, so treat both as "not started yet". + The test's state. This endpoint reports a queued test as `PENDING` + rather than `QUEUED`, so that older CLIs keep working. Treat both as + "not started yet". `GET /uploads/status` reports `QUEUED`. retry_of: type: [integer, 'null'] description: For a retry, the `id` of the attempt it retried. @@ -3461,7 +3469,7 @@ components: reasons may be added. simulator_name: type: string - description: The device the test ran on, such as `pixel-7-api-34`. + description: The device the test ran on, such as `pixel-10-api-36`. platform: $ref: '#/components/schemas/Platform' description: Full view only. @@ -3473,10 +3481,10 @@ components: properties: deviceName: type: string - example: Pixel 7 + example: Pixel 10 osVersion: type: [string, number] - example: '34' + example: '36' additionalProperties: true result_files: type: [object, 'null'] @@ -3603,7 +3611,10 @@ components: description: When the list last changed. ipAddresses: type: array - description: Every address as a bare IP, the simplest thing to allow-list. + description: | + Every address in one flat list, the simplest thing to allow-list. A + single host (`/32`) appears as a bare IP; a wider range would appear in + CIDR notation. items: type: string ranges: @@ -3670,7 +3681,7 @@ components: - `LIVE_NO_APP` (409): no app is installed, and none was named. - `LIVE_COMMAND_NOT_FOUND` (404): no such command in this session. - `LIVE_LOGS_UNAVAILABLE` (502): the device logs couldn't be read. - - `LIVE_SESSION_REQUIRED`: MCP only, never returned by this API. More than one session is open, so pass `session_id`. + - `LIVE_SESSION_REQUIRED`: MCP only, never returned by this API. No session is open, or more than one is, so pass `session_id`. - `LIVE_RATE_LIMITED` (429): too many requests. Wait `retry_after_s` seconds. - `LIVE_NOT_WAITING_FOR_HUMAN` (409): hand-back on a session that isn't waiting for a person. - `LIVE_HUMAN_IN_CONTROL` (409): a person has taken control in the console. Wait for them to hand back. @@ -3970,7 +3981,10 @@ components: description: Android only. An image with Google Play services. Sending it on iOS is a 400. binaryUploadId: type: string - description: An uploaded build to install once the device is ready. It must be your organization's and for this platform. + description: >- + An uploaded build to install once the device is ready. It must be your organization's and for this + platform. Upload one with `dcd upload`, which prints its ID, or reuse a test run's `appBinaryId` from + GET /uploads/status. deviceLocale: type: string pattern: '^[a-z]{2,3}_[A-Z]{2}$' @@ -4010,7 +4024,9 @@ components: properties: binaryUploadId: type: string - description: An uploaded build of your organization's, for the session's platform. + description: >- + An uploaded build of your organization's, for the session's platform. Upload one with `dcd upload`, + which prints its ID, or reuse a test run's `appBinaryId` from GET /uploads/status. url: type: string format: uri diff --git a/security/enterprise-single-sign-on.md b/security/enterprise-single-sign-on.md index ca79ad4..b1b8b08 100644 --- a/security/enterprise-single-sign-on.md +++ b/security/enterprise-single-sign-on.md @@ -5,33 +5,36 @@ description: SAML-based authentication for larger companies # Enterprise SSO ::: info -This feature is currently available to orgs who have the Max subscription or above. +Enterprise SSO is available on the Max and Enterprise plans. ::: -Single sign-on solutions (such as OKTA) allow organisations to centrally manage user access to DeviceCloud. +Single sign-on solutions (such as Okta) allow organisations to centrally manage user access to DeviceCloud. We support the following identity providers: -* Okta, Auth0 -* Google Workspaces -* Microsoft Active Directory, Azure Active Directory, Microsoft Entra +* Okta +* Auth0 +* Google Workspace +* Microsoft Entra ID (formerly Azure Active Directory) and Active Directory Federation Services (AD FS) * PingIdentity * OneLogin -Using a provider that is not on the list? Contact us and we'd be happy to help setup the integration. +Using a provider that isn't on the list? Contact us and we'll help you set it up. #### Integration Steps -These steps have been written with OKTA in mind, but are applicable to other identity providers too. +These steps have been written with Okta in mind, but are applicable to other identity providers too. -1. Create a new application with SAML in OKTA +1. Create a new application with SAML in Okta 2. Populate the SAML fields using the below values. | Key | Value | | ---------------------------- | --------------------------------------------------------- | | Single sign-on URL (ACS URL) | `https://cloud.devicecloud.dev/auth/v1/sso/saml/acs` | | Audience URI (SP Entity ID) | `https://cloud.devicecloud.dev/auth/v1/sso/saml/metadata` | -| Default Relay State | `https://cloud.devicecloud.dev/` | +| Default Relay State | `https://console.devicecloud.dev/login` | + +The Default Relay State is where people land when they start from your identity provider's dashboard, for example from an Okta tile. 3. Ensure the application username is set to EMAIL 4. Ensure the Name ID Format is set also to EMAIL @@ -40,6 +43,14 @@ These steps have been written with OKTA in mind, but are applicable to other ide 1. your metadata URL (or XML) 2. the email domain(s) you wish to protect 7. Our support team will then verify your organisation is on the Max or Enterprise plan and enforce SSO for the requested domains. -8. Once activated, DeviceCloud supports Service Provider initiated login via SSO using the SSO button on the DeviceCloud login screen: +8. Once SSO is on, sign in from the [DeviceCloud login screen](https://console.devicecloud.dev/login): enter your work email, then select **SAML SSO**. You can also start from your identity provider's dashboard. ![The DeviceCloud sign-in page with the SAML SSO option](../assets/sso-sign-in.png) + +#### What changes once SSO is on + +* People with an email address on a protected domain must sign in with **SAML SSO**. The login screen turns away an email code, GitHub, Google or a passkey for those addresses. +* Assign everyone who needs access to the DeviceCloud app in your identity provider before SSO is turned on. Anyone on a protected domain who isn't assigned can't sign in. +* People who sign in through SSO for the first time join your team automatically. +* Your identity provider handles multi-factor authentication. SSO accounts don't set up DeviceCloud two-factor authentication or passkeys, and an SSO sign-in meets every team [Sign-in requirement](security-overview.md#sign-in-and-two-factor-authentication). +* API keys keep working as before. diff --git a/security/it-security-policies.md b/security/it-security-policies.md index 36c5349..8bed343 100644 --- a/security/it-security-policies.md +++ b/security/it-security-policies.md @@ -15,5 +15,6 @@ The policies available are: 7. Data Retention and Disposal Policy 8. Encryption Policy 9. Human Resources Policy -10. Security Incident Management Policy -11. Vendor Management Policy +10. Logging and Monitoring Policy +11. Security Incident Management Policy +12. Vendor Management Policy diff --git a/security/security-overview.md b/security/security-overview.md index 4272fe5..c2f58b6 100644 --- a/security/security-overview.md +++ b/security/security-overview.md @@ -8,7 +8,7 @@ Security at DeviceCloud is led by **Tom Riglar, co-founder**. He is accountable ### Reporting a Vulnerability -If you think you have found a security issue in DeviceCloud, please email support@devicecloud.dev with "Security" in the subject line. Include enough detail for us to reproduce it. Please give us a reasonable chance to fix the issue before you share it with anyone else. Our contact details are also published at [devicecloud.dev/.well-known/security.txt](https://devicecloud.dev/.well-known/security.txt). +If you think you have found a security issue in DeviceCloud, please email [security@devicecloud.dev](mailto:security@devicecloud.dev). Include enough detail for us to reproduce it. Please give us a reasonable chance to fix the issue before you share it with anyone else. Our contact details are also published at [devicecloud.dev/.well-known/security.txt](https://devicecloud.dev/.well-known/security.txt). ### SOC2 Compliance Timeline @@ -18,14 +18,44 @@ Want to work with DeviceCloud but require SOC2? Please contact us, we will fast- ### Infrastructure -DeviceCloud stores customer data and performs processing using Supabase and Railway. Uploaded files and test artefacts are stored in Supabase and Backblaze B2, and delivered through Cloudflare. These cloud platforms are SOC2 compliant. All test execution runs on DeviceCloud-owned hardware in our dedicated secure data centre in the UK. +DeviceCloud stores customer data in Supabase (database and file storage) and Backblaze B2 (file storage). Our API runs on Railway. The console, and the files you download, are delivered through Cloudflare. Application logs are kept in Axiom. These cloud platforms are SOC2 compliant. All test execution runs on DeviceCloud-owned hardware in our dedicated secure data centre in the UK. + +Where your data is held: + +| Data | Provider and location | +| --- | --- | +| Accounts, teams, test results and settings | Supabase, AWS London (UK) | +| App binaries, flows, screenshots, videos and logs | Supabase Storage, AWS London (UK), and Backblaze B2, Amsterdam (EU) | +| Application logs | Axiom, AWS Frankfurt (EU) | +| API servers | Railway, in the Netherlands, US East, US West and Singapore. Your requests go to the nearest one. | +| Test devices | DeviceCloud-owned hardware in the UK | ### Data Encryption -Data held by our database and file storage providers is encrypted at rest with AES-256, and data sent over the internet is encrypted in transit via TLS. Credentials get additional protection at the application level: API keys are stored only as a one-way hash, and access tokens for connected services (such as Slack) are encrypted before being stored in the database. +Data held by our database and file storage providers is encrypted at rest with AES-256, and data sent over the internet is encrypted in transit via TLS. Credentials get additional protection at the application level: API keys are stored only as a one-way hash, and webhook secrets and access tokens for connected services (such as Slack) are encrypted before being stored in the database. On top of TLS, your uploads get envelope encryption by default. Before anything is uploaded, the CLI encrypts your app binary, flows and environment variables on your machine, each with its own random key (AES-256-GCM). It then encrypts each of those keys with DeviceCloud's public key (X25519), so the copies held in our storage and caches are ciphertext, and only our API can recover the keys that decrypt them. To turn envelope encryption off, pass `--no-encrypt` or set `DCD_ENCRYPT=0`. The upload is still encrypted in transit. +### Sign-in and two-factor authentication + +You can sign in to the console with an email code, GitHub, Google or a passkey. With [Enterprise SSO](enterprise-single-sign-on.md), you sign in through your identity provider instead. + +In **Settings → Account**, each person can add: + +* **Two-factor authentication**: a code from an authenticator app, asked for each time you sign in with an email code, GitHub or Google. A passkey already counts as two-factor, so the code isn't asked for after a passkey unless you turn on **Also ask for a code after signing in with a passkey**. +* **Passkeys**: sign in with your fingerprint, face, screen lock or a security key instead of an email code. + +Owners and admins can set a team **Sign-in requirement** in **Settings → Team**: + +| Option | Members must sign in with | +| --- | --- | +| Off | Any method | +| Two-factor | A passkey, or a code from an authenticator app | +| A passkey | A passkey | +| A passkey and a code | A passkey, then a code from an authenticator app | + +A member who hasn't signed in that way still sees the team listed, but can't open its results, uploads or settings until they do. This applies to `dcd login` sessions too: run `dcd login` again with a method that meets the requirement. Any SSO sign-in meets every option. API keys aren't affected. + ### Sessions Signing in to the console, or with `dcd login`, starts a session. A session ends 30 days after you sign in, or after 7 days without use, whichever comes first, and you then sign in again. An open console tab counts as use. The limits are checked when the session renews, which happens about once an hour, so a session can last up to an hour past them. @@ -42,7 +72,7 @@ Android emulators are instantiated into a clean operating system instance for ev ### Payments -DeviceCloud uses Paddle to handle payments. Paddle is PCI DSS SAQ A and SOC2 Type 1 compliant. +DeviceCloud uses Paddle, our Merchant of Record, to handle payments. You enter card details in Paddle's checkout, so they never reach DeviceCloud's servers. ### Code Control