Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags docs #2292

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions docs/cli-commands/test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,53 @@ To delay app uninstallation for 5 seconds after the test finishes:
patrol test --target integration_test/app_test.dart --wait 5
```

#### Tags

You can use tags to run only tests with specific tags.

First specify tags in your patrol tests:

```dart
patrol(
'example test with tag',
tags: ['android'],
($) async {
await createApp($);

await $(FloatingActionButton).tap();
expect($(#counterText).text, '1');
},
);

patrol(
'example test with two tags',
tags: ['android', 'ios'],
($) async {
await createApp($);

await $(FloatingActionButton).tap();
expect($(#counterText).text, '1');
},
);
```

Then you can run tests with the tags you specified:

```bash
patrol test --tags android
patrol test --tags=android
patrol test --tags='android||ios'
patrol test --tags='(android || ios)'
patrol test --tags='(android && tablet)'
```

You can also use `--exclude-tags` to exclude tests with specific tags:

```bash
patrol test --exclude-tags android
patrol test --exclude-tags='(android||ios)'
```

### Under the hood

`patrol test` basically calls `patrol build` and then runs the built app
Expand Down
Loading