From 45bc7c0433e169b5de250fe3dc730fcc9406fc90 Mon Sep 17 00:00:00 2001 From: pdenert Date: Tue, 6 Aug 2024 15:29:53 +0200 Subject: [PATCH 1/2] Add tags docs --- docs/cli-commands/test.mdx | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/cli-commands/test.mdx b/docs/cli-commands/test.mdx index 9acd4f41c..579688346 100644 --- a/docs/cli-commands/test.mdx +++ b/docs/cli-commands/test.mdx @@ -63,6 +63,52 @@ 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. To run tests with the tag you specify, +tags in 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 From e55cc86081e20d93b2c12d838006eb7fc0dc5f53 Mon Sep 17 00:00:00 2001 From: pdenert Date: Tue, 6 Aug 2024 15:32:11 +0200 Subject: [PATCH 2/2] Update docs --- docs/cli-commands/test.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/cli-commands/test.mdx b/docs/cli-commands/test.mdx index 579688346..bd7e355c6 100644 --- a/docs/cli-commands/test.mdx +++ b/docs/cli-commands/test.mdx @@ -65,8 +65,9 @@ patrol test --target integration_test/app_test.dart --wait 5 #### Tags -You can use tags to run only tests with specific tags. To run tests with the tag you specify, -tags in tests: +You can use tags to run only tests with specific tags. + +First specify tags in your patrol tests: ```dart patrol(