### DeviceCloud CLI Installation Source: https://docs.devicecloud.dev/getting-started Installs the DeviceCloud CLI globally using npm. This command requires Node.js and npm to be installed. ```bash npm install -g @devicecloud.dev/dcd ``` -------------------------------- ### DeviceCloud CLI Installation Source: https://docs.devicecloud.dev/getting-started/quickstart Installs the DeviceCloud CLI globally using npm. This command requires Node.js and npm to be installed. ```bash npm install -g @devicecloud.dev/dcd ``` -------------------------------- ### Install Latest DeviceCloud CLI Source: https://docs.devicecloud.dev/getting-started/upgrade Installs the latest stable version of the DeviceCloud CLI tool globally using npm. ```bash npm install -g @devicecloud.dev/dcd@latest ``` -------------------------------- ### Maestro Cloud API Comparison Source: https://docs.devicecloud.dev/getting-started/quickstart Demonstrates the similarity between Maestro Cloud CLI commands and DeviceCloud CLI commands, showing how to replace 'maestro cloud' with 'dcd cloud'. ```bash # maestro cloud --apiKey dcdcloud--apiKey ``` -------------------------------- ### Install Prerelease DeviceCloud CLI Source: https://docs.devicecloud.dev/getting-started/upgrade Installs a prerelease version (release candidate) of the DeviceCloud CLI tool globally using npm. ```bash npm install -g @devicecloud.dev/dcd@rc ``` -------------------------------- ### Maestro Cloud API Comparison Source: https://docs.devicecloud.dev/getting-started Demonstrates the similarity between Maestro Cloud CLI commands and DeviceCloud CLI commands, showing how to replace 'maestro cloud' with 'dcd cloud'. ```bash # maestro cloud --apiKey dcdcloud--apiKey ``` -------------------------------- ### Run First Flow - iOS Source: https://docs.devicecloud.dev/getting-started Executes a DeviceCloud flow for an iOS application. Requires an API key, the application file (.app), and the flow file. ```bash dcd cloud --apiKey .app ``` -------------------------------- ### Run First Flow - Android Source: https://docs.devicecloud.dev/getting-started/quickstart Executes a DeviceCloud flow for an Android application. Requires an API key, the application file (.apk), and the flow file. ```bash dcd cloud --apiKey .apk ``` -------------------------------- ### Run First Flow - Android Source: https://docs.devicecloud.dev/getting-started Executes a DeviceCloud flow for an Android application. Requires an API key, the application file (.apk), and the flow file. ```bash dcd cloud --apiKey .apk ``` -------------------------------- ### Run First Flow - iOS Source: https://docs.devicecloud.dev/getting-started/quickstart Executes a DeviceCloud flow for an iOS application. Requires an API key, the application file (.app), and the flow file. ```bash dcd cloud --apiKey .app ``` -------------------------------- ### Start Async Tests with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/async-execution This snippet demonstrates the basic command-line usage for starting asynchronous tests using the DeviceCloud CLI. It shows the `--async` flag which allows the command to exit immediately after submitting the test, without waiting for its completion. A successful submission is indicated by an exit code of 0. ```bash dcdcloud...--async ``` -------------------------------- ### Run Maestro Flows with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference Demonstrates the basic usage of the DeviceCloud CLI for running Maestro flows. Includes examples for a simple run and a named run, specifying the application file and the flows directory. ```bash dcdcloud--app-file./app.apk--flows./tests/ ``` ```bash dcdcloud--name"smoke-tests"--app-file./app.apk--flows./tests/ ``` -------------------------------- ### Run Maestro Flows with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/test-execution Demonstrates the basic usage of the DeviceCloud CLI for running Maestro flows. Includes examples for a simple run and a named run, specifying the application file and the flows directory. ```bash dcdcloud--app-file./app.apk--flows./tests/ ``` ```bash dcdcloud--name"smoke-tests"--app-file./app.apk--flows./tests/ ``` -------------------------------- ### Example JSON Output for Upload Status Source: https://docs.devicecloud.dev/ci-cd-integration/status-api This is an example of the JSON output returned by the DeviceCloud CLI when the `--json` flag is used. It includes overall upload status, test results, and relevant IDs. ```json { "status": "FAILED", "tests": [ { "name": "./login-test/onboarding.yaml", "status": "FAILED", "failReason": "Error: Element not found: Text matching regex next.* not found", "durationSeconds": 32 } ], "appBinaryId": "67894274-b789-4c1e-80d4-da8998998999", "uploadId": "7e12345f-eb12-12ec-a30b-bb1234f1d12a", "consoleUrl": "https://console.devicecloud.dev/results?upload=7e12345f-eb12-12ec-a30b-bb1234f1d12a&result=4500" } ``` -------------------------------- ### DeviceCloud Environment Variables for Secure Credentials Source: https://docs.devicecloud.dev/reference/environment-variables Provides an example of using DeviceCloud environment variables to securely pass credentials like username and password, often sourced from CI/CD variables. ```bash dcd cloud -e USERNAME=${CI_USERNAME} \ -e PASSWORD=${CI_PASSWORD} ``` -------------------------------- ### Select Specific Devices and OS Versions with DeviceCloud Source: https://docs.devicecloud.dev/reference/test-execution Provides examples for specifying target devices and operating system versions for Maestro flow executions using the DeviceCloud CLI. This includes configurations for both Android and iOS platforms. ```bash dcd cloud ... --android-device pixel-6 --android-api-level 33 ``` ```bash dcd cloud ... --ios-device iphone-15 --ios-version 17 ``` -------------------------------- ### Select Specific Devices and OS Versions with DeviceCloud Source: https://docs.devicecloud.dev/reference Provides examples for specifying target devices and operating system versions for Maestro flow executions using the DeviceCloud CLI. This includes configurations for both Android and iOS platforms. ```bash dcd cloud ... --android-device pixel-6 --android-api-level 33 ``` ```bash dcd cloud ... --ios-device iphone-15 --ios-version 17 ``` -------------------------------- ### Run DeviceCloud CLI in Any CI (Bash) Source: https://docs.devicecloud.dev/ci-cd-integration/any-ci Execute the DeviceCloud CLI within any CI environment using a bash script. This example utilizes `npx` to run the `@devicecloud.dev/dcd` package, specifying a sample zip file, an iOS flow configuration, quiet mode, and an API key retrieved from CI secrets. ```bash npx --yes @devicecloud.dev/dcd@latest cloud sample.zip ios-flow.yaml --quiet --apiKey ${{ secrets.DEV_DCD_API_KEY }} ``` -------------------------------- ### Generate JUnit Report with DeviceCloud Source: https://docs.devicecloud.dev/reference/report-formats This command generates reports in JUnit format using the DeviceCloud CLI. Ensure the DeviceCloud CLI is installed and configured. ```bash dcdcloud...--reportjunit ``` -------------------------------- ### Manage Additional App Binaries Source: https://docs.devicecloud.dev/reference/app-management These commands demonstrate how to upload and reference multiple application binaries, including companion apps, for test execution. It supports uploading new files, using existing binary IDs, or a mix of both. ```bash # Upload multiple new apps dcdcloud--app-filemain.apk--additional-app-filescompanion.apkother.apk ``` ```bash # Use previously uploaded binaries dcdcloud--app-binary-idmain-id--additional-app-binary-idscompanion-idother-id ``` ```bash # Mix and match dcdcloud--app-filemain.apk--additional-app-binary-idscompanion-id ``` -------------------------------- ### Generate HTML Report with DeviceCloud Source: https://docs.devicecloud.dev/reference/report-formats This command generates reports in HTML format using the DeviceCloud CLI. Ensure the DeviceCloud CLI is installed and configured. ```bash dcdcloud...--reporthtml ``` -------------------------------- ### Use API Key via Command Line Source: https://docs.devicecloud.dev/getting-started/api-keys This snippet shows how to authenticate with DeviceCloud using an API key directly in the command line interface. ```bash dcdcloud --apiKey your-api-key-here ``` -------------------------------- ### Manage Application Binaries with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference Demonstrates how to manage application binaries for Maestro flow executions using the DeviceCloud CLI. This covers scenarios with multiple application files and using pre-registered binary IDs. ```bash dcd cloud --app-file main.apk --additional-app-files helper.apk ... ``` ```bash dcd cloud --app-binary-id abc123 ... ``` -------------------------------- ### Get Upload Status in JSON Format Source: https://docs.devicecloud.dev/ci-cd-integration/status-api This command retrieves the upload status and test results in JSON format, making it suitable for programmatic consumption. The `--json` flag enables this output. ```bash dcd status --apiKey --name "Upload 123" --json ``` -------------------------------- ### Override Device Locale for a Specific Test Source: https://docs.devicecloud.dev/reference/device-locale This example shows how to override the default device locale for a single test within your test configuration file (test.yaml) by setting the DEVICECLOUD_OVERRIDE_DEVICE_LCOALE environment variable. ```yaml # in your test.yaml appId:my.app env: DEVICECLOUD_OVERRIDE_DEVICE_LCOALE:de_DE --- # test steps ``` -------------------------------- ### Manage Application Binaries with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/test-execution Demonstrates how to manage application binaries for Maestro flow executions using the DeviceCloud CLI. This covers scenarios with multiple application files and using pre-registered binary IDs. ```bash dcd cloud --app-file main.apk --additional-app-files helper.apk ... ``` ```bash dcd cloud --app-binary-id abc123 ... ``` -------------------------------- ### Select Maestro Tests with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference Illustrates different methods for selecting Maestro tests to run via the DeviceCloud CLI. This includes running a single flow, a directory of flows, including specific tags, and excluding specific tags. ```bash dcd cloud ... --flows login.yaml ``` ```bash dcd cloud ... --flows smoke/ ``` ```bash dcd cloud ... --include-tags smoke,critical ``` ```bash dcd cloud ... --exclude-tags slow ``` -------------------------------- ### Select Maestro Tests with DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/test-execution Illustrates different methods for selecting Maestro tests to run via the DeviceCloud CLI. This includes running a single flow, a directory of flows, including specific tags, and excluding specific tags. ```bash dcd cloud ... --flows login.yaml ``` ```bash dcd cloud ... --flows smoke/ ``` ```bash dcd cloud ... --include-tags smoke,critical ``` ```bash dcd cloud ... --exclude-tags slow ``` -------------------------------- ### Extract App Binary ID using jq Source: https://docs.devicecloud.dev/ci-cd-integration/status-api This example demonstrates how to use the `jq` command-line JSON processor to extract specific information, such as the `appBinaryId`, from the JSON output of the DeviceCloud status command and store it in an environment variable. ```shell export APP_BINARY_ID=$(dcd status \ --api-key \ --name "Upload 123" \ --json \ | jq -r '.appBinaryId') echo $APP_BINARY_ID ``` -------------------------------- ### Set Device Locale via CLI Source: https://docs.devicecloud.dev/reference/device-locale This snippet demonstrates how to set the device locale for an entire upload using the DeviceCloud CLI. It shows a basic German locale setting and an example with specific device selection and a Japanese locale. ```bash # German dcdcloud...--device-localede_DE # With device selection dcdcloud...--android-devicepixel-6--device-localeja_JP ``` -------------------------------- ### DeviceCloud Environment Variables for Configuration Management Source: https://docs.devicecloud.dev/reference/environment-variables Illustrates using DeviceCloud environment variables to manage different configurations for development, staging, and production environments. This allows for easy switching between environments by changing the API URL. ```bash # Development dcdcloud-eAPI_URL=https://dev-api.example.com # Staging dcdcloud-eAPI_URL=https://staging-api.example.com # Production dcdcloud-eAPI_URL=https://api.example.com ``` -------------------------------- ### Specify Primary App Binary via File Upload Source: https://docs.devicecloud.dev/reference/app-management This command uploads a specified application binary file to DeviceCloud for use in flows. ```bash dcdcloud--app-file./path/to/your/app.apkflow.yaml ``` -------------------------------- ### GitHub Action for DeviceCloud Integration Source: https://docs.devicecloud.dev/ci-cd-integration/github-action This GitHub Action initiates a DeviceCloud run based on user-defined rules, such as triggering tests on every pull request or commit. It serves as a drop-in replacement for the official Maestro Cloud GitHub Action, requiring minimal configuration changes and an updated API key. ```YAML # Example GitHub Actions workflow snippet # Replace with your specific DeviceCloud Action details name: DeviceCloud Test Run on: [push, pull_request] jobs: devicecloud_test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Run DeviceCloud Tests uses: device-cloud/action@v1.0.0 # Replace with the actual DeviceCloud action path with: api_key: ${{ secrets.DEVICECLOUD_API_KEY }} # Add other necessary parameters like app_path, test_suite, etc. ``` -------------------------------- ### Execute Flows by Glob with DeviceCloud CLI Source: https://docs.devicecloud.dev/getting-started/executing-and-referencing-flows Execute flows matching a glob pattern using the DeviceCloud CLI. This utilizes the NPM glob module for path matching. Requires an API key and the application file. ```bash dcd cloud --apiKey ``` -------------------------------- ### Specify iOS Device with dcdcloud Source: https://docs.devicecloud.dev/getting-started/devices-configuration This command demonstrates how to choose a particular iOS device for testing using the `dcdcloud` tool. The `--ios-device` flag is used, followed by the device ID, the application archive, and the test configuration file. ```bash dcd cloud --ios-device ipad-pro-6th-gen app.zip test.yaml ``` -------------------------------- ### Enable DeviceCloud Quiet Mode Source: https://docs.devicecloud.dev/reference/quiet-mode This snippet demonstrates the basic command-line usage to enable DeviceCloud's quiet mode. Quiet mode reduces console output, making it suitable for CI/CD pipelines. ```bash dcdcloud-q # or dcdcloud--quiet ``` -------------------------------- ### Specify Android Device with dcdcloud Source: https://docs.devicecloud.dev/getting-started/devices-configuration This command shows how to select a specific Android device for testing using the `dcdcloud` tool. The `--android-device` flag is used, followed by the device ID, application package, and test configuration file. ```bash dcd cloud --android-device pixel-7 app.apk test.yaml ``` -------------------------------- ### Download All Artifacts using DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/download-artifacts This command downloads all artifacts generated during test execution for all test runs. It utilizes the dcdcloud command-line tool. ```bash dcdcloud ... --download-artifacts ALL ``` -------------------------------- ### Specify Primary App Binary via ID Source: https://docs.devicecloud.dev/reference/app-management This command references a previously uploaded application binary using its unique ID for use in flows. ```bash dcdcloud--app-binary-idabc123flow.yaml ``` -------------------------------- ### Configure DeviceCloud BitRise Step Variables Source: https://docs.devicecloud.dev/ci-cd-integration/bitrise This snippet explains how to configure the DeviceCloud integration step in BitRise by populating API keys and environment variables. It emphasizes matching these variables with the DCD CLI requirements. ```Text 1. Populate the API key using a BitRise secret and set any variables. These should exactly match the DCD CLI. ``` -------------------------------- ### Configure DeviceCloud CLI Output and Reporting Source: https://docs.devicecloud.dev/reference Details options for customizing the output of Maestro flow executions via the DeviceCloud CLI. This includes enabling quiet mode and generating specific report formats like JUnit. ```bash dcd cloud ... -q ``` ```bash dcd cloud ... --report junit ``` -------------------------------- ### Use API Key via Environment Variable Source: https://docs.devicecloud.dev/getting-started/api-keys This snippet demonstrates how to set the DeviceCloud API key as an environment variable for automatic use by the CLI. ```shell export DEVICE_CLOUD_API_KEY=your-api-key-here dcdcloud # Key will be automatically used ``` -------------------------------- ### Opt-in to Advanced Runner Type via CLI Source: https://docs.devicecloud.dev/reference/runner-type This snippet demonstrates how to opt-in to a non-default runner type, specifically 'm4', using the DeviceCloud CLI. This is useful for test scenarios that require more resources than the default runner provides. ```bash dcd cloud ... --runner-type=m4 ``` -------------------------------- ### Specify Android API Level with dcdcloud Source: https://docs.devicecloud.dev/getting-started/devices-configuration This command demonstrates how to use the `dcdcloud` tool to specify a particular Android API level for testing. It takes the API level as a flag, followed by the application package and test configuration file. ```bash dcdcloud --android-api-level 35 app.apk test.yaml ``` -------------------------------- ### Manage Retries and Environment Variables in DeviceCloud Source: https://docs.devicecloud.dev/reference Explains how to configure retry strategies for failed tests and set environment variables for Maestro flow executions using the DeviceCloud CLI. This is useful for handling test flakiness and configuring test environments. ```bash dcd cloud ... --retry 3 ``` ```bash dcd cloud ... -e API_URL=https://test-api.com ``` -------------------------------- ### Configure DeviceCloud CLI Output and Reporting Source: https://docs.devicecloud.dev/reference/test-execution Details options for customizing the output of Maestro flow executions via the DeviceCloud CLI. This includes enabling quiet mode and generating specific report formats like JUnit. ```bash dcd cloud ... -q ``` ```bash dcd cloud ... --report junit ``` -------------------------------- ### Set Multiple Environment Variables in DeviceCloud CLI Source: https://docs.devicecloud.dev/reference/environment-variables Shows how to set multiple environment variables simultaneously in the DeviceCloud CLI. This allows for configuring various aspects of the test environment, such as database hosts, users, passwords, and the environment type. ```bash dcdcloud-eDB_HOST=localhost \ -eDB_USER=test \ -eDB_PASS=password \ -eENVIRONMENT=staging ``` -------------------------------- ### Execute Single Flow with DeviceCloud CLI Source: https://docs.devicecloud.dev/getting-started/executing-and-referencing-flows Execute a single YAML flow file from the CLI. Requires an API key and the application file. The application file can be a .app, .zip, or .apk, and the flow file must be a .yaml or .yml. ```bash dcd cloud --apiKey ``` -------------------------------- ### Execute Maestro Flows Asynchronously with DeviceCloud Source: https://docs.devicecloud.dev/reference Shows how to run Maestro flows in asynchronous mode using the DeviceCloud CLI. This mode returns immediately, allowing the process to continue in the background, with results monitored on the dashboard. ```bash dcdcloud...--async--name"nightly" ```