From 5fe120aa6d7522bfdd3fe905db5111858328bb0c Mon Sep 17 00:00:00 2001 From: pdenert Date: Thu, 1 Aug 2024 17:28:14 +0200 Subject: [PATCH 1/9] Add tags support --- dev/e2e_app/integration_test/common.dart | 2 ++ .../integration_test/example_test.dart | 23 +++++++++++++ dev/e2e_app/pubspec.lock | 2 +- .../pl/leancode/patrol/contracts/Contracts.kt | 3 +- .../Classes/AutomatorServer/Contracts.swift | 1 + packages/patrol/lib/src/common.dart | 25 +++++++++----- .../lib/src/native/contracts/contracts.dart | 3 ++ .../lib/src/native/contracts/contracts.g.dart | 2 ++ packages/patrol/pubspec.yaml | 2 +- packages/patrol/test/internals_test.dart | 33 ++++++++++++++++--- .../patrol_cli/lib/src/base/constants.dart | 2 +- .../lib/src/commands/build_android.dart | 4 ++- .../lib/src/commands/build_ios.dart | 4 ++- .../lib/src/commands/build_macos.dart | 4 ++- .../patrol_cli/lib/src/commands/develop.dart | 1 + .../patrol_cli/lib/src/commands/test.dart | 5 ++- .../lib/src/runner/patrol_command.dart | 8 +++++ packages/patrol_cli/lib/src/test_bundler.dart | 5 +-- packages/patrol_cli/pubspec.yaml | 2 +- .../patrol_cli/test/test_bundler_test.dart | 2 +- .../lib/api/contracts.dart | 3 ++ .../lib/api/contracts.g.dart | 2 ++ schema.dart | 1 + 23 files changed, 114 insertions(+), 25 deletions(-) diff --git a/dev/e2e_app/integration_test/common.dart b/dev/e2e_app/integration_test/common.dart index 2037e4007..15d43c7a2 100644 --- a/dev/e2e_app/integration_test/common.dart +++ b/dev/e2e_app/integration_test/common.dart @@ -19,6 +19,7 @@ void patrol( String description, Future Function(PatrolIntegrationTester) callback, { bool? skip, + List tags = const [], NativeAutomatorConfig? nativeAutomatorConfig, LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers, @@ -30,5 +31,6 @@ void patrol( framePolicy: framePolicy, skip: skip, callback, + tags: tags, ); } diff --git a/dev/e2e_app/integration_test/example_test.dart b/dev/e2e_app/integration_test/example_test.dart index 4698a854c..df88419e5 100644 --- a/dev/e2e_app/integration_test/example_test.dart +++ b/dev/e2e_app/integration_test/example_test.dart @@ -29,4 +29,27 @@ void main() { expect($('Hello, Flutter!'), findsOneWidget); }, ); + + patrol( + 'counter state is the same after going to Home and switching apps with tag', + tags: ['smoke'], + ($) async { + await createApp($); + + await $(FloatingActionButton).tap(); + expect($(#counterText).text, '1'); + + await $(#textField).enterText('Hello, Flutter!'); + expect($('Hello, Flutter!'), findsOneWidget); + + await $.native.pressHome(); + await $.native.openApp(); + + expect($(#counterText).text, '1'); + await $(FloatingActionButton).tap(); + + expect($(#counterText).text, '2'); + expect($('Hello, Flutter!'), findsOneWidget); + }, + ); } diff --git a/dev/e2e_app/pubspec.lock b/dev/e2e_app/pubspec.lock index 14644de4f..4ec538357 100644 --- a/dev/e2e_app/pubspec.lock +++ b/dev/e2e_app/pubspec.lock @@ -446,7 +446,7 @@ packages: path: "../../packages/patrol" relative: true source: path - version: "3.9.0" + version: "3.10.0" patrol_finders: dependency: transitive description: diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.kt index 2cf87d080..ada5e6b1d 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.kt @@ -123,7 +123,8 @@ class Contracts { val name: String, val type: GroupEntryType, val entries: List, - val skip: Boolean + val skip: Boolean, + val tags: List ) data class ListDartTestsResponse ( diff --git a/packages/patrol/darwin/Classes/AutomatorServer/Contracts.swift b/packages/patrol/darwin/Classes/AutomatorServer/Contracts.swift index 81fc1567a..d5c56f1eb 100644 --- a/packages/patrol/darwin/Classes/AutomatorServer/Contracts.swift +++ b/packages/patrol/darwin/Classes/AutomatorServer/Contracts.swift @@ -123,6 +123,7 @@ public struct DartGroupEntry: Codable { public var type: GroupEntryType public var entries: [DartGroupEntry] public var skip: Bool + public var tags: [String] } public struct ListDartTestsResponse: Codable { diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 551e1b64c..ed255c2d5 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -169,12 +169,14 @@ DartGroupEntry createDartTestGroup( String name = '', int level = 0, int maxTestCaseLength = global_state.maxTestLength, + List tags = const [], }) { final groupDTO = DartGroupEntry( name: name, type: GroupEntryType.group, entries: [], skip: parentGroup.metadata.skip, + tags: parentGroup.metadata.tags.toList(), ); for (final entry in parentGroup.entries) { @@ -203,14 +205,20 @@ DartGroupEntry createDartTestGroup( throw StateError('Test is not allowed to be defined at level $level'); } - groupDTO.entries.add( - DartGroupEntry( - name: name, - type: GroupEntryType.test, - entries: [], - skip: entry.metadata.skip, - ), - ); + final addTest = tags.isEmpty || tags.any(entry.metadata.tags.contains); + + if (addTest) { + groupDTO.entries.add( + DartGroupEntry( + name: name, + type: GroupEntryType.test, + entries: [], + skip: entry.metadata.skip, + tags: entry.metadata.tags.toList(), + ), + ); + } + case Group _: groupDTO.entries.add( createDartTestGroup( @@ -218,6 +226,7 @@ DartGroupEntry createDartTestGroup( name: name, level: level + 1, maxTestCaseLength: maxTestCaseLength, + tags: tags, ), ); } diff --git a/packages/patrol/lib/src/native/contracts/contracts.dart b/packages/patrol/lib/src/native/contracts/contracts.dart index 6142c8e25..d7bc9649b 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.dart @@ -224,6 +224,7 @@ class DartGroupEntry with EquatableMixin { required this.type, required this.entries, required this.skip, + required this.tags, }); factory DartGroupEntry.fromJson(Map json) => @@ -233,6 +234,7 @@ class DartGroupEntry with EquatableMixin { final GroupEntryType type; final List entries; final bool skip; + final List tags; Map toJson() => _$DartGroupEntryToJson(this); @@ -242,6 +244,7 @@ class DartGroupEntry with EquatableMixin { type, entries, skip, + tags, ]; } diff --git a/packages/patrol/lib/src/native/contracts/contracts.g.dart b/packages/patrol/lib/src/native/contracts/contracts.g.dart index e94d108d7..43928232c 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.g.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.g.dart @@ -14,6 +14,7 @@ DartGroupEntry _$DartGroupEntryFromJson(Map json) => .map((e) => DartGroupEntry.fromJson(e as Map)) .toList(), skip: json['skip'] as bool, + tags: (json['tags'] as List).map((e) => e as String).toList(), ); Map _$DartGroupEntryToJson(DartGroupEntry instance) => @@ -22,6 +23,7 @@ Map _$DartGroupEntryToJson(DartGroupEntry instance) => 'type': _$GroupEntryTypeEnumMap[instance.type]!, 'entries': instance.entries, 'skip': instance.skip, + 'tags': instance.tags, }; const _$GroupEntryTypeEnumMap = { diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index 68cbc6d71..e605b8812 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -2,7 +2,7 @@ name: patrol description: > Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action! -version: 3.9.0 +version: 3.10.0 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol issue_tracker: https://github.com/leancodepl/patrol/issues diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index cadda704f..41d65c28b 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -63,16 +63,19 @@ void main() { name: '', type: GroupEntryType.group, skip: false, + tags: [], entries: [ DartGroupEntry( name: 'example_test', type: GroupEntryType.group, skip: false, + tags: [], entries: [ DartGroupEntry( name: 'alpha', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('first'), _testEntry('second'), @@ -82,6 +85,7 @@ void main() { name: 'bravo', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('first'), _testEntry('second'), @@ -93,6 +97,7 @@ void main() { name: 'open_app_test', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('open maps'), _testEntry('open browser'), @@ -137,17 +142,20 @@ void main() { name: '', type: GroupEntryType.group, skip: false, + tags: [], entries: [ DartGroupEntry( name: 'example_test', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('alpha'), DartGroupEntry( name: 'bravo', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('first'), _testEntry('second'), @@ -158,6 +166,7 @@ void main() { name: 'delta', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('first'), _testEntry('second'), @@ -199,11 +208,13 @@ void main() { name: '', type: GroupEntryType.group, skip: false, + tags: [], entries: [ DartGroupEntry( name: 'example_test', type: GroupEntryType.group, skip: false, + tags: [], entries: [ _testEntry('alpha'), _testEntry('zielony'), @@ -234,7 +245,7 @@ void main() { }); group('skip group of tests', () { - test('skip test', () { + test('skip test param should be passed in DartGroupEntry', () { // given final topLevelGroup = Group.root([ LocalTest('patrol_test_explorer', Metadata.empty, () {}), @@ -267,41 +278,53 @@ void main() { DartGroupEntry( name: '', type: GroupEntryType.group, + skip: false, + tags: [], entries: [ DartGroupEntry( name: 'example_test', type: GroupEntryType.group, + skip: true, + tags: [], entries: [ _testEntry('alpha'), ], - skip: true, ), DartGroupEntry( name: 'example2_test', type: GroupEntryType.group, + skip: false, + tags: [], entries: [ _testEntry('alpha'), _testEntry('bravo first'), _testEntry('bravo second'), ], - skip: false, ), ], - skip: false, ), ), ); }); }); + + // group('test with tags', () { + // final topLevelGroup + // }) } LocalTest _localTest(String name) => LocalTest(name, Metadata.empty, () {}); -DartGroupEntry _testEntry(String name, {bool skip = false}) { +DartGroupEntry _testEntry( + String name, { + bool skip = false, + List tags = const [], +}) { return DartGroupEntry( name: name, type: GroupEntryType.test, entries: [], skip: skip, + tags: tags, ); } diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index 1604a0509..8b9d37db2 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '3.0.1'; +const version = '3.0.2'; diff --git a/packages/patrol_cli/lib/src/commands/build_android.dart b/packages/patrol_cli/lib/src/commands/build_android.dart index e834f8790..d468100ed 100644 --- a/packages/patrol_cli/lib/src/commands/build_android.dart +++ b/packages/patrol_cli/lib/src/commands/build_android.dart @@ -36,6 +36,7 @@ class BuildAndroidCommand extends PatrolCommand { usesLabelOption(); usesWaitOption(); usesPortOptions(); + usesTagsOption(); usesAndroidOptions(); } @@ -83,9 +84,10 @@ class BuildAndroidCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } + final tags = stringsArg('tags'); final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets); + _testBundler.createTestBundle(targets, tags); } final flavor = stringArg('flavor') ?? config.android.flavor; diff --git a/packages/patrol_cli/lib/src/commands/build_ios.dart b/packages/patrol_cli/lib/src/commands/build_ios.dart index 05b6cc0da..bf41c766f 100644 --- a/packages/patrol_cli/lib/src/commands/build_ios.dart +++ b/packages/patrol_cli/lib/src/commands/build_ios.dart @@ -36,6 +36,7 @@ class BuildIOSCommand extends PatrolCommand { usesLabelOption(); usesWaitOption(); usesPortOptions(); + usesTagsOption(); usesIOSOptions(); argParser.addFlag( @@ -87,9 +88,10 @@ class BuildIOSCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } + final tags = stringsArg('tags'); final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets); + _testBundler.createTestBundle(targets, tags); } final flavor = stringArg('flavor') ?? config.ios.flavor; diff --git a/packages/patrol_cli/lib/src/commands/build_macos.dart b/packages/patrol_cli/lib/src/commands/build_macos.dart index cb5c421c1..1bcbf0d64 100644 --- a/packages/patrol_cli/lib/src/commands/build_macos.dart +++ b/packages/patrol_cli/lib/src/commands/build_macos.dart @@ -36,6 +36,7 @@ class BuildMacOSCommand extends PatrolCommand { usesLabelOption(); usesWaitOption(); usesPortOptions(); + usesTagsOption(); usesMacOSOptions(); } @@ -83,9 +84,10 @@ class BuildMacOSCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } + final tags = stringsArg('tags'); final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets); + _testBundler.createTestBundle(targets, tags); } final flavor = stringArg('flavor') ?? config.ios.flavor; diff --git a/packages/patrol_cli/lib/src/commands/develop.dart b/packages/patrol_cli/lib/src/commands/develop.dart index d9e1effd8..27396b136 100644 --- a/packages/patrol_cli/lib/src/commands/develop.dart +++ b/packages/patrol_cli/lib/src/commands/develop.dart @@ -53,6 +53,7 @@ class DevelopCommand extends PatrolCommand { usesLabelOption(); usesWaitOption(); usesPortOptions(); + usesTagsOption(); usesUninstallOption(); diff --git a/packages/patrol_cli/lib/src/commands/test.dart b/packages/patrol_cli/lib/src/commands/test.dart index 6e69aad6e..10589ee07 100644 --- a/packages/patrol_cli/lib/src/commands/test.dart +++ b/packages/patrol_cli/lib/src/commands/test.dart @@ -49,6 +49,7 @@ class TestCommand extends PatrolCommand { usesLabelOption(); usesWaitOption(); usesPortOptions(); + usesTagsOption(); usesUninstallOption(); @@ -100,9 +101,11 @@ class TestCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } + final tags = stringsArg('tags'); + _logger.detail('Received ${tags.length} tag(s)'); final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets); + _testBundler.createTestBundle(targets, tags); } final androidFlavor = stringArg('flavor') ?? config.android.flavor; diff --git a/packages/patrol_cli/lib/src/runner/patrol_command.dart b/packages/patrol_cli/lib/src/runner/patrol_command.dart index c03b6808c..32ffb7865 100644 --- a/packages/patrol_cli/lib/src/runner/patrol_command.dart +++ b/packages/patrol_cli/lib/src/runner/patrol_command.dart @@ -131,6 +131,14 @@ abstract class PatrolCommand extends Command { ); } + void usesTagsOption() { + argParser.addMultiOption( + 'tags', + help: 'Tags to filter the tests by.', + valueHelp: 'smoke,regression', + ); + } + void usesAndroidOptions() { argParser.addOption( 'package-name', diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index bc8674c7a..083849b3f 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -15,7 +15,7 @@ class TestBundler { final Logger _logger; /// Creates an entrypoint for use with `patrol test` and `patrol build`. - void createTestBundle(List testFilePaths) { + void createTestBundle(List testFilePaths, List tags) { if (testFilePaths.isEmpty) { throw ArgumentError('testFilePaths must not be empty'); } @@ -82,7 +82,8 @@ Future main() async { // Maybe somewhat counterintuitively, this callback runs *after* the calls // to group() below. final topLevelGroup = Invoker.current!.liveTest.groups.first; - final dartTestGroup = createDartTestGroup(topLevelGroup); + final dartTestGroup = createDartTestGroup(topLevelGroup, tags: [${tags.map((tag) => '"$tag"').join(', ')}]); + // final dartTestGroup = createDartTestGroup(topLevelGroup); testExplorationCompleter.complete(dartTestGroup); print('patrol_test_explorer: obtained Dart-side test hierarchy:'); printGroupStructure(dartTestGroup); diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index f8ced06dd..e287dc973 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 3.0.1 # Must be kept in sync with constants.dart +version: 3.0.2 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22 diff --git a/packages/patrol_cli/test/test_bundler_test.dart b/packages/patrol_cli/test/test_bundler_test.dart index 8033e393e..585227b12 100644 --- a/packages/patrol_cli/test/test_bundler_test.dart +++ b/packages/patrol_cli/test/test_bundler_test.dart @@ -40,7 +40,7 @@ void _test(Platform platform) { }); test('throws ArgumentError when no tests are given', () { - expect(() => testBundler.createTestBundle([]), throwsArgumentError); + expect(() => testBundler.createTestBundle([], []), throwsArgumentError); }); test('generates imports from relative paths', () { diff --git a/packages/patrol_devtools_extension/lib/api/contracts.dart b/packages/patrol_devtools_extension/lib/api/contracts.dart index 6142c8e25..d7bc9649b 100644 --- a/packages/patrol_devtools_extension/lib/api/contracts.dart +++ b/packages/patrol_devtools_extension/lib/api/contracts.dart @@ -224,6 +224,7 @@ class DartGroupEntry with EquatableMixin { required this.type, required this.entries, required this.skip, + required this.tags, }); factory DartGroupEntry.fromJson(Map json) => @@ -233,6 +234,7 @@ class DartGroupEntry with EquatableMixin { final GroupEntryType type; final List entries; final bool skip; + final List tags; Map toJson() => _$DartGroupEntryToJson(this); @@ -242,6 +244,7 @@ class DartGroupEntry with EquatableMixin { type, entries, skip, + tags, ]; } diff --git a/packages/patrol_devtools_extension/lib/api/contracts.g.dart b/packages/patrol_devtools_extension/lib/api/contracts.g.dart index e94d108d7..43928232c 100644 --- a/packages/patrol_devtools_extension/lib/api/contracts.g.dart +++ b/packages/patrol_devtools_extension/lib/api/contracts.g.dart @@ -14,6 +14,7 @@ DartGroupEntry _$DartGroupEntryFromJson(Map json) => .map((e) => DartGroupEntry.fromJson(e as Map)) .toList(), skip: json['skip'] as bool, + tags: (json['tags'] as List).map((e) => e as String).toList(), ); Map _$DartGroupEntryToJson(DartGroupEntry instance) => @@ -22,6 +23,7 @@ Map _$DartGroupEntryToJson(DartGroupEntry instance) => 'type': _$GroupEntryTypeEnumMap[instance.type]!, 'entries': instance.entries, 'skip': instance.skip, + 'tags': instance.tags, }; const _$GroupEntryTypeEnumMap = { diff --git a/schema.dart b/schema.dart index 2e4f8305c..681c9acd5 100644 --- a/schema.dart +++ b/schema.dart @@ -12,6 +12,7 @@ class DartGroupEntry { late GroupEntryType type; late List entries; late bool skip; + late List tags; } enum GroupEntryType { group, test } From 287abaa613480f55cd832d8c5badeea1f08a67f7 Mon Sep 17 00:00:00 2001 From: pdenert Date: Fri, 2 Aug 2024 15:32:00 +0200 Subject: [PATCH 2/9] Add exclude-tags Use BooleanSelector --- .../integration_test/example_test.dart | 22 +- packages/patrol/lib/src/common.dart | 43 +++- packages/patrol/pubspec.yaml | 1 + packages/patrol/test/internals_test.dart | 228 +++++++++++++++++- .../lib/src/commands/build_android.dart | 11 +- .../lib/src/commands/build_ios.dart | 11 +- .../lib/src/commands/build_macos.dart | 11 +- .../patrol_cli/lib/src/commands/test.dart | 13 +- .../lib/src/runner/patrol_command.dart | 12 +- packages/patrol_cli/lib/src/test_bundler.dart | 12 +- .../patrol_cli/test/test_bundler_test.dart | 9 +- 11 files changed, 332 insertions(+), 41 deletions(-) diff --git a/dev/e2e_app/integration_test/example_test.dart b/dev/e2e_app/integration_test/example_test.dart index df88419e5..096142ad0 100644 --- a/dev/e2e_app/integration_test/example_test.dart +++ b/dev/e2e_app/integration_test/example_test.dart @@ -31,24 +31,28 @@ void main() { ); patrol( - 'counter state is the same after going to Home and switching apps with tag', - tags: ['smoke'], + 'short test with two tags', + tags: ['smoke', 'fume'], ($) async { await createApp($); await $(FloatingActionButton).tap(); expect($(#counterText).text, '1'); + await $(FloatingActionButton).tap(); + expect($(#counterText).text, '2'); + }, + ); - await $(#textField).enterText('Hello, Flutter!'); - expect($('Hello, Flutter!'), findsOneWidget); - - await $.native.pressHome(); - await $.native.openApp(); + patrol( + 'short test with tag', + tags: ['smoke'], + ($) async { + await createApp($); - expect($(#counterText).text, '1'); await $(FloatingActionButton).tap(); + expect($(#counterText).text, '1'); - expect($(#counterText).text, '2'); + await $(#textField).enterText('Hello, Flutter!'); expect($('Hello, Flutter!'), findsOneWidget); }, ); diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index ed255c2d5..8589b01b5 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -1,5 +1,6 @@ import 'dart:io' as io; +import 'package:boolean_selector/boolean_selector.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:meta/meta.dart'; @@ -169,7 +170,8 @@ DartGroupEntry createDartTestGroup( String name = '', int level = 0, int maxTestCaseLength = global_state.maxTestLength, - List tags = const [], + String? tags, + String? excludeTags, }) { final groupDTO = DartGroupEntry( name: name, @@ -205,20 +207,34 @@ DartGroupEntry createDartTestGroup( throw StateError('Test is not allowed to be defined at level $level'); } - final addTest = tags.isEmpty || tags.any(entry.metadata.tags.contains); - - if (addTest) { - groupDTO.entries.add( - DartGroupEntry( - name: name, - type: GroupEntryType.test, - entries: [], - skip: entry.metadata.skip, - tags: entry.metadata.tags.toList(), - ), - ); + if (tags != null) { + final includeTagsSelector = BooleanSelector.parse(tags); + + // If the user provided tags, skip tests that don't match all of them. + if (!includeTagsSelector.evaluate(entry.metadata.tags.contains)) { + continue; + } + } + + if (excludeTags != null) { + final excludeTagsSelector = BooleanSelector.parse(excludeTags); + + // Skip tests that do match any tags the user wants to exclude. + if (excludeTagsSelector.evaluate(entry.metadata.tags.contains)) { + continue; + } } + groupDTO.entries.add( + DartGroupEntry( + name: name, + type: GroupEntryType.test, + entries: [], + skip: entry.metadata.skip, + tags: entry.metadata.tags.toList(), + ), + ); + case Group _: groupDTO.entries.add( createDartTestGroup( @@ -227,6 +243,7 @@ DartGroupEntry createDartTestGroup( level: level + 1, maxTestCaseLength: maxTestCaseLength, tags: tags, + excludeTags: excludeTags, ), ); } diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index e605b8812..ce18cab07 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -17,6 +17,7 @@ environment: flutter: '>=3.22.0' dependencies: + boolean_selector: ^2.1.1 equatable: ^2.0.5 flutter: sdk: flutter diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index 41d65c28b..e6558ad3d 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -3,6 +3,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:patrol/src/common.dart' show createDartTestGroup, deduplicateGroupEntryName; import 'package:patrol/src/native/contracts/contracts.dart'; +import 'package:test_api/backend.dart'; import 'package:test_api/src/backend/group.dart'; import 'package:test_api/src/backend/invoker.dart' show LocalTest; import 'package:test_api/src/backend/metadata.dart'; @@ -308,12 +309,231 @@ void main() { }); }); - // group('test with tags', () { - // final topLevelGroup - // }) + group('test with tags', () { + test('filter test, when tags are null', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + Group( + 'example_test', + [ + _localTest( + 'example_test alpha', + metadata: Metadata(tags: ['tag1']), + ), + _localTest( + 'example_test bravo first', + metadata: Metadata(tags: ['tag2']), + ), + _localTest( + 'example_test bravo second', + metadata: Metadata(tags: ['tag3']), + ), + ], + ), + ]); + + // when + final dartTestGroup = createDartTestGroup( + topLevelGroup, + ); + + // then + expect( + dartTestGroup, + equals( + DartGroupEntry( + name: '', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + DartGroupEntry( + name: 'example_test', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + _testEntry('alpha', tags: ['tag1']), + _testEntry('bravo first', tags: ['tag2']), + _testEntry('bravo second', tags: ['tag3']), + ], + ), + ], + ), + ), + ); + }); + + test('filter included tags', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + Group( + 'example_test', + [ + _localTest( + 'example_test alpha', + metadata: Metadata(tags: ['tag1']), + ), + _localTest( + 'example_test bravo first', + metadata: Metadata(tags: ['tag2']), + ), + _localTest( + 'example_test bravo second', + metadata: Metadata(tags: ['tag3']), + ), + ], + ), + ]); + + // when + final dartTestGroup = createDartTestGroup( + topLevelGroup, + tags: 'tag1', + ); + + // then + expect( + dartTestGroup, + equals( + DartGroupEntry( + name: '', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + DartGroupEntry( + name: 'example_test', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + _testEntry('alpha', tags: ['tag1']), + ], + ), + ], + ), + ), + ); + }); + + test('filter excluded tags', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + Group( + 'example_test', + [ + _localTest( + 'example_test alpha', + metadata: Metadata(tags: ['tag1']), + ), + _localTest( + 'example_test bravo first', + metadata: Metadata(tags: ['tag2']), + ), + _localTest( + 'example_test bravo second', + metadata: Metadata(tags: ['tag3']), + ), + ], + ), + ]); + + // when + final dartTestGroup = createDartTestGroup( + topLevelGroup, + excludeTags: 'tag1', + ); + + // then + expect( + dartTestGroup, + equals( + DartGroupEntry( + name: '', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + DartGroupEntry( + name: 'example_test', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + _testEntry('bravo first', tags: ['tag2']), + _testEntry('bravo second', tags: ['tag3']), + ], + ), + ], + ), + ), + ); + }); + + test('filter included and excluded tags', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + Group( + 'example_test', + [ + _localTest( + 'example_test alpha', + metadata: Metadata(tags: ['tag1']), + ), + _localTest( + 'example_test bravo first', + metadata: Metadata(tags: ['tag1', 'tag2']), + ), + _localTest( + 'example_test bravo second', + metadata: Metadata(tags: ['tag3']), + ), + ], + ), + ]); + + // when + final dartTestGroup = createDartTestGroup( + topLevelGroup, + tags: 'tag1 || tag3', + excludeTags: 'tag2', + ); + + // then + expect( + dartTestGroup, + equals( + DartGroupEntry( + name: '', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + DartGroupEntry( + name: 'example_test', + type: GroupEntryType.group, + skip: false, + tags: [], + entries: [ + _testEntry('alpha', tags: ['tag1']), + _testEntry('bravo second', tags: ['tag3']), + ], + ), + ], + ), + ), + ); + }); + }); } -LocalTest _localTest(String name) => LocalTest(name, Metadata.empty, () {}); +LocalTest _localTest(String name, {Metadata? metadata}) => + LocalTest(name, metadata ?? Metadata.empty, () {}); DartGroupEntry _testEntry( String name, { diff --git a/packages/patrol_cli/lib/src/commands/build_android.dart b/packages/patrol_cli/lib/src/commands/build_android.dart index d468100ed..cbb17ee71 100644 --- a/packages/patrol_cli/lib/src/commands/build_android.dart +++ b/packages/patrol_cli/lib/src/commands/build_android.dart @@ -84,10 +84,17 @@ class BuildAndroidCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } - final tags = stringsArg('tags'); + final tags = stringArg('tags'); + final excludeTags = stringArg('exclude-tags'); + if (tags != null) { + _logger.detail('Received tag(s): $tags'); + } + if (excludeTags != null) { + _logger.detail('Received exclude tag(s): $excludeTags'); + } final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets, tags); + _testBundler.createTestBundle(targets, tags, excludeTags); } final flavor = stringArg('flavor') ?? config.android.flavor; diff --git a/packages/patrol_cli/lib/src/commands/build_ios.dart b/packages/patrol_cli/lib/src/commands/build_ios.dart index bf41c766f..13786550a 100644 --- a/packages/patrol_cli/lib/src/commands/build_ios.dart +++ b/packages/patrol_cli/lib/src/commands/build_ios.dart @@ -88,10 +88,17 @@ class BuildIOSCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } - final tags = stringsArg('tags'); + final tags = stringArg('tags'); + final excludeTags = stringArg('exclude-tags'); + if (tags != null) { + _logger.detail('Received tag(s): $tags'); + } + if (excludeTags != null) { + _logger.detail('Received exclude tag(s): $excludeTags'); + } final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets, tags); + _testBundler.createTestBundle(targets, tags, excludeTags); } final flavor = stringArg('flavor') ?? config.ios.flavor; diff --git a/packages/patrol_cli/lib/src/commands/build_macos.dart b/packages/patrol_cli/lib/src/commands/build_macos.dart index 1bcbf0d64..ae09ed0c5 100644 --- a/packages/patrol_cli/lib/src/commands/build_macos.dart +++ b/packages/patrol_cli/lib/src/commands/build_macos.dart @@ -84,10 +84,17 @@ class BuildMacOSCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } - final tags = stringsArg('tags'); + final tags = stringArg('tags'); + final excludeTags = stringArg('exclude-tags'); + if (tags != null) { + _logger.detail('Received tag(s): $tags'); + } + if (excludeTags != null) { + _logger.detail('Received exclude tag(s): $excludeTags'); + } final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets, tags); + _testBundler.createTestBundle(targets, tags, excludeTags); } final flavor = stringArg('flavor') ?? config.ios.flavor; diff --git a/packages/patrol_cli/lib/src/commands/test.dart b/packages/patrol_cli/lib/src/commands/test.dart index 10589ee07..4ee205926 100644 --- a/packages/patrol_cli/lib/src/commands/test.dart +++ b/packages/patrol_cli/lib/src/commands/test.dart @@ -50,6 +50,7 @@ class TestCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); + usesExcludeTagsOption(); usesUninstallOption(); @@ -101,11 +102,17 @@ class TestCommand extends PatrolCommand { _logger.detail('Received test target: $t'); } - final tags = stringsArg('tags'); - _logger.detail('Received ${tags.length} tag(s)'); + final tags = stringArg('tags'); + final excludeTags = stringArg('exclude-tags'); + if (tags != null) { + _logger.detail('Received tag(s): $tags'); + } + if (excludeTags != null) { + _logger.detail('Received exclude tag(s): $excludeTags'); + } final entrypoint = _testBundler.bundledTestFile; if (boolArg('generate-bundle')) { - _testBundler.createTestBundle(targets, tags); + _testBundler.createTestBundle(targets, tags, excludeTags); } final androidFlavor = stringArg('flavor') ?? config.android.flavor; diff --git a/packages/patrol_cli/lib/src/runner/patrol_command.dart b/packages/patrol_cli/lib/src/runner/patrol_command.dart index 32ffb7865..8b0b08396 100644 --- a/packages/patrol_cli/lib/src/runner/patrol_command.dart +++ b/packages/patrol_cli/lib/src/runner/patrol_command.dart @@ -132,10 +132,18 @@ abstract class PatrolCommand extends Command { } void usesTagsOption() { - argParser.addMultiOption( + argParser.addOption( 'tags', help: 'Tags to filter the tests by.', - valueHelp: 'smoke,regression', + valueHelp: '(chrome || firefox) && !slow', + ); + } + + void usesExcludeTagsOption() { + argParser.addOption( + 'exclude-tags', + help: 'Tags to exclude the tests by.', + valueHelp: 'safari', ); } diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index 083849b3f..67151bcc1 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -15,7 +15,11 @@ class TestBundler { final Logger _logger; /// Creates an entrypoint for use with `patrol test` and `patrol build`. - void createTestBundle(List testFilePaths, List tags) { + void createTestBundle( + List testFilePaths, + String? tags, + String? excludeTags, + ) { if (testFilePaths.isEmpty) { throw ArgumentError('testFilePaths must not be empty'); } @@ -82,8 +86,10 @@ Future main() async { // Maybe somewhat counterintuitively, this callback runs *after* the calls // to group() below. final topLevelGroup = Invoker.current!.liveTest.groups.first; - final dartTestGroup = createDartTestGroup(topLevelGroup, tags: [${tags.map((tag) => '"$tag"').join(', ')}]); - // final dartTestGroup = createDartTestGroup(topLevelGroup); + final dartTestGroup = createDartTestGroup(topLevelGroup, + tags: ${tags != null ? "'$tags'" : null}, + excludeTags: ${excludeTags != null ? "'$excludeTags'" : null}, + ); testExplorationCompleter.complete(dartTestGroup); print('patrol_test_explorer: obtained Dart-side test hierarchy:'); printGroupStructure(dartTestGroup); diff --git a/packages/patrol_cli/test/test_bundler_test.dart b/packages/patrol_cli/test/test_bundler_test.dart index 585227b12..36b889406 100644 --- a/packages/patrol_cli/test/test_bundler_test.dart +++ b/packages/patrol_cli/test/test_bundler_test.dart @@ -40,7 +40,14 @@ void _test(Platform platform) { }); test('throws ArgumentError when no tests are given', () { - expect(() => testBundler.createTestBundle([], []), throwsArgumentError); + expect( + () => testBundler.createTestBundle( + [], + null, + null, + ), + throwsArgumentError, + ); }); test('generates imports from relative paths', () { From 6b1a4e59b218f9b12de962738febea4c7fa6a99c Mon Sep 17 00:00:00 2001 From: pdenert Date: Fri, 2 Aug 2024 15:37:51 +0200 Subject: [PATCH 3/9] Update changelog --- packages/patrol/CHANGELOG.md | 1 + packages/patrol_cli/CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index c8749ba40..21a1cb55a 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -5,6 +5,7 @@ - Implement `enableLocation` and `disableLocation` methods for Android. (#2259) - Fix opening settings app with clean state on iOS. (#2275) - Add native skip. (#2278) +- Add `tags` and `exclude-tags`. (#2286) ## 3.9.0 diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 2f18b49d3..405f07e9d 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,3 +1,6 @@ +## Unreleased +- Add `tags` and `exclude-tags`. (#2286) + ## 3.0.1 - Fallback to read `java` version from `JAVA_HOME` when `flutter doctor` doesn't print any. From 5d75094be44346b4f9ad14a206b05aaad11e9b10 Mon Sep 17 00:00:00 2001 From: pdenert Date: Fri, 2 Aug 2024 15:38:19 +0200 Subject: [PATCH 4/9] Revert versions numbers --- dev/e2e_app/pubspec.lock | 2 +- packages/patrol/pubspec.yaml | 2 +- packages/patrol_cli/lib/src/base/constants.dart | 2 +- packages/patrol_cli/pubspec.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/e2e_app/pubspec.lock b/dev/e2e_app/pubspec.lock index 4ec538357..14644de4f 100644 --- a/dev/e2e_app/pubspec.lock +++ b/dev/e2e_app/pubspec.lock @@ -446,7 +446,7 @@ packages: path: "../../packages/patrol" relative: true source: path - version: "3.10.0" + version: "3.9.0" patrol_finders: dependency: transitive description: diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index ce18cab07..073bca04b 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -2,7 +2,7 @@ name: patrol description: > Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action! -version: 3.10.0 +version: 3.9.0 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol issue_tracker: https://github.com/leancodepl/patrol/issues diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index 8b9d37db2..1604a0509 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '3.0.2'; +const version = '3.0.1'; diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index e287dc973..f8ced06dd 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 3.0.2 # Must be kept in sync with constants.dart +version: 3.0.1 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22 From 1727bb6b8aa72a5a4dd4c33ef6e9bd493c195076 Mon Sep 17 00:00:00 2001 From: pdenert Date: Fri, 2 Aug 2024 16:40:09 +0200 Subject: [PATCH 5/9] Update versions and changelogs --- dev/e2e_app/pubspec.lock | 2 +- docs/compatibility-table.mdx | 3 ++- packages/patrol/CHANGELOG.md | 2 +- packages/patrol/pubspec.yaml | 2 +- packages/patrol_cli/CHANGELOG.md | 4 +++- packages/patrol_cli/lib/src/base/constants.dart | 2 +- packages/patrol_cli/pubspec.yaml | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dev/e2e_app/pubspec.lock b/dev/e2e_app/pubspec.lock index 14644de4f..4ec538357 100644 --- a/dev/e2e_app/pubspec.lock +++ b/dev/e2e_app/pubspec.lock @@ -446,7 +446,7 @@ packages: path: "../../packages/patrol" relative: true source: path - version: "3.9.0" + version: "3.10.0" patrol_finders: dependency: transitive description: diff --git a/docs/compatibility-table.mdx b/docs/compatibility-table.mdx index c2857e9e7..213a09c4d 100644 --- a/docs/compatibility-table.mdx +++ b/docs/compatibility-table.mdx @@ -13,7 +13,8 @@ the table below to assess which version you should use. | patrol | patrol_cli | | -------------- | -------------- | -| 3.6.0 - | 2.6.5 - | +| 3.10.0 - | 3.1.0 - | +| 3.6.0 - | 2.6.5 - 3.0.1 | | 3.4.0 - 3.5.2 | 2.6.0 - 2.6.4 | | 3.0.0 - 3.3.0 | 2.3.0 - 2.5.0 | | 2.3.0 - 2.3.2 | 2.2.0 - 2.2.2 | diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index 21a1cb55a..41b722cd6 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased +## 3.10.0 - Implement `enableBluetooth` and `disableBluetooth` methods for Android > 11. (#2254) - Implement `enableAirplaneMode` and `disableAirplaneMode` methods for Android. (#2254) diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index 073bca04b..ce18cab07 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -2,7 +2,7 @@ name: patrol description: > Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action! -version: 3.9.0 +version: 3.10.0 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol issue_tracker: https://github.com/leancodepl/patrol/issues diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 405f07e9d..18949f79d 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,6 +1,8 @@ -## Unreleased +## 3.1.0 - Add `tags` and `exclude-tags`. (#2286) +This version requires version 3.10.0 of `patrol` package. + ## 3.0.1 - Fallback to read `java` version from `JAVA_HOME` when `flutter doctor` doesn't print any. diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index 1604a0509..3b97ef275 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '3.0.1'; +const version = '3.1.0'; diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index f8ced06dd..f2964f566 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 3.0.1 # Must be kept in sync with constants.dart +version: 3.1.0 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22 From e3d15d1d9cebb1f37ffdd34e605fa4a18d96920b Mon Sep 17 00:00:00 2001 From: pdenert Date: Mon, 5 Aug 2024 09:23:19 +0200 Subject: [PATCH 6/9] Update contracts test --- .../test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt b/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt index ad4e6e4a5..1e1ed1cd3 100644 --- a/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt +++ b/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt @@ -9,11 +9,11 @@ fun dartTestGroup( name: String, entries: List, ): DartGroupEntry { - return DartGroupEntry(name, GroupEntryType.group, entries, false) + return DartGroupEntry(name, GroupEntryType.group, entries, false, []) } fun dartTestCase(name: String): DartGroupEntry { - return DartGroupEntry(name, GroupEntryType.test, listOf(), false) + return DartGroupEntry(name, GroupEntryType.test, listOf(), false, []) } class DartTestGroupExtensionsTest { From d7432cd5eb50e299319df2c049d9b5e940c8168e Mon Sep 17 00:00:00 2001 From: pdenert Date: Mon, 5 Aug 2024 11:24:48 +0200 Subject: [PATCH 7/9] Add missing usesExcludeTagsOption --- packages/patrol_cli/lib/src/commands/build_android.dart | 1 + packages/patrol_cli/lib/src/commands/build_ios.dart | 1 + packages/patrol_cli/lib/src/commands/build_macos.dart | 1 + packages/patrol_cli/lib/src/commands/develop.dart | 1 + 4 files changed, 4 insertions(+) diff --git a/packages/patrol_cli/lib/src/commands/build_android.dart b/packages/patrol_cli/lib/src/commands/build_android.dart index cbb17ee71..2dc1edaf3 100644 --- a/packages/patrol_cli/lib/src/commands/build_android.dart +++ b/packages/patrol_cli/lib/src/commands/build_android.dart @@ -37,6 +37,7 @@ class BuildAndroidCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); + usesExcludeTagsOption(); usesAndroidOptions(); } diff --git a/packages/patrol_cli/lib/src/commands/build_ios.dart b/packages/patrol_cli/lib/src/commands/build_ios.dart index 13786550a..ce5f11715 100644 --- a/packages/patrol_cli/lib/src/commands/build_ios.dart +++ b/packages/patrol_cli/lib/src/commands/build_ios.dart @@ -37,6 +37,7 @@ class BuildIOSCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); + usesExcludeTagsOption(); usesIOSOptions(); argParser.addFlag( diff --git a/packages/patrol_cli/lib/src/commands/build_macos.dart b/packages/patrol_cli/lib/src/commands/build_macos.dart index ae09ed0c5..d6f94bebc 100644 --- a/packages/patrol_cli/lib/src/commands/build_macos.dart +++ b/packages/patrol_cli/lib/src/commands/build_macos.dart @@ -37,6 +37,7 @@ class BuildMacOSCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); + usesExcludeTagsOption(); usesMacOSOptions(); } diff --git a/packages/patrol_cli/lib/src/commands/develop.dart b/packages/patrol_cli/lib/src/commands/develop.dart index 27396b136..de796c108 100644 --- a/packages/patrol_cli/lib/src/commands/develop.dart +++ b/packages/patrol_cli/lib/src/commands/develop.dart @@ -54,6 +54,7 @@ class DevelopCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); + usesExcludeTagsOption(); usesUninstallOption(); From 78ac51083df323929dcb291a423ecb14fb512feb Mon Sep 17 00:00:00 2001 From: pdenert Date: Mon, 5 Aug 2024 11:27:21 +0200 Subject: [PATCH 8/9] Remove usesExcludeTagsOption from develop --- packages/patrol_cli/lib/src/commands/develop.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/patrol_cli/lib/src/commands/develop.dart b/packages/patrol_cli/lib/src/commands/develop.dart index de796c108..27396b136 100644 --- a/packages/patrol_cli/lib/src/commands/develop.dart +++ b/packages/patrol_cli/lib/src/commands/develop.dart @@ -54,7 +54,6 @@ class DevelopCommand extends PatrolCommand { usesWaitOption(); usesPortOptions(); usesTagsOption(); - usesExcludeTagsOption(); usesUninstallOption(); From ba8bcf9e95fc0cb7813d353246b9b5d9cc9213c5 Mon Sep 17 00:00:00 2001 From: pdenert Date: Mon, 5 Aug 2024 12:39:42 +0200 Subject: [PATCH 9/9] Fix ContractsExtensionsTest --- .../test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt b/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt index 1e1ed1cd3..e25f95ac3 100644 --- a/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt +++ b/packages/patrol/android/src/test/kotlin/pl/leancode/patrol/ContractsExtensionsTest.kt @@ -9,11 +9,11 @@ fun dartTestGroup( name: String, entries: List, ): DartGroupEntry { - return DartGroupEntry(name, GroupEntryType.group, entries, false, []) + return DartGroupEntry(name, GroupEntryType.group, entries, false, listOf()) } fun dartTestCase(name: String): DartGroupEntry { - return DartGroupEntry(name, GroupEntryType.test, listOf(), false, []) + return DartGroupEntry(name, GroupEntryType.test, listOf(), false, listOf()) } class DartTestGroupExtensionsTest {