# Conditions

An Actions can have one or more condition. You can use `AND` or  `OR` combinator for multiple conditions.

### Fields

#### File

Test filename path, for example `path/to/file.spec.ts`.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Test Title

Test title, for example in test definition `test("should open landing page")` it is `should open landing page`.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Test Title Path

Full title path as an array including named `describe` statements. See [testInfo.titlePath](https://playwright.dev/docs/api/class-testinfo#test-info-title-path). To match the following example:

```json
[
    "auth.spec.ts", // e.g. spec file name
    "Auth Controller", // e.g. test describe
    "Should login with correct credentials" // e.g. test title
]
```

Use a string list:  <i class="fa-box">:box:</i>`auth.spec.ts` <i class="fa-box">:box:</i>`Auth Controller` <i class="fa-box">:box:</i>`Should login with correct credentials`

| Field Type          | `string[]`                                                                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#many-to-many-operators">#many-to-many-operators</a></p>             |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Test ID

Playwright [test id](https://playwright.dev/docs/api/class-testinfo#test-info-test-id), matching the test case id in the [Reporter API](https://playwright.dev/docs/api/class-reporter).

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[]`                                                                                                                                          |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Tags

Test tag list. For example, if a test has the following list of tags `['a', 'b']`, each value in the list will be evaluated separately.

| Field Type          | `string[]`                                                                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[]`                                                                                                                                          |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#many-to-many-operators">#many-to-many-operators</a></p>             |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Project

Playwright project name as defined in your `playwright.config.ts`.&#x20;

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Error Message

{% hint style="info" %}
Added in `@currents/playwright@1.14.0`
{% endhint %}

Used to match a list field (eg Test Title Path) against one or more values.

Error message thrown during the test.&#x20;

| Field Type          | `string`                                                                                                                                        |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                          |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p> |
| Supported Actions   | [#post-test-actions](https://docs.currents.dev/guides/currents-actions/actions#post-test-actions "mention")                                     |

#### Git Author Email

Git commit author email. See [commit-information](https://docs.currents.dev/dashboard/runs/commit-information "mention") to explore how Currents collects git commit information.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Git Author Branch

Git commit author name. See [commit-information](https://docs.currents.dev/dashboard/runs/commit-information "mention") to explore how Currents collects git commit information.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Git Branch

Git commit branch name. See [commit-information](https://docs.currents.dev/dashboard/runs/commit-information "mention") to explore how Currents collects git commit information.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Git Message

Git commit message. See [commit-information](https://docs.currents.dev/dashboard/runs/commit-information "mention") to explore how Currents collects git commit information.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

#### Git Remote Origin

Git remote origin URL. See [commit-information](https://docs.currents.dev/dashboard/runs/commit-information "mention") to explore how Currents collects git commit information.

| Field Type          | `string`                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value Type          | `string \| string[] \| RegexPattern[]`                                                                                                                        |
| Supported Operators | <p><a data-mention href="#basic-operators">#basic-operators</a><br><a data-mention href="#one-to-many-operators">#one-to-many-operators</a></p>               |
| Supported Actions   | <p><a data-mention href="../actions#pre-test-actions">#pre-test-actions</a><br><a data-mention href="../actions#post-test-actions">#post-test-actions</a></p> |

### Operators

#### Basic operators

<table data-full-width="false"><thead><tr><th>Operator</th><th>Description</th></tr></thead><tbody><tr><td><code>is</code></td><td>value is equal or <code>RegexPattern</code> matches</td></tr><tr><td><code>is not</code></td><td>value is different or <code>RegexPattern</code> does not match</td></tr><tr><td><code>is any</code></td><td>field returns <code>true</code> for JS expression <code>!!value === true</code></td></tr><tr><td><code>is empty</code></td><td>field returns <code>false</code> for JS expression <code>!!value === true</code></td></tr></tbody></table>

#### One to Many operators

Used to match a single value field (eg Test Title), against a list of values.

<table data-full-width="false"><thead><tr><th>Operator</th><th>Description</th></tr></thead><tbody><tr><td><code>in</code></td><td>one of the values from the list matches</td></tr><tr><td><code>not in</code></td><td>none of the values in the list match</td></tr></tbody></table>

#### Many to Many operators

{% hint style="info" %}
Added in `@currents/playwright@1.10.0`
{% endhint %}

Used to match a list field (eg Test Title Path) against one or more values.

<table data-full-width="false"><thead><tr><th>Operator</th><th>Description</th></tr></thead><tbody><tr><td><code>includes</code></td><td>all of the values in the list can be found in the field</td></tr><tr><td><code>includes some</code></td><td>at least one of the values in the list can be found in the field</td></tr><tr><td><code>missing</code></td><td>all of the values in the list are missing from the field</td></tr><tr><td><code>missing any</code></td><td>any of the values in the list is missing from the field</td></tr></tbody></table>

### Examples

<table><thead><tr><th>Field</th><th width="139">Operator</th><th width="136">Value</th><th>Description</th></tr></thead><tbody><tr><td>Test Id</td><td>is</td><td>1234</td><td>id is exact match</td></tr><tr><td>Git Branch</td><td>not in</td><td>main,stable</td><td>no matches</td></tr><tr><td>Tags</td><td>includes</td><td>featureA</td><td>tag matches</td></tr><tr><td>Tags</td><td>includes some</td><td>featA,featB</td><td>at least one tag matches</td></tr><tr><td>Error Message</td><td>is</td><td>Int(er|ra)net Error:</td><td>Errror Message matches the RegexPattern</td></tr></tbody></table>
