Skip to content

Conversation

@fylyppo
Copy link

@fylyppo fylyppo commented Dec 23, 2025

patrol-bs: BrowserStack Integration CLI for Patrol

Summary

A unified CLI tool for running Patrol tests on BrowserStack. Handles the complete workflow: building tests, uploading to BrowserStack, scheduling test execution, and downloading results.

Features

  • patrol-bs android - Build, upload, and run Android tests on BrowserStack. Outputs build ID.
  • patrol-bs ios - Build, upload, and run iOS tests on BrowserStack. Outputs build ID.
  • patrol-bs outputs <build_id> - Download test artifacts (logs, videos, reports) using build ID from above commands.

Key Capabilities

  • Patrol enabled - Sets required parameters to run Patrol tests on BrowserStack
  • 📦 Flexible configuration - Environment variables (PATROL_BS_*) or CLI arguments
  • ⚙️ Extensible - Pass any BrowserStack API parameter
  • 📊 Rich output - Colored status messages, dashboard links, downloadable artifacts

Usage Examples

# Run Android tests
patrol-bs android --credentials user:key --devices '["Google Pixel 8-14.0"]'

# Run iOS tests with flavor and patrol CLI argument
patrol-bs ios --flavor dev -t patrol_test/sign_up_patrol.dart

# Download results
patrol-bs outputs <build_id> --credentials user:key

# Pipeline usage
BUILD_ID=$(patrol-bs android --credentials "$BS_CREDS" 2>/dev/null | tail -1)
patrol-bs outputs "$BUILD_ID" --credentials "$BS_CREDS"

Configuration

Environment Variables

Variable Description
PATROL_BS_CREDENTIALS BrowserStack credentials (username:access_key)
PATROL_BS_ANDROID_DEVICES Default Android devices JSON array
PATROL_BS_IOS_DEVICES Default iOS devices JSON array
PATROL_BS_ANDROID_API_PARAMS Android API parameters (JSON)
PATROL_BS_IOS_API_PARAMS iOS API parameters (JSON)

CLI Options

Option Description
--credentials <user:key> BrowserStack credentials
--devices <json> Devices to test on (JSON array)
--flavor <name> Build flavor
--skip-build Skip building, only upload and schedule
--api-params <json> Additional BrowserStack API parameters
-- <patrol_args> Arguments for patrol build

Dependencies

  • bash (4.0+)
  • curl
  • jq
  • zip
  • plutil (macOS, for iOS builds)
  • patrol CLI

@fylyppo
Copy link
Author

fylyppo commented Dec 24, 2025

We should consider moving (and rewrite?) this CLI to a different location. Options I see:

  1. Separate repo (e.g., patrol-bs or patrol-browserstack)
  • ➕ Independent versioning and releases
  • ➕ Clear separation of concerns
  • ➕ Easier for external contributors
  • ➖ Another repo to maintain
  1. Part of patrol repo
  • ➕ Single source of truth for Patrol tooling
  • ➕ Versioned alongside patrol CLI
  • ➕ Discoverable by existing Patrol users
  • ➖ Adds bash scripts to a Dart project
  • ➖ May not fit patrol's scope (patrol focuses on the testing framework, not CI integrations)
  1. Standalone package in pub.dev (rewritten in Dart)
  • ➕ Consistent with patrol ecosystem
  • ➕ Cross-platform without bash dependencies
  • ➖ Significant rewrite effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants