# Pilotfile Reference
Source: https://www.jetify.com/docs/docs/testpilot/pilotfile-reference

Complete reference for Testpilot pilot files. Learn the file format, configuration options, and test case structure.

```yaml theme={null}
name: "My Test Suite"
login_url: "https://example.com/login"
context:
  - text: "Additional context for all test cases"
cases:
  - id: "test-001"
    name: "Login Test"
    description: "Test user login functionality"
    # ... additional test case fields
```

## Root Level Fields[​](#root-level-fields "Direct link to Root Level Fields")

### name[​](#name "Direct link to name")

An optional string that provides a human-readable name for the test suite. If not specified,
Testpilot will derive the name from the filename.

```yaml theme={null}
name: "E-commerce Checkout Tests"
```

### login\_url[​](#login_url "Direct link to login_url")

An optional URL that specifies the login page for the application under test. When specified,
Testpilot will perform authentication before running test cases.

```yaml theme={null}
login_url: "https://myapp.com/auth/login"
```

### context[​](#context "Direct link to context")

An optional array of context objects that provide additional information to all test cases in the
plan. This context is inherited by all test cases and can be used to provide background information
or setup details.

```yaml theme={null}
context:
  - text: "This application requires users to be logged in"
  - text: "All tests assume a clean database state"
```

### cases[​](#cases "Direct link to cases")

An array of test case objects that define the individual tests to be executed. Each test case
represents a specific scenario or user journey to validate.

```yaml theme={null}
cases:
  - id: "checkout-001"
    name: "Complete Purchase"
    # ... test case configuration
```

## Test Case Fields[​](#test-case-fields "Direct link to Test Case Fields")

Each test case in the `cases` array supports the following fields:

### id (required)[​](#id-required "Direct link to id (required)")

A unique identifier for the test case. This ID is used internally by Testpilot to track and
reference test cases.

```yaml theme={null}
id: "login-success-001"
```

### name (required)[​](#name-required "Direct link to name (required)")

A human-readable name for the test case that describes what the test validates.

```yaml theme={null}
name: "Successful User Login"
```

### description (required)[​](#description-required "Direct link to description (required)")

A detailed description of what the test case does and what it validates. This helps with test
documentation and debugging.

```yaml theme={null}
description: "Verifies that a user can successfully log in with valid credentials"
```

### steps (required)[​](#steps-required "Direct link to steps (required)")

An array of strings that describe the steps to be performed during the test. Each step represents an
action or validation that should be performed.

```yaml theme={null}
steps:
  - "Navigate to the login page"
  - "Enter valid username and password"
  - "Click the login button"
  - "Verify successful login redirect"
```

### url[​](#url "Direct link to url")

The URL where the test case should begin execution. This is the starting point for the test.

```yaml theme={null}
url: "https://myapp.com/dashboard"
```

### viewports[​](#viewports "Direct link to viewports")

An array of viewport configurations that define the screen sizes at which the test should be
executed. This is useful for responsive testing across different device sizes.

```yaml theme={null}
viewports:
  - name: "Desktop"
    size: [1920, 1080]
  - name: "Tablet"
    size: [768, 1024]
  - name: "Mobile"
    size: [375, 667]
```

Each viewport object contains:

* `name`: A descriptive name for the viewport
* `size`: An array of two integers representing width and height in pixels

### context[​](#context-1 "Direct link to context")

Test case-specific context that provides additional information for this particular test. This is
merged with any root-level context.

```yaml theme={null}
context:
  - text: "This test requires a user with admin privileges"
  - text: "Database should contain sample product data"
```

### headers[​](#headers "Direct link to headers")

Custom HTTP headers to include in all browser requests for this test case. The
browser sends these headers with every request made during test execution.

```yaml theme={null}
headers:
  X-Custom-Header: "custom-value"
  Token: "Bearer ${MY_TOKEN}"
  User-Agent: "TestPilot/1.0 Custom Agent"
```

**Important**: custom headers are only supported for web testing with
Playwright. They're currently not available when testing mobile applications on
Android or iOS platforms.

### platform\_config[​](#platform_config "Direct link to platform_config")

Configuration for testing on different platforms (web, mobile, etc.). This allows you to specify
different entry points for different platforms.

```yaml theme={null}
platform_config:
  url: "https://web.myapp.com"
  android_pkg: "com.mycompany.myapp"
  ios_bundle: "com.mycompany.MyApp"
```

The platform configuration includes:

* `url`: The web URL for browser-based testing
* `android_pkg`: The Android package name for mobile app testing
* `ios_bundle`: The iOS bundle identifier for mobile app testing

## Context Objects[​](#context-objects "Direct link to Context Objects")

Context objects provide additional information that can be used by Testpilot during test execution.
Currently, only text-based context is supported.

```yaml theme={null}
context:
  - text: "User should have completed onboarding"
```

Each context object contains:

* `text`: A string containing contextual information

## File Formats[​](#file-formats "Direct link to File Formats")

Testpilot supports multiple file formats for pilot files:

### YAML Format (Recommended)[​](#yaml-format-recommended "Direct link to YAML Format (Recommended)")

```yaml theme={null}
name: "My Tests"
cases:
  - id: "test-001"
    name: "Sample Test"
    description: "A sample test case"
    steps:
      - "Step 1"
      - "Step 2"
```

### TOML Format[​](#toml-format "Direct link to TOML Format")

```toml theme={null}
name = "My Tests"

[[cases]]
id = "test-001"
name = "Sample Test"
description = "A sample test case"
steps = ["Step 1", "Step 2"]
```

### JSON Format[​](#json-format "Direct link to JSON Format")

```json theme={null}
{
  "name": "My Tests",
  "cases": [
    {
      "id": "test-001",
      "name": "Sample Test",
      "description": "A sample test case",
      "steps": ["Step 1", "Step 2"]
    }
  ]
}
```

## File Naming Conventions[​](#file-naming-conventions "Direct link to File Naming Conventions")

Testpilot recognizes pilot files with the following naming patterns:

* `*.pilot` - Basic pilot file
* `*.pilot.yaml` - YAML format pilot file
* `*.pilot.yml` - YAML format pilot file (alternative extension)
* `*.pilot.toml` - TOML format pilot file
* `*.pilot.json` - JSON format pilot file

## Remote Files[​](#remote-files "Direct link to Remote Files")

Testpilot can load pilot files from remote URLs, including GitHub repositories. When using GitHub
URLs, you can optionally set the `GITHUB_TOKEN` environment variable for authentication.

```bash theme={null}