> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# preflight/test-runner

Execute your PreFlight tests within your CircleCI build. 


## Commands

### run_test

Trigger your PreFlight tests with given paramaters.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `clientIdKey` | env_var_name | PF_CLIENT_ID | Variable name of PreFlight Client Id. |
| `clientSecretKey` | env_var_name | PF_CLIENT_SECRET | Variable name of PreFlight Client Secret. |
| `testId` | string |  | (optional) PreFlight test id. |
| `groupId` | string |  | (optional) PreFlight test group id. |
| `environmentId` | string |  | (optional) PreFlight environment id |
| `platforms` | string |  | (optional) Platform(s) and browser(s) you want to run your PreFlight test(s) |
| `sizes` | string |  | (optional) Size(s) you want to run your PreFlight test(s) |
| `tags` | string |  | (optional) Run tests that are tagged with the given tags |
| `captureScreenshots` | boolean | true | (optional) Capture screenshots enables taking screenhots of the each step. |
| `waitResults` | boolean | true | (optional) Wait PreFlight test result(s). If you set it as true, your CircleCI build waits your PreFlight test result(s). |

## Jobs

### run_a_test

Run a test.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `clientIdKey` | env_var_name | PF_CLIENT_ID | Variable name of PreFlight Client Id. |
| `clientSecretKey` | env_var_name | PF_CLIENT_SECRET | Variable name of PreFlight Client Secret. |
| `testId` | string |  | PreFlight test id. |
| `environmentId` | string |  | (optional) PreFlight environment id |
| `platforms` | string |  | (optional) Platform(s) and browser(s) you want to run your PreFlight test(s) |
| `sizes` | string |  | (optional) Size(s) you want to run your PreFlight test(s) |
| `captureScreenshots` | boolean | true | (optional) Capture screenshots enables taking screenhots of the each step. |
| `waitResults` | boolean | true | (optional) Wait PreFlight test result(s). If you set it as true, your CircleCI build waits your PreFlight test result(s). |

### run_group_test

Run group test.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `clientIdKey` | env_var_name | PF_CLIENT_ID | Variable name of PreFlight Client Id. |
| `clientSecretKey` | env_var_name | PF_CLIENT_SECRET | Variable name of PreFlight Client Secret. |
| `groupId` | string |  | PreFlight group id. |
| `environmentId` | string |  | (optional) PreFlight environment id |
| `platforms` | string |  | (optional) Platform(s) and browser(s) you want to run your PreFlight test(s) |
| `sizes` | string |  | (optional) Size(s) you want to run your PreFlight test(s) |
| `tags` | string |  | (optional) Run tests that are tagged with the given tags |
| `captureScreenshots` | boolean | true | (optional) Capture screenshots enables taking screenhots of the each step. |
| `waitResults` | boolean | true | (optional) Wait PreFlight test result(s). If you set it as true, your CircleCI build waits your PreFlight test result(s). |

### run_all_tests

Run all tests.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `clientIdKey` | env_var_name | PF_CLIENT_ID | Variable name of PreFlight Client Id. |
| `clientSecretKey` | env_var_name | PF_CLIENT_SECRET | Variable name of PreFlight Client Secret. |
| `environmentId` | string |  | (optional) PreFlight environment id |
| `platforms` | string |  | (optional) Platform(s) and browser(s) you want to run your PreFlight test(s) |
| `sizes` | string |  | (optional) Size(s) you want to run your PreFlight test(s) |
| `tags` | string |  | (optional) Run tests that are tagged with the given tags |
| `captureScreenshots` | boolean | true | (optional) Capture screenshots enables taking screenhots of the each step. |
| `waitResults` | boolean | true | (optional) Wait PreFlight test result(s). If you set it as true, your CircleCI build waits your PreFlight test result(s). |

## Examples

### run_a_test

Run a test, take screenshot of each step and wait result.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-a-test:
    jobs:
      - preflight/run_a_test:
          testId: <test-id>
          environmentId: ''
          platforms: ''
          sizes: ''
          captureScreenshots: true
          waitResults: true
```

### run_group_test

Run a group of tests, take screenshot of each step and wait results.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-group-test:
    jobs:
      - preflight/run_group_test:
          groupId: <group-id>
          environmentId: ''
          platforms: ''
          sizes: ''
          tags: ''
          captureScreenshots: true
          waitResults: true
```

### run_all_tests

Run all your PreFlight tests. While running tests take a screenshot of each step and wait for each result.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-all-tests:
    jobs:
      - preflight/run_all_tests:
          environmentId: ''
          platforms: ''
          sizes: ''
          tags: ''
          captureScreenshots: true
          waitResults: true
```

### filter_tests_with_tags

Run tests that are tagged with the given tags

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-all-tests:
    jobs:
      - preflight/run_all_tests:
          environmentId: ''
          platforms: ''
          sizes: ''
          tags: smoke tests,critical tests
          captureScreenshots: true
          waitResults: true
```

### across_different_environments

Run a test across your development environments.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-a-test:
    jobs:
      - preflight/run_a_test:
          testId: <test-id>
          environmentId: <environment-id>
          platforms: ''
          sizes: ''
          captureScreenshots: true
          waitResults: true
```

### across_different_browsers

Run a test across different browsers.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-a-test:
    jobs:
      - preflight/run_a_test:
          testId: <test-id>
          environmentId: ''
          platforms: win-ie,win-firefox
          sizes: ''
          captureScreenshots: true
          waitResults: true
```

### different_screen_sizes

Run a test at different screen sizes.

```yaml
version: 2.1
orbs:
  preflight: preflight/test-runner@1.0
workflows:
  run-a-test:
    jobs:
      - preflight/run_a_test:
          testId: <test-id>
          environmentId: ''
          platforms: ''
          sizes: 1920x1080,1440x900
          captureScreenshots: true
          waitResults: true
```