From d503dd879cfdea460f87be79580805b6aeb8c967 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 11 Aug 2023 09:35:18 +0200 Subject: [PATCH 01/38] change `createDartTestGroup()` to work recursively --- packages/patrol/lib/src/common.dart | 43 ++++++++++++++++++++++------- packages/patrol/pubspec.yaml | 3 +- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index a981650f8..abe30fa17 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -155,24 +155,47 @@ if you use nativeAutomation with false, we recommend using patrolWidgetTest()''' ); } -/// Creates a DartTestGroup by visiting the subgroups of [topLevelGroup]. +/// Creates a DartTestGroup by visiting the subgroups of [parentGroup]. +/// +/// The initial [parentGroup] is the implicit, unnamed top-level [Group] present +/// in every test case. @internal DartTestGroup createDartTestGroup( - Group topLevelGroup, { + Group parentGroup, { String prefix = '', }) { - final groupName = topLevelGroup.name.replaceFirst(prefix, '').trim(); - final group = DartTestGroup(name: groupName); + final groupName = parentGroup.name.replaceFirst(prefix, '').trim(); + final groupDTO = DartTestGroup(name: groupName); + + print('PATROL_DEBUG: Added top-level group: ${groupDTO.name}'); - for (final entry in topLevelGroup.entries) { + for (final entry in parentGroup.entries) { if (entry is Group) { - group.groups.add(DartTestGroup(name: entry.name)); + // print('PATROL_DEBUG: Added group: ${entry.name}'); + groupDTO.groups.add(createDartTestGroup(entry)); + } else if (entry is Test && entry.name != 'patrol_test_explorer') { + // throw StateError('Expected group, got test: ${entry.name}'); + // Ignore the bogus test that is used to discover the test structure. + continue; + } else if (entry is Test) { + groupDTO.tests.add(DartTestCase(name: entry.name)); + } else { + throw StateError('invalid state'); } + } - if (entry is Test && entry.name != 'patrol_test_explorer') { - throw StateError('Expected group, got test: ${entry.name}'); - } + return groupDTO; +} + +void printGroupStructure(DartTestGroup group, int indentation) { + final indent = ' ' * indentation; + print("$indent-- group: '${group.name}'"); + + for (final testCase in group.tests) { + print("$indent -- test: '${testCase.name}'"); } - return group; + for (final subgroup in group.groups) { + printGroupStructure(subgroup, indentation + 5); + } } diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index 229063fc4..c87e48b84 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -22,7 +22,8 @@ dependencies: sdk: flutter meta: ^1.7.0 path: ^1.8.2 - patrol_finders: ^1.0.0 + patrol_finders: + path: ../patrol_finders protobuf: ^2.1.0 test_api: '>=0.4.0 <0.7.0' From d4be6deade9a4bd5939c7e33a18823fd246111e4 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 11 Aug 2023 14:12:28 +0200 Subject: [PATCH 02/38] print all groups and tests (albeit twice) next up: dedeuplicate groups and tests names --- .../integration_test/example_test.dart | 44 ++++++++++--------- .../integration_test/open_app_test.dart | 38 ++++++++++++---- packages/patrol/lib/src/common.dart | 11 +++-- packages/patrol_cli/lib/src/test_bundler.dart | 4 ++ 4 files changed, 64 insertions(+), 33 deletions(-) diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 62aeac09a..72fd352b3 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -1,27 +1,29 @@ -import 'package:flutter/material.dart'; - import 'common.dart'; void main() { - patrol( - 'counter state is the same after going to Home and switching apps', - ($) async { - await createApp($); - - await $(FloatingActionButton).tap(); - expect($(#counterText).text, '1'); - - await $(#textField).enterText('Hello, Flutter!'); - expect($('Hello, Flutter!'), findsOneWidget); + group('example_test.dart', () { + group('alpha', () { + patrol('first', ($) async { + await _testBody($); + }); + patrol('Second', ($) async { + await _testBody($); + }); + }); - await $.native.pressHome(); - await $.native.openApp(); - - expect($(#counterText).text, '1'); - await $(FloatingActionButton).tap(); + group('bravo', () { + patrol('first', ($) async { + await _testBody($); + }); + patrol('second', ($) async { + await _testBody($); + }); + }); + }); +} - expect($(#counterText).text, '2'); - expect($('Hello, Flutter!'), findsOneWidget); - }, - ); +Future _testBody(PatrolTester $) async { + await createApp($); + await $.native.pressHome(); + await $.native.openApp(); } diff --git a/packages/patrol/example/integration_test/open_app_test.dart b/packages/patrol/example/integration_test/open_app_test.dart index be33a8011..1c89571cb 100644 --- a/packages/patrol/example/integration_test/open_app_test.dart +++ b/packages/patrol/example/integration_test/open_app_test.dart @@ -5,14 +5,14 @@ import 'package:flutter/material.dart'; import 'common.dart'; void main() { - late String mapsId; - if (Platform.isIOS) { - mapsId = 'com.apple.Maps'; - } else if (Platform.isAndroid) { - mapsId = 'com.google.android.apps.maps'; - } - - patrol('counter state is the same after switching apps', ($) async { + patrol('open maps', ($) async { + late String mapsId; + if (Platform.isIOS) { + mapsId = 'com.apple.Maps'; + } else if (Platform.isAndroid) { + mapsId = 'com.google.android.apps.maps'; + } + await createApp($); expect($(#counterText).text, '0'); @@ -26,4 +26,26 @@ void main() { expect($(#counterText).text, '1'); }); + + patrol('open browser', ($) async { + late String browserId; + if (Platform.isIOS) { + browserId = 'com.apple.mobilesafari'; + } else if (Platform.isAndroid) { + browserId = 'com.google.chrome'; + } + + await createApp($); + + expect($(#counterText).text, '0'); + + await $(FloatingActionButton).tap(); + + await $.native.pressHome(); + await $.native.openApp(appId: browserId); + await $.native.pressHome(); + await $.native.openApp(); + + expect($(#counterText).text, '1'); + }); } diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index abe30fa17..182a0ec46 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -173,11 +173,14 @@ DartTestGroup createDartTestGroup( if (entry is Group) { // print('PATROL_DEBUG: Added group: ${entry.name}'); groupDTO.groups.add(createDartTestGroup(entry)); - } else if (entry is Test && entry.name != 'patrol_test_explorer') { - // throw StateError('Expected group, got test: ${entry.name}'); - // Ignore the bogus test that is used to discover the test structure. - continue; } else if (entry is Test) { + if (entry.name == 'patrol_test_explorer') { + // throw StateError('Expected group, got test: ${entry.name}'); + // Ignore the bogus test that is used to discover the test structure. + continue; + } + + print('PATROL_DEBUG: Found test! ${entry.name}}'); groupDTO.tests.add(DartTestCase(name: entry.name)); } else { throw StateError('invalid state'); diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index c4c45ff17..9f7635411 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -79,9 +79,13 @@ Future main() async { // This test must be the first to run. If not, the native side likely won't // receive any tests, and everything will fall apart. test('patrol_test_explorer', () { + // Counterintuitively, this callback runs *after* the calls to group() + // below. final topLevelGroup = Invoker.current!.liveTest.groups.first; final dartTestGroup = createDartTestGroup(topLevelGroup); testExplorationCompleter.complete(dartTestGroup); + print('PATROL_DEBUG: group structure:'); + printGroupStructure(dartTestGroup, 0); }); // START: GENERATED TEST GROUPS From 9ed0fb5eca6e5dcf22e973e7e62bd67584728405 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 11 Aug 2023 15:48:33 +0200 Subject: [PATCH 03/38] deduplicate group and test names next up: fix tests --- .../integration_test/example_test.dart | 2 +- packages/patrol/lib/src/common.dart | 34 ++-- packages/patrol/test/internals_test.dart | 184 +++++++++++++----- 3 files changed, 162 insertions(+), 58 deletions(-) diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 72fd352b3..05eceae74 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -1,7 +1,7 @@ import 'common.dart'; void main() { - group('example_test.dart', () { + group('top level group in file', () { group('alpha', () { patrol('first', ($) async { await _testBody($); diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 182a0ec46..886885edd 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -160,19 +160,20 @@ if you use nativeAutomation with false, we recommend using patrolWidgetTest()''' /// The initial [parentGroup] is the implicit, unnamed top-level [Group] present /// in every test case. @internal -DartTestGroup createDartTestGroup( - Group parentGroup, { - String prefix = '', -}) { - final groupName = parentGroup.name.replaceFirst(prefix, '').trim(); - final groupDTO = DartTestGroup(name: groupName); - - print('PATROL_DEBUG: Added top-level group: ${groupDTO.name}'); +DartTestGroup createDartTestGroup(Group parentGroup, {String name = ''}) { + final groupDTO = DartTestGroup(name: name); for (final entry in parentGroup.entries) { + // Trim names of current groups + + var name = entry.name; + if (parentGroup.name.isNotEmpty) { + name = deduplicateGroupEntryName(parentGroup.name, entry.name); + } + if (entry is Group) { - // print('PATROL_DEBUG: Added group: ${entry.name}'); - groupDTO.groups.add(createDartTestGroup(entry)); + groupDTO.groups.add(createDartTestGroup(entry, name: name)); + print('PATROL_DEBUG: Added group: $name'); } else if (entry is Test) { if (entry.name == 'patrol_test_explorer') { // throw StateError('Expected group, got test: ${entry.name}'); @@ -180,9 +181,11 @@ DartTestGroup createDartTestGroup( continue; } - print('PATROL_DEBUG: Found test! ${entry.name}}'); - groupDTO.tests.add(DartTestCase(name: entry.name)); + groupDTO.tests.add(DartTestCase(name: name)); + print('PATROL_DEBUG: Added test: $name'); } else { + // This should really never happen, because Group and Test are the only + // subclasses of GroupEntry. throw StateError('invalid state'); } } @@ -202,3 +205,10 @@ void printGroupStructure(DartTestGroup group, int indentation) { printGroupStructure(subgroup, indentation + 5); } } + +String deduplicateGroupEntryName(String parentName, String currentName) { + return currentName.substring( + parentName.length + 1, + currentName.length, + ); +} diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index 271eb2108..6d6839f33 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -1,6 +1,7 @@ // ignore_for_file: invalid_use_of_internal_member, depend_on_referenced_packages, implementation_imports import 'package:flutter_test/flutter_test.dart'; -import 'package:patrol/src/common.dart' show createDartTestGroup; +import 'package:patrol/src/common.dart' + show createDartTestGroup, deduplicateGroupEntryName, printGroupStructure; import 'package:patrol/src/native/contracts/contracts.pbgrpc.dart'; import 'package:test_api/src/backend/group.dart'; import 'package:test_api/src/backend/invoker.dart'; @@ -8,66 +9,159 @@ import 'package:test_api/src/backend/metadata.dart'; void main() { group('createDartTestGroup()', () { - test('fails if a test is defined', () { - // given - final topLevelGroup = Group.root([ - LocalTest('patrol_test_explorer', Metadata.empty, () {}), - LocalTest('some_test', Metadata.empty, () => null), - Group('example_test', [ - LocalTest('example_test some example test', Metadata.empty, () {}), - ]) - ]); + // test('fails if a test is defined at top-level', () { + // // given + // final topLevelGroup = Group.root([ + // LocalTest('patrol_test_explorer', Metadata.empty, () {}), + // LocalTest('some_test', Metadata.empty, () => null), + // Group('example_test', [ + // LocalTest('example_test some example test', Metadata.empty, () {}), + // ]) + // ]); - // when - DartTestGroup callback() => createDartTestGroup(topLevelGroup); + // // when + // DartTestGroup callback() => createDartTestGroup(topLevelGroup); - // then - expect( - callback, - throwsA(isA()), - ); - }); - test('takes only groups into account', () { + // // then + // expect( + // callback, + // throwsA(isA()), + // ); + // }); + + // test('takes only groups into account', () { + // // given + // final topLevelGroup = Group.root([ + // LocalTest('patrol_test_explorer', Metadata.empty, () {}), + // Group( + // 'permissions.permissions_location_test', + // [ + // LocalTest( + // 'permissions.permissions_location_test accepts location permission', + // Metadata.empty, + // () {}, + // ) + // ], + // ), + // Group('permissions.permissions_many_test', [ + // LocalTest( + // 'permissions.permissions_many_test grants various permissions', + // Metadata.empty, + // () {}, + // ), + // ]), + // Group('example_test', [ + // LocalTest('example_test some example test', Metadata.empty, () {}), + // ]) + // ]); + + // // when + // final dartTestGroup = createDartTestGroup(topLevelGroup); + + // // then + // expect( + // dartTestGroup, + // DartTestGroup( + // name: '', + // groups: [ + // DartTestGroup(name: 'permissions.permissions_location_test'), + // DartTestGroup(name: 'permissions.permissions_many_test'), + // DartTestGroup(name: 'example_test'), + // ], + // ), + // ); + // }); + + test('smoke test 1', () { // given final topLevelGroup = Group.root([ LocalTest('patrol_test_explorer', Metadata.empty, () {}), Group( - 'permissions.permissions_location_test', + 'example_test', [ - LocalTest( - 'permissions.permissions_location_test accepts location permission', - Metadata.empty, - () {}, - ) + Group('example_test alpha', [ + _localTest('example_test alpha first'), + _localTest('example_test alpha second'), + ]), + Group('example_test bravo', [ + _localTest('example_test bravo first'), + _localTest('example_test bravo second'), + ]), ], ), - Group('permissions.permissions_many_test', [ - LocalTest( - 'permissions.permissions_many_test grants various permissions', - Metadata.empty, - () {}, - ), + Group('open_app_test', [ + _localTest('open_app_test open maps'), + _localTest('open_app_test open browser'), ]), - Group('example_test', [ - LocalTest('example_test some example test', Metadata.empty, () {}), - ]) ]); // when final dartTestGroup = createDartTestGroup(topLevelGroup); - // then - expect( - dartTestGroup, - DartTestGroup( - name: '', - groups: [ - DartTestGroup(name: 'permissions.permissions_location_test'), - DartTestGroup(name: 'permissions.permissions_many_test'), - DartTestGroup(name: 'example_test'), - ], - ), + final expected = DartTestGroup( + name: '', + groups: [ + DartTestGroup( + name: 'example_test', + groups: [ + DartTestGroup( + name: 'alpha', + tests: [ + DartTestCase(name: 'first'), + DartTestCase(name: 'second') + ], + ), + DartTestGroup( + name: 'bravo', + tests: [ + DartTestCase(name: 'first'), + DartTestCase(name: 'second'), + ], + ), + ], + ), + DartTestGroup( + name: 'open_app_test', + tests: [ + DartTestCase(name: 'open maps'), + DartTestCase(name: 'open browser'), + ], + ), + ], ); + + // then + print('dartTestGroup hash code: ${dartTestGroup.hashCode}'); + print('expected hash code: ${expected.hashCode}'); + + expect(dartTestGroup, equals(expected)); + + printGroupStructure(dartTestGroup, 0); }); }); + + // group('deduplicateGroupEntryName()', () { + // test('deduplicates group entry names', () { + // // given + // const parentEntryName = 'example_test example_test.dart alpha'; + // const currentEntryName = 'example_test example_test.dart alpha first'; + + // // when + // final result = deduplicateGroupEntryName( + // parentEntryName, + // currentEntryName, + // ); + + // // then + // expect(result, equals('first')); + // }); + // }); +} + +LocalTest _localTest(String name) { + return LocalTest( + name, + Metadata.empty, + () {}, + ); } From 2e60dc3db6dc574c559209ac61114cc5262b83bf Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 11 Aug 2023 15:56:34 +0200 Subject: [PATCH 04/38] fix createDartTestGroup() tests --- packages/patrol/lib/src/common.dart | 18 ++- packages/patrol/test/internals_test.dart | 167 ++++++++--------------- 2 files changed, 75 insertions(+), 110 deletions(-) diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 886885edd..58d8beea2 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -160,7 +160,11 @@ if you use nativeAutomation with false, we recommend using patrolWidgetTest()''' /// The initial [parentGroup] is the implicit, unnamed top-level [Group] present /// in every test case. @internal -DartTestGroup createDartTestGroup(Group parentGroup, {String name = ''}) { +DartTestGroup createDartTestGroup( + Group parentGroup, { + String name = '', + int level = 0, +}) { final groupDTO = DartTestGroup(name: name); for (final entry in parentGroup.entries) { @@ -172,7 +176,13 @@ DartTestGroup createDartTestGroup(Group parentGroup, {String name = ''}) { } if (entry is Group) { - groupDTO.groups.add(createDartTestGroup(entry, name: name)); + groupDTO.groups.add( + createDartTestGroup( + entry, + name: name, + level: level + 1, + ), + ); print('PATROL_DEBUG: Added group: $name'); } else if (entry is Test) { if (entry.name == 'patrol_test_explorer') { @@ -181,6 +191,10 @@ DartTestGroup createDartTestGroup(Group parentGroup, {String name = ''}) { continue; } + if (level < 1) { + throw StateError('Test is not allowed to be defined at level $level'); + } + groupDTO.tests.add(DartTestCase(name: name)); print('PATROL_DEBUG: Added test: $name'); } else { diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index 6d6839f33..4841f1f31 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -9,70 +9,27 @@ import 'package:test_api/src/backend/metadata.dart'; void main() { group('createDartTestGroup()', () { - // test('fails if a test is defined at top-level', () { - // // given - // final topLevelGroup = Group.root([ - // LocalTest('patrol_test_explorer', Metadata.empty, () {}), - // LocalTest('some_test', Metadata.empty, () => null), - // Group('example_test', [ - // LocalTest('example_test some example test', Metadata.empty, () {}), - // ]) - // ]); - - // // when - // DartTestGroup callback() => createDartTestGroup(topLevelGroup); - - // // then - // expect( - // callback, - // throwsA(isA()), - // ); - // }); - - // test('takes only groups into account', () { - // // given - // final topLevelGroup = Group.root([ - // LocalTest('patrol_test_explorer', Metadata.empty, () {}), - // Group( - // 'permissions.permissions_location_test', - // [ - // LocalTest( - // 'permissions.permissions_location_test accepts location permission', - // Metadata.empty, - // () {}, - // ) - // ], - // ), - // Group('permissions.permissions_many_test', [ - // LocalTest( - // 'permissions.permissions_many_test grants various permissions', - // Metadata.empty, - // () {}, - // ), - // ]), - // Group('example_test', [ - // LocalTest('example_test some example test', Metadata.empty, () {}), - // ]) - // ]); + test('fails if a test is defined at top-level', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + LocalTest('some_test', Metadata.empty, () => null), + Group('example_test', [ + LocalTest('example_test some example test', Metadata.empty, () {}), + ]) + ]); - // // when - // final dartTestGroup = createDartTestGroup(topLevelGroup); + // when + DartTestGroup callback() => createDartTestGroup(topLevelGroup); - // // then - // expect( - // dartTestGroup, - // DartTestGroup( - // name: '', - // groups: [ - // DartTestGroup(name: 'permissions.permissions_location_test'), - // DartTestGroup(name: 'permissions.permissions_many_test'), - // DartTestGroup(name: 'example_test'), - // ], - // ), - // ); - // }); + // then + expect( + callback, + throwsA(isA()), + ); + }); - test('smoke test 1', () { + test('smoke test', () { // given final topLevelGroup = Group.root([ LocalTest('patrol_test_explorer', Metadata.empty, () {}), @@ -81,7 +38,7 @@ void main() { [ Group('example_test alpha', [ _localTest('example_test alpha first'), - _localTest('example_test alpha second'), + _localTest('example_test alpha second'), ]), Group('example_test bravo', [ _localTest('example_test bravo first'), @@ -98,70 +55,64 @@ void main() { // when final dartTestGroup = createDartTestGroup(topLevelGroup); - final expected = DartTestGroup( - name: '', - groups: [ + // then + expect( + dartTestGroup, + equals( DartTestGroup( - name: 'example_test', + name: '', groups: [ DartTestGroup( - name: 'alpha', - tests: [ - DartTestCase(name: 'first'), - DartTestCase(name: 'second') + name: 'example_test', + groups: [ + DartTestGroup( + name: 'alpha', + tests: [ + DartTestCase(name: 'first'), + DartTestCase(name: 'second') + ], + ), + DartTestGroup( + name: 'bravo', + tests: [ + DartTestCase(name: 'first'), + DartTestCase(name: 'second'), + ], + ), ], ), DartTestGroup( - name: 'bravo', + name: 'open_app_test', tests: [ - DartTestCase(name: 'first'), - DartTestCase(name: 'second'), + DartTestCase(name: 'open maps'), + DartTestCase(name: 'open browser'), ], ), ], ), - DartTestGroup( - name: 'open_app_test', - tests: [ - DartTestCase(name: 'open maps'), - DartTestCase(name: 'open browser'), - ], - ), - ], + ), ); - // then - print('dartTestGroup hash code: ${dartTestGroup.hashCode}'); - print('expected hash code: ${expected.hashCode}'); - - expect(dartTestGroup, equals(expected)); - printGroupStructure(dartTestGroup, 0); }); }); - // group('deduplicateGroupEntryName()', () { - // test('deduplicates group entry names', () { - // // given - // const parentEntryName = 'example_test example_test.dart alpha'; - // const currentEntryName = 'example_test example_test.dart alpha first'; + group('deduplicateGroupEntryName()', () { + test('deduplicates group entry names', () { + // given + const parentEntryName = 'example_test example_test.dart alpha'; + const currentEntryName = 'example_test example_test.dart alpha first'; - // // when - // final result = deduplicateGroupEntryName( - // parentEntryName, - // currentEntryName, - // ); + // when + final result = deduplicateGroupEntryName( + parentEntryName, + currentEntryName, + ); - // // then - // expect(result, equals('first')); - // }); - // }); + // then + expect(result, equals('first')); + }); + }); } -LocalTest _localTest(String name) { - return LocalTest( - name, - Metadata.empty, - () {}, - ); -} +LocalTest _localTest(String name) => LocalTest(name, Metadata.empty, () {}); From f5c09d9dbfad6d47e74499ff10d0dd8db112cf83 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 10:43:47 +0200 Subject: [PATCH 05/38] implement deserializing DartTestGroup into a flat list of DartTestCases --- .../pl/leancode/patrol/ContractsExtensions.kt | 39 +++++++- .../patrol/ContractsExtensionsTest.kt | 95 +++++++++++++++++++ 2 files changed, 130 insertions(+), 4 deletions(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index 30d74952e..3a4c18a24 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -3,10 +3,12 @@ package pl.leancode.patrol import androidx.test.uiautomator.By import androidx.test.uiautomator.BySelector import androidx.test.uiautomator.UiSelector -import pl.leancode.patrol.contracts.Contracts +import pl.leancode.patrol.contracts.Contracts.DartTestCase import pl.leancode.patrol.contracts.Contracts.DartTestGroup +import pl.leancode.patrol.contracts.Contracts.Selector +import pl.leancode.patrol.contracts.copy -private fun Contracts.Selector.isEmpty(): Boolean { +private fun Selector.isEmpty(): Boolean { return ( !hasText() && !hasTextStartsWith() && @@ -23,7 +25,7 @@ private fun Contracts.Selector.isEmpty(): Boolean { ) } -fun Contracts.Selector.toUiSelector(): UiSelector { +fun Selector.toUiSelector(): UiSelector { var selector = UiSelector() if (hasText()) { @@ -77,7 +79,7 @@ fun Contracts.Selector.toUiSelector(): UiSelector { return selector } -fun Contracts.Selector.toBySelector(): BySelector { +fun Selector.toBySelector(): BySelector { if (isEmpty()) { throw PatrolException("Selector is empty") } @@ -184,6 +186,35 @@ fun Contracts.Selector.toBySelector(): BySelector { return bySelector } +/** + * Flattens the structure of a DartTestSuite into a flat list of tests. + */ +fun DartTestGroup.listTestsFlat(parentGroupName: String = ""): List { + val tests = mutableListOf() + + // FIXME: This doesn't preserve the order of groups and tests in Dart! + // We should iterate over "group entries", instead of iterating over "groups" and "tests". + + for (test in testsList) { + if (parentGroupName.isEmpty()) { + // This case is invalid, because every test will have at least 1 named group - its filename. + throw IllegalStateException("Test $test has no named parent group") + } + + tests.add(test.copy { name = "$parentGroupName.${test.name}" }) + } + + for (group in groupsList) { + if (parentGroupName.isEmpty()) { + tests.addAll(group.listTestsFlat(parentGroupName = group.name)) + } else { + tests.addAll(group.listTestsFlat(parentGroupName = "$parentGroupName.${group.name}")) + } + } + + return tests +} + fun DartTestGroup.listFlatDartFiles(): List { val files = mutableListOf() for (group in groupsList) { 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 c8c553380..7ab999d1a 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 @@ -1,6 +1,7 @@ package pl.leancode.patrol import org.junit.Test +import pl.leancode.patrol.contracts.dartTestCase import pl.leancode.patrol.contracts.dartTestGroup import kotlin.test.assertContentEquals @@ -34,4 +35,98 @@ class DartTestGroupExtensionsTest { ), ) } + + @Test + fun `listTestsFlat() handles simple hierarchy`() { + // given + val dartTestGroup = dartTestGroup { + name = "" + groups += listOf( + dartTestGroup { + name = "example_test" + tests += listOf(dartTestCase { name = "increments counter, exits the app, and comes back" }) + }, + dartTestGroup { + name = "open_app_test" + tests += listOf(dartTestCase { name = "open maps" }) + }, + dartTestGroup { + name = "webview_test" + tests += listOf(dartTestCase { name = "interacts with the LeanCode website in a webview" }) + } + ) + } + + // when + val dartTestFiles = dartTestGroup.listTestsFlat() + + // then + assertContentEquals( + listOf( + dartTestCase { name = "example_test.increments counter, exits the app, and comes back" }, + dartTestCase { name = "open_app_test.open maps" }, + dartTestCase { name = "webview_test.interacts with the LeanCode website in a webview" }, + ), + dartTestFiles, + ) + } + + @Test + fun `listTestsFlat() handles nested hierarchy`() { + // given + val dartTestGroup = dartTestGroup { + name = "" + groups += listOf( + dartTestGroup { + name = "example_test" + groups += listOf( + dartTestGroup { + name = "top level group in file" + groups += listOf( + dartTestGroup { + name = "alpha" + tests += listOf( + dartTestCase { name = "first" }, + dartTestCase { name = "second" }, + ) + }, + dartTestGroup { + name = "bravo" + tests += listOf( + dartTestCase { name = "first" }, + dartTestCase { name = "second" }, + ) + }, + ) + } + ) + }, + dartTestGroup { + name = "open_app_test" + tests += listOf( + dartTestCase { name = "open maps" }, + dartTestCase { name = "open browser" }, + ) + }, + ) + } + + // when + val dartTestFiles = dartTestGroup.listTestsFlat() + + // then + assertContentEquals( + listOf( + // example_test + dartTestCase { name = "example_test.top level group in file.alpha.first" }, + dartTestCase { name = "example_test.top level group in file.alpha.second" }, + dartTestCase { name = "example_test.top level group in file.bravo.first" }, + dartTestCase { name = "example_test.top level group in file.bravo.second" }, + // open_app_test + dartTestCase { name = "open_app_test.open maps" }, + dartTestCase { name = "open_app_test.open browser" }, + ), + dartTestFiles, + ) + } } From d8e7484c8087cab8fe1bacf74b5b613e89acd291 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 10:51:14 +0200 Subject: [PATCH 06/38] use `listTestsFlat()` instead of `listFlatDartFiles()`, and remove the latter --- .../pl/leancode/patrol/ContractsExtensions.kt | 19 ------------- .../pl/leancode/patrol/PatrolJUnitRunner.java | 14 +++++++--- .../patrol/ContractsExtensionsTest.kt | 27 ------------------- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index 3a4c18a24..2e1f58816 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -214,22 +214,3 @@ fun DartTestGroup.listTestsFlat(parentGroupName: String = ""): List { - val files = mutableListOf() - for (group in groupsList) { - files.addAll(group.listGroups()) - } - - return files -} - -// Recursively lists groups in this group. -private fun DartTestGroup.listGroups(): List { - val groups = mutableListOf(this.name) - for (group in groupsList) { - groups.addAll(group.listGroups()) - } - - return groups -} diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java index fffe13014..523573b7c 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java @@ -11,9 +11,12 @@ import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnitRunner; import io.grpc.StatusRuntimeException; +import pl.leancode.patrol.contracts.Contracts.DartTestCase; import pl.leancode.patrol.contracts.Contracts.DartTestGroup; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.concurrent.ExecutionException; import static pl.leancode.patrol.contracts.Contracts.RunDartTestResponse; @@ -107,9 +110,14 @@ public Object[] listDartTests() { try { final DartTestGroup dartTestGroup = patrolAppServiceClient.listDartTests(); - Object[] dartTestFiles = ContractsExtensionsKt.listFlatDartFiles(dartTestGroup).toArray(); - Logger.INSTANCE.i(TAG + "Got Dart tests: " + Arrays.toString(dartTestFiles)); - return dartTestFiles; + List dartTestCases = ContractsExtensionsKt.listTestsFlat(dartTestGroup, ""); + List dartTestCaseNamesList = new ArrayList<>(); + for (DartTestCase dartTestCase : dartTestCases) { + dartTestCaseNamesList.add(dartTestCase.getName()); + } + Object[] dartTestCaseNames = dartTestCaseNamesList.toArray(); + Logger.INSTANCE.i(TAG + "Got Dart tests: " + Arrays.toString(dartTestCaseNames)); + return dartTestCaseNames; } catch (StatusRuntimeException e) { Logger.INSTANCE.e(TAG + "Failed to list Dart tests: ", e); throw e; 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 7ab999d1a..2a31631c7 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 @@ -8,33 +8,6 @@ import kotlin.test.assertContentEquals // TODO: Make sure these tests are run on CI class DartTestGroupExtensionsTest { - @Test - fun `listDartFilesFlat() litmus test`() { - // given - val dartTestGroup = dartTestGroup { - name = "root" - groups += listOf( - dartTestGroup { - name = "example_test" - }, - dartTestGroup { - name = "example.example_test" - }, - ) - } - - // when - val dartTestFiles = dartTestGroup.listFlatDartFiles() - - // then - assertContentEquals( - dartTestFiles, - listOf( - "example_test", - "example.example_test", - ), - ) - } @Test fun `listTestsFlat() handles simple hierarchy`() { From e491dc73c5cb1a33a5d1e22af97015903f10accd Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 11:09:08 +0200 Subject: [PATCH 07/38] don't concat groups with a `dot` (this is a temporary change) --- .../pl/leancode/patrol/ContractsExtensions.kt | 4 ++-- .../leancode/patrol/ContractsExtensionsTest.kt | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index 2e1f58816..bbc5da5e1 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -201,14 +201,14 @@ fun DartTestGroup.listTestsFlat(parentGroupName: String = ""): List Date: Mon, 14 Aug 2023 11:48:04 +0200 Subject: [PATCH 08/38] fix typos in tests --- packages/patrol/example/integration_test/example_test.dart | 2 +- packages/patrol/example/integration_test/open_app_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 05eceae74..19d000fcb 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -6,7 +6,7 @@ void main() { patrol('first', ($) async { await _testBody($); }); - patrol('Second', ($) async { + patrol('second', ($) async { await _testBody($); }); }); diff --git a/packages/patrol/example/integration_test/open_app_test.dart b/packages/patrol/example/integration_test/open_app_test.dart index 1c89571cb..0cf550fbd 100644 --- a/packages/patrol/example/integration_test/open_app_test.dart +++ b/packages/patrol/example/integration_test/open_app_test.dart @@ -32,7 +32,7 @@ void main() { if (Platform.isIOS) { browserId = 'com.apple.mobilesafari'; } else if (Platform.isAndroid) { - browserId = 'com.google.chrome'; + browserId = 'com.android.chrome'; } await createApp($); From 43d3ec62b31d8c0c8ace249931a4ff1b37489fc3 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 11:52:12 +0200 Subject: [PATCH 09/38] make it work Adjust post-test hooks in PatrolBinding to work with nested groups --- packages/patrol/lib/src/binding.dart | 39 +++++++++++++------------ packages/patrol/lib/src/common.dart | 6 ++-- packages/patrol/lib/src/extensions.dart | 11 +++++++ 3 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 packages/patrol/lib/src/extensions.dart diff --git a/packages/patrol/lib/src/binding.dart b/packages/patrol/lib/src/binding.dart index c8ec6fb30..4237a676c 100644 --- a/packages/patrol/lib/src/binding.dart +++ b/packages/patrol/lib/src/binding.dart @@ -8,10 +8,11 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/common.dart'; import 'package:integration_test/integration_test.dart'; import 'package:patrol/patrol.dart'; +import 'package:patrol/src/extensions.dart'; // ignore: implementation_imports, depend_on_referenced_packages import 'package:test_api/src/backend/invoker.dart'; + // ignore: implementation_imports, depend_on_referenced_packages -import 'package:test_api/src/backend/live_test.dart'; import 'constants.dart' as constants; @@ -45,7 +46,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { PatrolBinding() { final oldTestExceptionReporter = reportTestException; reportTestException = (details, testDescription) { - final currentDartTestFile = _currentDartTestFile; + final currentDartTestFile = _currentDartTest; if (currentDartTestFile != null) { assert(!constants.hotRestartEnabled); _testResults[currentDartTestFile] = @@ -60,7 +61,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { return; } - _currentDartTestFile = Invoker.current!.liveTest.parentGroupName; + _currentDartTest = Invoker.current!.fullCurrentTestName(); }); tearDown(() async { @@ -82,18 +83,27 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { final invoker = Invoker.current!; final nameOfRequestedTest = await patrolAppService.testExecutionRequested; - if (nameOfRequestedTest == _currentDartTestFile) { + + if (nameOfRequestedTest == _currentDartTest) { + logger( + 'finished test $_currentDartTest. Will report its status back to the native side', + ); + final passed = invoker.liveTest.state.result.isPassing; logger( - 'tearDown(): test "$testName" in group "$_currentDartTestFile", passed: $passed', + 'tearDown(): test "$testName" in group "$_currentDartTest", passed: $passed', ); await patrolAppService.markDartTestAsCompleted( - dartFileName: _currentDartTestFile!, + dartFileName: _currentDartTest!, passed: passed, - details: _testResults[_currentDartTestFile!] is Failure - ? (_testResults[_currentDartTestFile!] as Failure?)?.details + details: _testResults[_currentDartTest!] is Failure + ? (_testResults[_currentDartTest!] as Failure?)?.details : null, ); + } else { + logger( + 'finished test $_currentDartTest, but it was not requested, so its status will not be reported back to the native side', + ); } }); } @@ -127,7 +137,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { static PatrolBinding get instance => BindingBase.checkInstance(_instance); static PatrolBinding? _instance; - String? _currentDartTestFile; + String? _currentDartTest; /// Keys are the test descriptions, and values are either [_success] or /// a [Failure]. @@ -164,7 +174,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { @override void attachRootWidget(Widget rootWidget) { assert( - (_currentDartTestFile != null) != (constants.hotRestartEnabled), + (_currentDartTest != null) != (constants.hotRestartEnabled), '_currentDartTestFile can be null if and only if Hot Restart is enabled', ); @@ -185,7 +195,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { left: 4, ), child: Text( - _currentDartTestFile!, + _currentDartTest!, textDirection: TextDirection.ltr, style: const TextStyle(color: Colors.red), ), @@ -197,10 +207,3 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { } } } - -extension on LiveTest { - /// Get the direct parent group of the currently running test. - /// - /// The group's name is the name of the Dart test file the test is defined in. - String get parentGroupName => groups.last.name; -} diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 58d8beea2..d2cd6738f 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -7,6 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:meta/meta.dart'; import 'package:patrol/src/binding.dart'; +import 'package:patrol/src/extensions.dart'; import 'package:patrol/src/native/contracts/contracts.pb.dart'; import 'package:patrol/src/native/contracts/contracts.pbgrpc.dart'; import 'package:patrol/src/native/native.dart'; @@ -110,9 +111,10 @@ if you use nativeAutomation with false, we recommend using patrolWidgetTest()''' // "integration_test/examples" directory, we assume that the name of the // immediate parent group is "examples.example_test". - final parentGroupName = Invoker.current!.liveTest.groups.last.name; + final testName = Invoker.current!.fullCurrentTestName(); + final requestedToExecute = await patrolBinding.patrolAppService - .waitForExecutionRequest(parentGroupName); + .waitForExecutionRequest(testName); if (!requestedToExecute) { return; diff --git a/packages/patrol/lib/src/extensions.dart b/packages/patrol/lib/src/extensions.dart new file mode 100644 index 000000000..a22f66730 --- /dev/null +++ b/packages/patrol/lib/src/extensions.dart @@ -0,0 +1,11 @@ +// ignore: implementation_imports +import 'package:test_api/src/backend/invoker.dart'; + +extension InvokerX on Invoker { + String fullCurrentTestName() { + final parentGroupName = liveTest.groups.last.name; + final testName = liveTest.individualName; + + return '$parentGroupName $testName'; + } +} From 31592ea88d35846180a2a3997f69892b2cc84beb Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 12:03:24 +0200 Subject: [PATCH 10/38] example_test: enter current test name in a text field --- .../main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java | 3 ++- packages/patrol/example/integration_test/example_test.dart | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java index 523573b7c..fc0d93028 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java @@ -56,7 +56,8 @@ public void onCreate(Bundle arguments) { * This default behavior doesn't work with Flutter apps. That's because in Flutter * apps, the tests are in the app itself, so running only the instrumentation * during the initial run is not enough. - * The app must also be run, and queried for Dart tests That's what this method does. + * The app must also be run, and queried for Dart tests. + * That's what this method does. *

*/ public void setUp(Class activityClass) { diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 19d000fcb..267db3552 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -1,3 +1,6 @@ +import 'package:patrol/src/extensions.dart'; +import 'package:test_api/src/backend/invoker.dart'; + import 'common.dart'; void main() { @@ -24,6 +27,10 @@ void main() { Future _testBody(PatrolTester $) async { await createApp($); + + final testName = Invoker.current!.fullCurrentTestName(); + await $(#textField).enterText(testName); + await $.native.pressHome(); await $.native.openApp(); } From c344e02c1e4203482daa1bc1447a921891e450c2 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 14 Aug 2023 14:50:23 +0200 Subject: [PATCH 11/38] move permission-related tests under `integration_test/permissions` --- .../integration_test/{ => permissions}/notifications_test.dart | 2 +- .../{ => permissions}/permissions_location_test.dart | 2 +- .../{ => permissions}/permissions_many_test.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename packages/patrol/example/integration_test/{ => permissions}/notifications_test.dart (96%) rename packages/patrol/example/integration_test/{ => permissions}/permissions_location_test.dart (98%) rename packages/patrol/example/integration_test/{ => permissions}/permissions_many_test.dart (98%) diff --git a/packages/patrol/example/integration_test/notifications_test.dart b/packages/patrol/example/integration_test/permissions/notifications_test.dart similarity index 96% rename from packages/patrol/example/integration_test/notifications_test.dart rename to packages/patrol/example/integration_test/permissions/notifications_test.dart index c51ad1099..27758ce71 100644 --- a/packages/patrol/example/integration_test/notifications_test.dart +++ b/packages/patrol/example/integration_test/permissions/notifications_test.dart @@ -1,4 +1,4 @@ -import 'common.dart'; +import '../common.dart'; void main() { patrol( diff --git a/packages/patrol/example/integration_test/permissions_location_test.dart b/packages/patrol/example/integration_test/permissions/permissions_location_test.dart similarity index 98% rename from packages/patrol/example/integration_test/permissions_location_test.dart rename to packages/patrol/example/integration_test/permissions/permissions_location_test.dart index 172df4cb7..cc312b023 100644 --- a/packages/patrol/example/integration_test/permissions_location_test.dart +++ b/packages/patrol/example/integration_test/permissions/permissions_location_test.dart @@ -3,7 +3,7 @@ import 'dart:io' as io; import 'package:permission_handler/permission_handler.dart'; -import 'common.dart'; +import '../common.dart'; const _timeout = Duration(seconds: 5); // to avoid timeouts on CI diff --git a/packages/patrol/example/integration_test/permissions_many_test.dart b/packages/patrol/example/integration_test/permissions/permissions_many_test.dart similarity index 98% rename from packages/patrol/example/integration_test/permissions_many_test.dart rename to packages/patrol/example/integration_test/permissions/permissions_many_test.dart index f1e5941b2..e9d1c97b5 100644 --- a/packages/patrol/example/integration_test/permissions_many_test.dart +++ b/packages/patrol/example/integration_test/permissions/permissions_many_test.dart @@ -1,6 +1,6 @@ import 'package:permission_handler/permission_handler.dart'; -import 'common.dart'; +import '../common.dart'; const _timeout = Duration(seconds: 5); // to avoid timeouts on CI From 8b2434b6938d6039644504a670272b0031609e32 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 14:33:16 +0200 Subject: [PATCH 12/38] clean up --- packages/patrol/lib/src/common.dart | 18 +++++++++--------- packages/patrol/lib/src/extensions.dart | 5 +++++ packages/patrol/test/internals_test.dart | 4 +--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index d2cd6738f..d4b8f72a6 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -185,7 +185,6 @@ DartTestGroup createDartTestGroup( level: level + 1, ), ); - print('PATROL_DEBUG: Added group: $name'); } else if (entry is Test) { if (entry.name == 'patrol_test_explorer') { // throw StateError('Expected group, got test: ${entry.name}'); @@ -198,7 +197,6 @@ DartTestGroup createDartTestGroup( } groupDTO.tests.add(DartTestCase(name: name)); - print('PATROL_DEBUG: Added test: $name'); } else { // This should really never happen, because Group and Test are the only // subclasses of GroupEntry. @@ -209,6 +207,15 @@ DartTestGroup createDartTestGroup( return groupDTO; } +/// Allows for retrieving the name of a GroupEntry by stripping the names of all ancestor groups. +@internal +String deduplicateGroupEntryName(String parentName, String currentName) { + return currentName.substring( + parentName.length + 1, + currentName.length, + ); +} + void printGroupStructure(DartTestGroup group, int indentation) { final indent = ' ' * indentation; print("$indent-- group: '${group.name}'"); @@ -221,10 +228,3 @@ void printGroupStructure(DartTestGroup group, int indentation) { printGroupStructure(subgroup, indentation + 5); } } - -String deduplicateGroupEntryName(String parentName, String currentName) { - return currentName.substring( - parentName.length + 1, - currentName.length, - ); -} diff --git a/packages/patrol/lib/src/extensions.dart b/packages/patrol/lib/src/extensions.dart index a22f66730..0f241bec9 100644 --- a/packages/patrol/lib/src/extensions.dart +++ b/packages/patrol/lib/src/extensions.dart @@ -1,7 +1,12 @@ +import 'package:meta/meta.dart'; // ignore: implementation_imports import 'package:test_api/src/backend/invoker.dart'; +/// Provides convenience methods for [Invoker]. +@internal extension InvokerX on Invoker { + /// Returns the full name of the current test (names of all ancestor groups + + /// name of the current test). String fullCurrentTestName() { final parentGroupName = liveTest.groups.last.name; final testName = liveTest.individualName; diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index 4841f1f31..0d5954783 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -1,7 +1,7 @@ // ignore_for_file: invalid_use_of_internal_member, depend_on_referenced_packages, implementation_imports import 'package:flutter_test/flutter_test.dart'; import 'package:patrol/src/common.dart' - show createDartTestGroup, deduplicateGroupEntryName, printGroupStructure; + show createDartTestGroup, deduplicateGroupEntryName; import 'package:patrol/src/native/contracts/contracts.pbgrpc.dart'; import 'package:test_api/src/backend/group.dart'; import 'package:test_api/src/backend/invoker.dart'; @@ -92,8 +92,6 @@ void main() { ), ), ); - - printGroupStructure(dartTestGroup, 0); }); }); From af4fbd14803c433239ffb8639a8ab50d471173f0 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 14:51:36 +0200 Subject: [PATCH 13/38] contracts.proto: merge DartTestGroup and DartTestCase into DartGroupEntry --- contracts.proto | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts.proto b/contracts.proto index ec95e6c16..bac3bb8a9 100644 --- a/contracts.proto +++ b/contracts.proto @@ -9,17 +9,19 @@ service PatrolAppService { } message ListDartTestsResponse { - DartTestGroup group = 1; + DartGroupEntry group = 1; } -message DartTestGroup { +message DartGroupEntry { string name = 1; - repeated DartTestCase tests = 2; - repeated DartTestGroup groups = 3; -} + string fullName = 2; + GroupEntryType type = 3; + repeated DartGroupEntry entries = 4; -message DartTestCase { - string name = 1; + enum GroupEntryType { + GROUP = 0; + TEST = 1; + } } message RunDartTestRequest { From a4b3252d73ccec0c5d2cb98a70c7f95689c610e7 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 14:52:48 +0200 Subject: [PATCH 14/38] contracts.proto: regenerate update Kotlin contracts, again --- .../pl/leancode/patrol/ContractsExtensions.kt | 61 +- .../leancode/patrol/contracts/Contracts.java | 964 +++++++----------- .../patrol/contracts/DartGroupEntryKt.kt | 162 +++ .../patrol/contracts/DartTestCaseKt.kt | 50 - .../patrol/contracts/DartTestGroupKt.kt | 192 ---- .../contracts/ListDartTestsResponseKt.kt | 10 +- .../AutomatorServer/contracts.pb.swift | 125 +-- .../src/native/contracts/contracts.pb.dart | 170 ++- .../native/contracts/contracts.pbenum.dart | 29 + .../native/contracts/contracts.pbjson.dart | 50 +- 10 files changed, 765 insertions(+), 1048 deletions(-) create mode 100644 packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt delete mode 100644 packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestCaseKt.kt delete mode 100644 packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestGroupKt.kt diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index bbc5da5e1..cd85fbce2 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -3,26 +3,25 @@ package pl.leancode.patrol import androidx.test.uiautomator.By import androidx.test.uiautomator.BySelector import androidx.test.uiautomator.UiSelector -import pl.leancode.patrol.contracts.Contracts.DartTestCase -import pl.leancode.patrol.contracts.Contracts.DartTestGroup +import pl.leancode.patrol.contracts.Contracts.DartGroupEntry import pl.leancode.patrol.contracts.Contracts.Selector import pl.leancode.patrol.contracts.copy private fun Selector.isEmpty(): Boolean { return ( - !hasText() && - !hasTextStartsWith() && - !hasTextContains() && - !hasClassName() && - !hasContentDescription() && - !hasContentDescriptionStartsWith() && - !hasContentDescriptionContains() && - !hasResourceId() && - !hasInstance() && - !hasEnabled() && - !hasFocused() && - !hasPkg() - ) + !hasText() && + !hasTextStartsWith() && + !hasTextContains() && + !hasClassName() && + !hasContentDescription() && + !hasContentDescriptionStartsWith() && + !hasContentDescriptionContains() && + !hasResourceId() && + !hasInstance() && + !hasEnabled() && + !hasFocused() && + !hasPkg() + ) } fun Selector.toUiSelector(): UiSelector { @@ -189,26 +188,26 @@ fun Selector.toBySelector(): BySelector { /** * Flattens the structure of a DartTestSuite into a flat list of tests. */ -fun DartTestGroup.listTestsFlat(parentGroupName: String = ""): List { - val tests = mutableListOf() +fun DartGroupEntry.listTestsFlat(parentGroupName: String = ""): List { + val tests = mutableListOf() // FIXME: This doesn't preserve the order of groups and tests in Dart! // We should iterate over "group entries", instead of iterating over "groups" and "tests". - for (test in testsList) { - if (parentGroupName.isEmpty()) { - // This case is invalid, because every test will have at least 1 named group - its filename. - throw IllegalStateException("Test $test has no named parent group") - } - - tests.add(test.copy { name = "$parentGroupName ${test.name}" }) - } - - for (group in groupsList) { - if (parentGroupName.isEmpty()) { - tests.addAll(group.listTestsFlat(parentGroupName = group.name)) - } else { - tests.addAll(group.listTestsFlat(parentGroupName = "$parentGroupName ${group.name}")) + for (test in entriesList) { + if (test.type == DartGroupEntry.GroupEntryType.TEST) { + if (parentGroupName.isEmpty()) { + // This case is invalid, because every test will have at least 1 named group - its filename. + throw IllegalStateException("Test $test has no named parent group") + } + + tests.add(test.copy { name = "$parentGroupName ${test.name}" }) + } else if (test.type == DartGroupEntry.GroupEntryType.GROUP) { + if (parentGroupName.isEmpty()) { + tests.addAll(test.listTestsFlat(parentGroupName = test.name)) + } else { + tests.addAll(test.listTestsFlat(parentGroupName = "$parentGroupName ${test.name}")) + } } } diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java index 45ab3ee06..c0334a306 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java @@ -13,15 +13,15 @@ public interface ListDartTestsResponseOrBuilder extends com.google.protobuf.MessageLiteOrBuilder { /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; * @return Whether the group field is set. */ boolean hasGroup(); /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; * @return The group. */ - pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroup(); + pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup(); } /** * Protobuf type {@code patrol.ListDartTestsResponse} @@ -34,46 +34,46 @@ public static final class ListDartTestsResponse extends private ListDartTestsResponse() { } public static final int GROUP_FIELD_NUMBER = 1; - private pl.leancode.patrol.contracts.Contracts.DartTestGroup group_; + private pl.leancode.patrol.contracts.Contracts.DartGroupEntry group_; /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ @java.lang.Override public boolean hasGroup() { return group_ != null; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroup() { - return group_ == null ? pl.leancode.patrol.contracts.Contracts.DartTestGroup.getDefaultInstance() : group_; + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup() { + return group_ == null ? pl.leancode.patrol.contracts.Contracts.DartGroupEntry.getDefaultInstance() : group_; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ - private void setGroup(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + private void setGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); group_ = value; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ @java.lang.SuppressWarnings({"ReferenceEquality"}) - private void mergeGroup(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + private void mergeGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); if (group_ != null && - group_ != pl.leancode.patrol.contracts.Contracts.DartTestGroup.getDefaultInstance()) { + group_ != pl.leancode.patrol.contracts.Contracts.DartGroupEntry.getDefaultInstance()) { group_ = - pl.leancode.patrol.contracts.Contracts.DartTestGroup.newBuilder(group_).mergeFrom(value).buildPartial(); + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.newBuilder(group_).mergeFrom(value).buildPartial(); } else { group_ = value; } } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ private void clearGroup() { group_ = null; @@ -177,46 +177,46 @@ private Builder() { /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ @java.lang.Override public boolean hasGroup() { return instance.hasGroup(); } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroup() { + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup() { return instance.getGroup(); } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ - public Builder setGroup(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + public Builder setGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); instance.setGroup(value); return this; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ public Builder setGroup( - pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder builderForValue) { + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { copyOnWrite(); instance.setGroup(builderForValue.build()); return this; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ - public Builder mergeGroup(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + public Builder mergeGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); instance.mergeGroup(value); return this; } /** - * .patrol.DartTestGroup group = 1; + * .patrol.DartGroupEntry group = 1; */ public Builder clearGroup() { copyOnWrite(); instance.clearGroup(); @@ -297,8 +297,8 @@ public static com.google.protobuf.Parser parser() { } } - public interface DartTestGroupOrBuilder extends - // @@protoc_insertion_point(interface_extends:patrol.DartTestGroup) + public interface DartGroupEntryOrBuilder extends + // @@protoc_insertion_point(interface_extends:patrol.DartGroupEntry) com.google.protobuf.MessageLiteOrBuilder { /** @@ -314,46 +314,144 @@ public interface DartTestGroupOrBuilder extends getNameBytes(); /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The fullName. */ - java.util.List - getTestsList(); + java.lang.String getFullName(); /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The bytes for fullName. */ - pl.leancode.patrol.contracts.Contracts.DartTestCase getTests(int index); + com.google.protobuf.ByteString + getFullNameBytes(); + + /** + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The enum numeric value on the wire for type. + */ + int getTypeValue(); /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The type. */ - int getTestsCount(); + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getType(); /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - java.util.List - getGroupsList(); + java.util.List + getEntriesList(); /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroups(int index); + pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index); /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - int getGroupsCount(); + int getEntriesCount(); } /** - * Protobuf type {@code patrol.DartTestGroup} + * Protobuf type {@code patrol.DartGroupEntry} */ - public static final class DartTestGroup extends + public static final class DartGroupEntry extends com.google.protobuf.GeneratedMessageLite< - DartTestGroup, DartTestGroup.Builder> implements - // @@protoc_insertion_point(message_implements:patrol.DartTestGroup) - DartTestGroupOrBuilder { - private DartTestGroup() { + DartGroupEntry, DartGroupEntry.Builder> implements + // @@protoc_insertion_point(message_implements:patrol.DartGroupEntry) + DartGroupEntryOrBuilder { + private DartGroupEntry() { name_ = ""; - tests_ = emptyProtobufList(); - groups_ = emptyProtobufList(); + fullName_ = ""; + entries_ = emptyProtobufList(); } + /** + * Protobuf enum {@code patrol.DartGroupEntry.GroupEntryType} + */ + public enum GroupEntryType + implements com.google.protobuf.Internal.EnumLite { + /** + * GROUP = 0; + */ + GROUP(0), + /** + * TEST = 1; + */ + TEST(1), + UNRECOGNIZED(-1), + ; + + /** + * GROUP = 0; + */ + public static final int GROUP_VALUE = 0; + /** + * TEST = 1; + */ + public static final int TEST_VALUE = 1; + + + @java.lang.Override + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static GroupEntryType valueOf(int value) { + return forNumber(value); + } + + public static GroupEntryType forNumber(int value) { + switch (value) { + case 0: return GROUP; + case 1: return TEST; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + GroupEntryType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + @java.lang.Override + public GroupEntryType findValueByNumber(int number) { + return GroupEntryType.forNumber(number); + } + }; + + public static com.google.protobuf.Internal.EnumVerifier + internalGetVerifier() { + return GroupEntryTypeVerifier.INSTANCE; + } + + private static final class GroupEntryTypeVerifier implements + com.google.protobuf.Internal.EnumVerifier { + static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new GroupEntryTypeVerifier(); + @java.lang.Override + public boolean isInRange(int number) { + return GroupEntryType.forNumber(number) != null; + } + }; + + private final int value; + + private GroupEntryType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:patrol.DartGroupEntry.GroupEntryType) + } + public static final int NAME_FIELD_NUMBER = 1; private java.lang.String name_; /** @@ -401,238 +499,233 @@ private void setNameBytes( } - public static final int TESTS_FIELD_NUMBER = 2; - private com.google.protobuf.Internal.ProtobufList tests_; + public static final int FULLNAME_FIELD_NUMBER = 2; + private java.lang.String fullName_; /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The fullName. */ @java.lang.Override - public java.util.List getTestsList() { - return tests_; - } - /** - * repeated .patrol.DartTestCase tests = 2; - */ - public java.util.List - getTestsOrBuilderList() { - return tests_; + public java.lang.String getFullName() { + return fullName_; } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The bytes for fullName. */ @java.lang.Override - public int getTestsCount() { - return tests_.size(); + public com.google.protobuf.ByteString + getFullNameBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(fullName_); } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @param value The fullName to set. */ - @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestCase getTests(int index) { - return tests_.get(index); + private void setFullName( + java.lang.String value) { + java.lang.Class valueClass = value.getClass(); + + fullName_ = value; } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; */ - public pl.leancode.patrol.contracts.Contracts.DartTestCaseOrBuilder getTestsOrBuilder( - int index) { - return tests_.get(index); - } - private void ensureTestsIsMutable() { - com.google.protobuf.Internal.ProtobufList tmp = tests_; - if (!tmp.isModifiable()) { - tests_ = - com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp); - } - } + private void clearFullName() { + fullName_ = getDefaultInstance().getFullName(); + } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @param value The bytes for fullName to set. */ - private void setTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase value) { - value.getClass(); - ensureTestsIsMutable(); - tests_.set(index, value); + private void setFullNameBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + fullName_ = value.toStringUtf8(); + } + + public static final int TYPE_FIELD_NUMBER = 3; + private int type_; /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The enum numeric value on the wire for type. */ - private void addTests(pl.leancode.patrol.contracts.Contracts.DartTestCase value) { - value.getClass(); - ensureTestsIsMutable(); - tests_.add(value); + @java.lang.Override + public int getTypeValue() { + return type_; } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The type. */ - private void addTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase value) { - value.getClass(); - ensureTestsIsMutable(); - tests_.add(index, value); + @java.lang.Override + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getType() { + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType result = pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType.forNumber(type_); + return result == null ? pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType.UNRECOGNIZED : result; } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @param value The enum numeric value on the wire for type to set. */ - private void addAllTests( - java.lang.Iterable values) { - ensureTestsIsMutable(); - com.google.protobuf.AbstractMessageLite.addAll( - values, tests_); + private void setTypeValue(int value) { + type_ = value; } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @param value The type to set. */ - private void clearTests() { - tests_ = emptyProtobufList(); + private void setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType value) { + type_ = value.getNumber(); + } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; */ - private void removeTests(int index) { - ensureTestsIsMutable(); - tests_.remove(index); + private void clearType() { + + type_ = 0; } - public static final int GROUPS_FIELD_NUMBER = 3; - private com.google.protobuf.Internal.ProtobufList groups_; + public static final int ENTRIES_FIELD_NUMBER = 4; + private com.google.protobuf.Internal.ProtobufList entries_; /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public java.util.List getGroupsList() { - return groups_; + public java.util.List getEntriesList() { + return entries_; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public java.util.List - getGroupsOrBuilderList() { - return groups_; + public java.util.List + getEntriesOrBuilderList() { + return entries_; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public int getGroupsCount() { - return groups_.size(); + public int getEntriesCount() { + return entries_.size(); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroups(int index) { - return groups_.get(index); + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { + return entries_.get(index); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public pl.leancode.patrol.contracts.Contracts.DartTestGroupOrBuilder getGroupsOrBuilder( + public pl.leancode.patrol.contracts.Contracts.DartGroupEntryOrBuilder getEntriesOrBuilder( int index) { - return groups_.get(index); + return entries_.get(index); } - private void ensureGroupsIsMutable() { - com.google.protobuf.Internal.ProtobufList tmp = groups_; + private void ensureEntriesIsMutable() { + com.google.protobuf.Internal.ProtobufList tmp = entries_; if (!tmp.isModifiable()) { - groups_ = + entries_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp); } } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void setGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + private void setEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); - ensureGroupsIsMutable(); - groups_.set(index, value); + ensureEntriesIsMutable(); + entries_.set(index, value); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void addGroups(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + private void addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); - ensureGroupsIsMutable(); - groups_.add(value); + ensureEntriesIsMutable(); + entries_.add(value); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void addGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + private void addEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); - ensureGroupsIsMutable(); - groups_.add(index, value); + ensureEntriesIsMutable(); + entries_.add(index, value); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void addAllGroups( - java.lang.Iterable values) { - ensureGroupsIsMutable(); + private void addAllEntries( + java.lang.Iterable values) { + ensureEntriesIsMutable(); com.google.protobuf.AbstractMessageLite.addAll( - values, groups_); + values, entries_); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void clearGroups() { - groups_ = emptyProtobufList(); + private void clearEntries() { + entries_ = emptyProtobufList(); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - private void removeGroups(int index) { - ensureGroupsIsMutable(); - groups_.remove(index); + private void removeEntries(int index) { + ensureEntriesIsMutable(); + entries_.remove(index); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom(byte[] data) + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom(java.io.InputStream input) + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -640,24 +733,24 @@ public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( DEFAULT_INSTANCE, input, extensionRegistry); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseDelimitedFrom(java.io.InputStream input) + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseDelimitedFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -668,19 +761,19 @@ public static pl.leancode.patrol.contracts.Contracts.DartTestGroup parseFrom( public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } - public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartTestGroup prototype) { + public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartGroupEntry prototype) { return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** - * Protobuf type {@code patrol.DartTestGroup} + * Protobuf type {@code patrol.DartGroupEntry} */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - pl.leancode.patrol.contracts.Contracts.DartTestGroup, Builder> implements - // @@protoc_insertion_point(builder_implements:patrol.DartTestGroup) - pl.leancode.patrol.contracts.Contracts.DartTestGroupOrBuilder { - // Construct using pl.leancode.patrol.contracts.Contracts.DartTestGroup.newBuilder() + pl.leancode.patrol.contracts.Contracts.DartGroupEntry, Builder> implements + // @@protoc_insertion_point(builder_implements:patrol.DartGroupEntry) + pl.leancode.patrol.contracts.Contracts.DartGroupEntryOrBuilder { + // Construct using pl.leancode.patrol.contracts.Contracts.DartGroupEntry.newBuilder() private Builder() { super(DEFAULT_INSTANCE); } @@ -736,509 +829,203 @@ public Builder setNameBytes( } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The fullName. */ @java.lang.Override - public java.util.List getTestsList() { - return java.util.Collections.unmodifiableList( - instance.getTestsList()); + public java.lang.String getFullName() { + return instance.getFullName(); } /** - * repeated .patrol.DartTestCase tests = 2; - */ - @java.lang.Override - public int getTestsCount() { - return instance.getTestsCount(); - }/** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return The bytes for fullName. */ @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestCase getTests(int index) { - return instance.getTests(index); - } - /** - * repeated .patrol.DartTestCase tests = 2; - */ - public Builder setTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase value) { - copyOnWrite(); - instance.setTests(index, value); - return this; + public com.google.protobuf.ByteString + getFullNameBytes() { + return instance.getFullNameBytes(); } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @param value The fullName to set. + * @return This builder for chaining. */ - public Builder setTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase.Builder builderForValue) { + public Builder setFullName( + java.lang.String value) { copyOnWrite(); - instance.setTests(index, - builderForValue.build()); + instance.setFullName(value); return this; } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @return This builder for chaining. */ - public Builder addTests(pl.leancode.patrol.contracts.Contracts.DartTestCase value) { + public Builder clearFullName() { copyOnWrite(); - instance.addTests(value); + instance.clearFullName(); return this; } /** - * repeated .patrol.DartTestCase tests = 2; + * string fullName = 2; + * @param value The bytes for fullName to set. + * @return This builder for chaining. */ - public Builder addTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase value) { + public Builder setFullNameBytes( + com.google.protobuf.ByteString value) { copyOnWrite(); - instance.addTests(index, value); + instance.setFullNameBytes(value); return this; } + /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The enum numeric value on the wire for type. */ - public Builder addTests( - pl.leancode.patrol.contracts.Contracts.DartTestCase.Builder builderForValue) { - copyOnWrite(); - instance.addTests(builderForValue.build()); - return this; + @java.lang.Override + public int getTypeValue() { + return instance.getTypeValue(); } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @param value The type to set. + * @return This builder for chaining. */ - public Builder addTests( - int index, pl.leancode.patrol.contracts.Contracts.DartTestCase.Builder builderForValue) { + public Builder setTypeValue(int value) { copyOnWrite(); - instance.addTests(index, - builderForValue.build()); + instance.setTypeValue(value); return this; } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return The type. */ - public Builder addAllTests( - java.lang.Iterable values) { - copyOnWrite(); - instance.addAllTests(values); - return this; + @java.lang.Override + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getType() { + return instance.getType(); } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @param value The enum numeric value on the wire for type to set. + * @return This builder for chaining. */ - public Builder clearTests() { + public Builder setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType value) { copyOnWrite(); - instance.clearTests(); + instance.setType(value); return this; } /** - * repeated .patrol.DartTestCase tests = 2; + * .patrol.DartGroupEntry.GroupEntryType type = 3; + * @return This builder for chaining. */ - public Builder removeTests(int index) { + public Builder clearType() { copyOnWrite(); - instance.removeTests(index); + instance.clearType(); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public java.util.List getGroupsList() { + public java.util.List getEntriesList() { return java.util.Collections.unmodifiableList( - instance.getGroupsList()); + instance.getEntriesList()); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public int getGroupsCount() { - return instance.getGroupsCount(); + public int getEntriesCount() { + return instance.getEntriesCount(); }/** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override - public pl.leancode.patrol.contracts.Contracts.DartTestGroup getGroups(int index) { - return instance.getGroups(index); + public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { + return instance.getEntries(index); } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder setGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + public Builder setEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); - instance.setGroups(index, value); + instance.setEntries(index, value); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder setGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder builderForValue) { + public Builder setEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { copyOnWrite(); - instance.setGroups(index, + instance.setEntries(index, builderForValue.build()); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder addGroups(pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + public Builder addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); - instance.addGroups(value); + instance.addEntries(value); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder addGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup value) { + public Builder addEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); - instance.addGroups(index, value); + instance.addEntries(index, value); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder addGroups( - pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder builderForValue) { + public Builder addEntries( + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { copyOnWrite(); - instance.addGroups(builderForValue.build()); + instance.addEntries(builderForValue.build()); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder addGroups( - int index, pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder builderForValue) { + public Builder addEntries( + int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { copyOnWrite(); - instance.addGroups(index, + instance.addEntries(index, builderForValue.build()); return this; } /** - * repeated .patrol.DartTestGroup groups = 3; - */ - public Builder addAllGroups( - java.lang.Iterable values) { - copyOnWrite(); - instance.addAllGroups(values); - return this; - } - /** - * repeated .patrol.DartTestGroup groups = 3; - */ - public Builder clearGroups() { - copyOnWrite(); - instance.clearGroups(); - return this; - } - /** - * repeated .patrol.DartTestGroup groups = 3; - */ - public Builder removeGroups(int index) { - copyOnWrite(); - instance.removeGroups(index); - return this; - } - - // @@protoc_insertion_point(builder_scope:patrol.DartTestGroup) - } - @java.lang.Override - @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) - protected final java.lang.Object dynamicMethod( - com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, - java.lang.Object arg0, java.lang.Object arg1) { - switch (method) { - case NEW_MUTABLE_INSTANCE: { - return new pl.leancode.patrol.contracts.Contracts.DartTestGroup(); - } - case NEW_BUILDER: { - return new Builder(); - } - case BUILD_MESSAGE_INFO: { - java.lang.Object[] objects = new java.lang.Object[] { - "name_", - "tests_", - pl.leancode.patrol.contracts.Contracts.DartTestCase.class, - "groups_", - pl.leancode.patrol.contracts.Contracts.DartTestGroup.class, - }; - java.lang.String info = - "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0002\u0000\u0001\u0208\u0002\u001b" + - "\u0003\u001b"; - return newMessageInfo(DEFAULT_INSTANCE, info, objects); - } - // fall through - case GET_DEFAULT_INSTANCE: { - return DEFAULT_INSTANCE; - } - case GET_PARSER: { - com.google.protobuf.Parser parser = PARSER; - if (parser == null) { - synchronized (pl.leancode.patrol.contracts.Contracts.DartTestGroup.class) { - parser = PARSER; - if (parser == null) { - parser = - new DefaultInstanceBasedParser( - DEFAULT_INSTANCE); - PARSER = parser; - } - } - } - return parser; - } - case GET_MEMOIZED_IS_INITIALIZED: { - return (byte) 1; - } - case SET_MEMOIZED_IS_INITIALIZED: { - return null; - } - } - throw new UnsupportedOperationException(); - } - - - // @@protoc_insertion_point(class_scope:patrol.DartTestGroup) - private static final pl.leancode.patrol.contracts.Contracts.DartTestGroup DEFAULT_INSTANCE; - static { - DartTestGroup defaultInstance = new DartTestGroup(); - // New instances are implicitly immutable so no need to make - // immutable. - DEFAULT_INSTANCE = defaultInstance; - com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( - DartTestGroup.class, defaultInstance); - } - - public static pl.leancode.patrol.contracts.Contracts.DartTestGroup getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static volatile com.google.protobuf.Parser PARSER; - - public static com.google.protobuf.Parser parser() { - return DEFAULT_INSTANCE.getParserForType(); - } - } - - public interface DartTestCaseOrBuilder extends - // @@protoc_insertion_point(interface_extends:patrol.DartTestCase) - com.google.protobuf.MessageLiteOrBuilder { - - /** - * string name = 1; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 1; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); - } - /** - * Protobuf type {@code patrol.DartTestCase} - */ - public static final class DartTestCase extends - com.google.protobuf.GeneratedMessageLite< - DartTestCase, DartTestCase.Builder> implements - // @@protoc_insertion_point(message_implements:patrol.DartTestCase) - DartTestCaseOrBuilder { - private DartTestCase() { - name_ = ""; - } - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.String name_; - /** - * string name = 1; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - return name_; - } - /** - * string name = 1; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - return com.google.protobuf.ByteString.copyFromUtf8(name_); - } - /** - * string name = 1; - * @param value The name to set. - */ - private void setName( - java.lang.String value) { - java.lang.Class valueClass = value.getClass(); - - name_ = value; - } - /** - * string name = 1; - */ - private void clearName() { - - name_ = getDefaultInstance().getName(); - } - /** - * string name = 1; - * @param value The bytes for name to set. - */ - private void setNameBytes( - com.google.protobuf.ByteString value) { - checkByteStringIsUtf8(value); - name_ = value.toStringUtf8(); - - } - - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); - } - - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input); - } - - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); - } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); - } - - public static Builder newBuilder() { - return (Builder) DEFAULT_INSTANCE.createBuilder(); - } - public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartTestCase prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); - } - - /** - * Protobuf type {@code patrol.DartTestCase} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - pl.leancode.patrol.contracts.Contracts.DartTestCase, Builder> implements - // @@protoc_insertion_point(builder_implements:patrol.DartTestCase) - pl.leancode.patrol.contracts.Contracts.DartTestCaseOrBuilder { - // Construct using pl.leancode.patrol.contracts.Contracts.DartTestCase.newBuilder() - private Builder() { - super(DEFAULT_INSTANCE); - } - - - /** - * string name = 1; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - return instance.getName(); - } - /** - * string name = 1; - * @return The bytes for name. + * repeated .patrol.DartGroupEntry entries = 4; */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - return instance.getNameBytes(); - } - /** - * string name = 1; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { + public Builder addAllEntries( + java.lang.Iterable values) { copyOnWrite(); - instance.setName(value); + instance.addAllEntries(values); return this; } /** - * string name = 1; - * @return This builder for chaining. + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder clearName() { + public Builder clearEntries() { copyOnWrite(); - instance.clearName(); + instance.clearEntries(); return this; } /** - * string name = 1; - * @param value The bytes for name to set. - * @return This builder for chaining. + * repeated .patrol.DartGroupEntry entries = 4; */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { + public Builder removeEntries(int index) { copyOnWrite(); - instance.setNameBytes(value); + instance.removeEntries(index); return this; } - // @@protoc_insertion_point(builder_scope:patrol.DartTestCase) + // @@protoc_insertion_point(builder_scope:patrol.DartGroupEntry) } @java.lang.Override @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) @@ -1247,7 +1034,7 @@ protected final java.lang.Object dynamicMethod( java.lang.Object arg0, java.lang.Object arg1) { switch (method) { case NEW_MUTABLE_INSTANCE: { - return new pl.leancode.patrol.contracts.Contracts.DartTestCase(); + return new pl.leancode.patrol.contracts.Contracts.DartGroupEntry(); } case NEW_BUILDER: { return new Builder(); @@ -1255,9 +1042,14 @@ protected final java.lang.Object dynamicMethod( case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { "name_", + "fullName_", + "type_", + "entries_", + pl.leancode.patrol.contracts.Contracts.DartGroupEntry.class, }; java.lang.String info = - "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u0208"; + "\u0000\u0004\u0000\u0000\u0001\u0004\u0004\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + + "\u0003\f\u0004\u001b"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -1265,13 +1057,13 @@ protected final java.lang.Object dynamicMethod( return DEFAULT_INSTANCE; } case GET_PARSER: { - com.google.protobuf.Parser parser = PARSER; + com.google.protobuf.Parser parser = PARSER; if (parser == null) { - synchronized (pl.leancode.patrol.contracts.Contracts.DartTestCase.class) { + synchronized (pl.leancode.patrol.contracts.Contracts.DartGroupEntry.class) { parser = PARSER; if (parser == null) { parser = - new DefaultInstanceBasedParser( + new DefaultInstanceBasedParser( DEFAULT_INSTANCE); PARSER = parser; } @@ -1290,24 +1082,24 @@ protected final java.lang.Object dynamicMethod( } - // @@protoc_insertion_point(class_scope:patrol.DartTestCase) - private static final pl.leancode.patrol.contracts.Contracts.DartTestCase DEFAULT_INSTANCE; + // @@protoc_insertion_point(class_scope:patrol.DartGroupEntry) + private static final pl.leancode.patrol.contracts.Contracts.DartGroupEntry DEFAULT_INSTANCE; static { - DartTestCase defaultInstance = new DartTestCase(); + DartGroupEntry defaultInstance = new DartGroupEntry(); // New instances are implicitly immutable so no need to make // immutable. DEFAULT_INSTANCE = defaultInstance; com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( - DartTestCase.class, defaultInstance); + DartGroupEntry.class, defaultInstance); } - public static pl.leancode.patrol.contracts.Contracts.DartTestCase getDefaultInstance() { + public static pl.leancode.patrol.contracts.Contracts.DartGroupEntry getDefaultInstance() { return DEFAULT_INSTANCE; } - private static volatile com.google.protobuf.Parser PARSER; + private static volatile com.google.protobuf.Parser PARSER; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return DEFAULT_INSTANCE.getParserForType(); } } diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt new file mode 100644 index 000000000..42eba2f8e --- /dev/null +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt @@ -0,0 +1,162 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: contracts.proto + +// Generated files should ignore deprecation warnings +@file:Suppress("DEPRECATION") +package pl.leancode.patrol.contracts; + +@kotlin.jvm.JvmName("-initializedartGroupEntry") +public inline fun dartGroupEntry(block: pl.leancode.patrol.contracts.DartGroupEntryKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartGroupEntry = + pl.leancode.patrol.contracts.DartGroupEntryKt.Dsl._create(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.newBuilder()).apply { block() }._build() +/** + * Protobuf type `patrol.DartGroupEntry` + */ +public object DartGroupEntryKt { + @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) + @com.google.protobuf.kotlin.ProtoDslMarker + public class Dsl private constructor( + private val _builder: pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder + ) { + public companion object { + @kotlin.jvm.JvmSynthetic + @kotlin.PublishedApi + internal fun _create(builder: pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder): Dsl = Dsl(builder) + } + + @kotlin.jvm.JvmSynthetic + @kotlin.PublishedApi + internal fun _build(): pl.leancode.patrol.contracts.Contracts.DartGroupEntry = _builder.build() + + /** + * `string name = 1;` + */ + public var name: kotlin.String + @JvmName("getName") + get() = _builder.getName() + @JvmName("setName") + set(value) { + _builder.setName(value) + } + /** + * `string name = 1;` + */ + public fun clearName() { + _builder.clearName() + } + + /** + * `string fullName = 2;` + */ + public var fullName: kotlin.String + @JvmName("getFullName") + get() = _builder.getFullName() + @JvmName("setFullName") + set(value) { + _builder.setFullName(value) + } + /** + * `string fullName = 2;` + */ + public fun clearFullName() { + _builder.clearFullName() + } + + /** + * `.patrol.DartGroupEntry.GroupEntryType type = 3;` + */ + public var type: pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType + @JvmName("getType") + get() = _builder.getType() + @JvmName("setType") + set(value) { + _builder.setType(value) + } + public var typeValue: kotlin.Int + @JvmName("getTypeValue") + get() = _builder.getTypeValue() + @JvmName("setTypeValue") + set(value) { + _builder.setTypeValue(value) + } + /** + * `.patrol.DartGroupEntry.GroupEntryType type = 3;` + */ + public fun clearType() { + _builder.clearType() + } + + /** + * An uninstantiable, behaviorless type to represent the field in + * generics. + */ + @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) + public class EntriesProxy private constructor() : com.google.protobuf.kotlin.DslProxy() + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + */ + public val entries: com.google.protobuf.kotlin.DslList + @kotlin.jvm.JvmSynthetic + get() = com.google.protobuf.kotlin.DslList( + _builder.getEntriesList() + ) + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + * @param value The entries to add. + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("addEntries") + public fun com.google.protobuf.kotlin.DslList.add(value: pl.leancode.patrol.contracts.Contracts.DartGroupEntry) { + _builder.addEntries(value) + } + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + * @param value The entries to add. + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("plusAssignEntries") + @Suppress("NOTHING_TO_INLINE") + public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: pl.leancode.patrol.contracts.Contracts.DartGroupEntry) { + add(value) + } + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + * @param values The entries to add. + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("addAllEntries") + public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) { + _builder.addAllEntries(values) + } + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + * @param values The entries to add. + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("plusAssignAllEntries") + @Suppress("NOTHING_TO_INLINE") + public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) { + addAll(values) + } + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + * @param index The index to set the value at. + * @param value The entries to set. + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("setEntries") + public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: pl.leancode.patrol.contracts.Contracts.DartGroupEntry) { + _builder.setEntries(index, value) + } + /** + * `repeated .patrol.DartGroupEntry entries = 4;` + */ + @kotlin.jvm.JvmSynthetic + @kotlin.jvm.JvmName("clearEntries") + public fun com.google.protobuf.kotlin.DslList.clear() { + _builder.clearEntries() + } + } +} +public inline fun pl.leancode.patrol.contracts.Contracts.DartGroupEntry.copy(block: pl.leancode.patrol.contracts.DartGroupEntryKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartGroupEntry = + pl.leancode.patrol.contracts.DartGroupEntryKt.Dsl._create(this.toBuilder()).apply { block() }._build() + diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestCaseKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestCaseKt.kt deleted file mode 100644 index d9213b71c..000000000 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestCaseKt.kt +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: contracts.proto - -// Generated files should ignore deprecation warnings -@file:Suppress("DEPRECATION") -package pl.leancode.patrol.contracts; - -@kotlin.jvm.JvmName("-initializedartTestCase") -public inline fun dartTestCase(block: pl.leancode.patrol.contracts.DartTestCaseKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartTestCase = - pl.leancode.patrol.contracts.DartTestCaseKt.Dsl._create(pl.leancode.patrol.contracts.Contracts.DartTestCase.newBuilder()).apply { block() }._build() -/** - * Protobuf type `patrol.DartTestCase` - */ -public object DartTestCaseKt { - @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) - @com.google.protobuf.kotlin.ProtoDslMarker - public class Dsl private constructor( - private val _builder: pl.leancode.patrol.contracts.Contracts.DartTestCase.Builder - ) { - public companion object { - @kotlin.jvm.JvmSynthetic - @kotlin.PublishedApi - internal fun _create(builder: pl.leancode.patrol.contracts.Contracts.DartTestCase.Builder): Dsl = Dsl(builder) - } - - @kotlin.jvm.JvmSynthetic - @kotlin.PublishedApi - internal fun _build(): pl.leancode.patrol.contracts.Contracts.DartTestCase = _builder.build() - - /** - * `string name = 1;` - */ - public var name: kotlin.String - @JvmName("getName") - get() = _builder.getName() - @JvmName("setName") - set(value) { - _builder.setName(value) - } - /** - * `string name = 1;` - */ - public fun clearName() { - _builder.clearName() - } - } -} -public inline fun pl.leancode.patrol.contracts.Contracts.DartTestCase.copy(block: pl.leancode.patrol.contracts.DartTestCaseKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartTestCase = - pl.leancode.patrol.contracts.DartTestCaseKt.Dsl._create(this.toBuilder()).apply { block() }._build() - diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestGroupKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestGroupKt.kt deleted file mode 100644 index 2bf1e489c..000000000 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartTestGroupKt.kt +++ /dev/null @@ -1,192 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: contracts.proto - -// Generated files should ignore deprecation warnings -@file:Suppress("DEPRECATION") -package pl.leancode.patrol.contracts; - -@kotlin.jvm.JvmName("-initializedartTestGroup") -public inline fun dartTestGroup(block: pl.leancode.patrol.contracts.DartTestGroupKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartTestGroup = - pl.leancode.patrol.contracts.DartTestGroupKt.Dsl._create(pl.leancode.patrol.contracts.Contracts.DartTestGroup.newBuilder()).apply { block() }._build() -/** - * Protobuf type `patrol.DartTestGroup` - */ -public object DartTestGroupKt { - @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) - @com.google.protobuf.kotlin.ProtoDslMarker - public class Dsl private constructor( - private val _builder: pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder - ) { - public companion object { - @kotlin.jvm.JvmSynthetic - @kotlin.PublishedApi - internal fun _create(builder: pl.leancode.patrol.contracts.Contracts.DartTestGroup.Builder): Dsl = Dsl(builder) - } - - @kotlin.jvm.JvmSynthetic - @kotlin.PublishedApi - internal fun _build(): pl.leancode.patrol.contracts.Contracts.DartTestGroup = _builder.build() - - /** - * `string name = 1;` - */ - public var name: kotlin.String - @JvmName("getName") - get() = _builder.getName() - @JvmName("setName") - set(value) { - _builder.setName(value) - } - /** - * `string name = 1;` - */ - public fun clearName() { - _builder.clearName() - } - - /** - * An uninstantiable, behaviorless type to represent the field in - * generics. - */ - @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) - public class TestsProxy private constructor() : com.google.protobuf.kotlin.DslProxy() - /** - * `repeated .patrol.DartTestCase tests = 2;` - */ - public val tests: com.google.protobuf.kotlin.DslList - @kotlin.jvm.JvmSynthetic - get() = com.google.protobuf.kotlin.DslList( - _builder.getTestsList() - ) - /** - * `repeated .patrol.DartTestCase tests = 2;` - * @param value The tests to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("addTests") - public fun com.google.protobuf.kotlin.DslList.add(value: pl.leancode.patrol.contracts.Contracts.DartTestCase) { - _builder.addTests(value) - } - /** - * `repeated .patrol.DartTestCase tests = 2;` - * @param value The tests to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("plusAssignTests") - @Suppress("NOTHING_TO_INLINE") - public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: pl.leancode.patrol.contracts.Contracts.DartTestCase) { - add(value) - } - /** - * `repeated .patrol.DartTestCase tests = 2;` - * @param values The tests to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("addAllTests") - public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) { - _builder.addAllTests(values) - } - /** - * `repeated .patrol.DartTestCase tests = 2;` - * @param values The tests to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("plusAssignAllTests") - @Suppress("NOTHING_TO_INLINE") - public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) { - addAll(values) - } - /** - * `repeated .patrol.DartTestCase tests = 2;` - * @param index The index to set the value at. - * @param value The tests to set. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("setTests") - public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: pl.leancode.patrol.contracts.Contracts.DartTestCase) { - _builder.setTests(index, value) - } - /** - * `repeated .patrol.DartTestCase tests = 2;` - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("clearTests") - public fun com.google.protobuf.kotlin.DslList.clear() { - _builder.clearTests() - } - - /** - * An uninstantiable, behaviorless type to represent the field in - * generics. - */ - @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) - public class GroupsProxy private constructor() : com.google.protobuf.kotlin.DslProxy() - /** - * `repeated .patrol.DartTestGroup groups = 3;` - */ - public val groups: com.google.protobuf.kotlin.DslList - @kotlin.jvm.JvmSynthetic - get() = com.google.protobuf.kotlin.DslList( - _builder.getGroupsList() - ) - /** - * `repeated .patrol.DartTestGroup groups = 3;` - * @param value The groups to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("addGroups") - public fun com.google.protobuf.kotlin.DslList.add(value: pl.leancode.patrol.contracts.Contracts.DartTestGroup) { - _builder.addGroups(value) - } - /** - * `repeated .patrol.DartTestGroup groups = 3;` - * @param value The groups to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("plusAssignGroups") - @Suppress("NOTHING_TO_INLINE") - public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: pl.leancode.patrol.contracts.Contracts.DartTestGroup) { - add(value) - } - /** - * `repeated .patrol.DartTestGroup groups = 3;` - * @param values The groups to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("addAllGroups") - public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) { - _builder.addAllGroups(values) - } - /** - * `repeated .patrol.DartTestGroup groups = 3;` - * @param values The groups to add. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("plusAssignAllGroups") - @Suppress("NOTHING_TO_INLINE") - public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) { - addAll(values) - } - /** - * `repeated .patrol.DartTestGroup groups = 3;` - * @param index The index to set the value at. - * @param value The groups to set. - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("setGroups") - public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: pl.leancode.patrol.contracts.Contracts.DartTestGroup) { - _builder.setGroups(index, value) - } - /** - * `repeated .patrol.DartTestGroup groups = 3;` - */ - @kotlin.jvm.JvmSynthetic - @kotlin.jvm.JvmName("clearGroups") - public fun com.google.protobuf.kotlin.DslList.clear() { - _builder.clearGroups() - } - } -} -public inline fun pl.leancode.patrol.contracts.Contracts.DartTestGroup.copy(block: pl.leancode.patrol.contracts.DartTestGroupKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.DartTestGroup = - pl.leancode.patrol.contracts.DartTestGroupKt.Dsl._create(this.toBuilder()).apply { block() }._build() - diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/ListDartTestsResponseKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/ListDartTestsResponseKt.kt index b40a14ecc..cc52ba79d 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/ListDartTestsResponseKt.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/ListDartTestsResponseKt.kt @@ -28,9 +28,9 @@ public object ListDartTestsResponseKt { internal fun _build(): pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse = _builder.build() /** - * `.patrol.DartTestGroup group = 1;` + * `.patrol.DartGroupEntry group = 1;` */ - public var group: pl.leancode.patrol.contracts.Contracts.DartTestGroup + public var group: pl.leancode.patrol.contracts.Contracts.DartGroupEntry @JvmName("getGroup") get() = _builder.getGroup() @JvmName("setGroup") @@ -38,13 +38,13 @@ public object ListDartTestsResponseKt { _builder.setGroup(value) } /** - * `.patrol.DartTestGroup group = 1;` + * `.patrol.DartGroupEntry group = 1;` */ public fun clearGroup() { _builder.clearGroup() } /** - * `.patrol.DartTestGroup group = 1;` + * `.patrol.DartGroupEntry group = 1;` * @return Whether the group field is set. */ public fun hasGroup(): kotlin.Boolean { @@ -55,6 +55,6 @@ public object ListDartTestsResponseKt { public inline fun pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse.copy(block: pl.leancode.patrol.contracts.ListDartTestsResponseKt.Dsl.() -> kotlin.Unit): pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse = pl.leancode.patrol.contracts.ListDartTestsResponseKt.Dsl._create(this.toBuilder()).apply { block() }._build() -public val pl.leancode.patrol.contracts.Contracts.ListDartTestsResponseOrBuilder.groupOrNull: pl.leancode.patrol.contracts.Contracts.DartTestGroup? +public val pl.leancode.patrol.contracts.Contracts.ListDartTestsResponseOrBuilder.groupOrNull: pl.leancode.patrol.contracts.Contracts.DartGroupEntry? get() = if (hasGroup()) getGroup() else null diff --git a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift index 3be68b05f..dc4d87c98 100644 --- a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift +++ b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift @@ -25,8 +25,8 @@ public struct Patrol_ListDartTestsResponse { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - public var group: Patrol_DartTestGroup { - get {return _group ?? Patrol_DartTestGroup()} + public var group: Patrol_DartGroupEntry { + get {return _group ?? Patrol_DartGroupEntry()} set {_group = newValue} } /// Returns true if `group` has been explicitly set. @@ -38,37 +38,67 @@ public struct Patrol_ListDartTestsResponse { public init() {} - fileprivate var _group: Patrol_DartTestGroup? = nil + fileprivate var _group: Patrol_DartGroupEntry? = nil } -public struct Patrol_DartTestGroup { +public struct Patrol_DartGroupEntry { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. public var name: String = String() - public var tests: [Patrol_DartTestCase] = [] + public var fullName: String = String() - public var groups: [Patrol_DartTestGroup] = [] + public var type: Patrol_DartGroupEntry.GroupEntryType = .group + + public var entries: [Patrol_DartGroupEntry] = [] public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} -} + public enum GroupEntryType: SwiftProtobuf.Enum { + public typealias RawValue = Int + case group // = 0 + case test // = 1 + case UNRECOGNIZED(Int) -public struct Patrol_DartTestCase { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. + public init() { + self = .group + } - public var name: String = String() + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .group + case 1: self = .test + default: self = .UNRECOGNIZED(rawValue) + } + } - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var rawValue: Int { + switch self { + case .group: return 0 + case .test: return 1 + case .UNRECOGNIZED(let i): return i + } + } + + } public init() {} } +#if swift(>=4.2) + +extension Patrol_DartGroupEntry.GroupEntryType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static var allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ + .group, + .test, + ] +} + +#endif // swift(>=4.2) + public struct Patrol_RunDartTestRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -780,8 +810,8 @@ public struct Patrol_SubmitTestResultsRequest { #if swift(>=5.5) && canImport(_Concurrency) extension Patrol_ListDartTestsResponse: @unchecked Sendable {} -extension Patrol_DartTestGroup: @unchecked Sendable {} -extension Patrol_DartTestCase: @unchecked Sendable {} +extension Patrol_DartGroupEntry: @unchecked Sendable {} +extension Patrol_DartGroupEntry.GroupEntryType: @unchecked Sendable {} extension Patrol_RunDartTestRequest: @unchecked Sendable {} extension Patrol_RunDartTestResponse: @unchecked Sendable {} extension Patrol_RunDartTestResponse.Result: @unchecked Sendable {} @@ -853,12 +883,13 @@ extension Patrol_ListDartTestsResponse: SwiftProtobuf.Message, SwiftProtobuf._Me } } -extension Patrol_DartTestGroup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".DartTestGroup" +extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".DartGroupEntry" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), - 2: .same(proto: "tests"), - 3: .same(proto: "groups"), + 2: .same(proto: "fullName"), + 3: .same(proto: "type"), + 4: .same(proto: "entries"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -868,8 +899,9 @@ extension Patrol_DartTestGroup: SwiftProtobuf.Message, SwiftProtobuf._MessageImp // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.tests) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.groups) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.fullName) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() default: break } } @@ -879,54 +911,33 @@ extension Patrol_DartTestGroup: SwiftProtobuf.Message, SwiftProtobuf._MessageImp if !self.name.isEmpty { try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) } - if !self.tests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.tests, fieldNumber: 2) + if !self.fullName.isEmpty { + try visitor.visitSingularStringField(value: self.fullName, fieldNumber: 2) + } + if self.type != .group { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) } - if !self.groups.isEmpty { - try visitor.visitRepeatedMessageField(value: self.groups, fieldNumber: 3) + if !self.entries.isEmpty { + try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - public static func ==(lhs: Patrol_DartTestGroup, rhs: Patrol_DartTestGroup) -> Bool { + public static func ==(lhs: Patrol_DartGroupEntry, rhs: Patrol_DartGroupEntry) -> Bool { if lhs.name != rhs.name {return false} - if lhs.tests != rhs.tests {return false} - if lhs.groups != rhs.groups {return false} + if lhs.fullName != rhs.fullName {return false} + if lhs.type != rhs.type {return false} + if lhs.entries != rhs.entries {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Patrol_DartTestCase: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".DartTestCase" +extension Patrol_DartGroupEntry.GroupEntryType: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), + 0: .same(proto: "GROUP"), + 1: .same(proto: "TEST"), ] - - public mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Patrol_DartTestCase, rhs: Patrol_DartTestCase) -> Bool { - if lhs.name != rhs.name {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } } extension Patrol_RunDartTestRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { diff --git a/packages/patrol/lib/src/native/contracts/contracts.pb.dart b/packages/patrol/lib/src/native/contracts/contracts.pb.dart index 89e8711e6..420432628 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pb.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pb.dart @@ -24,17 +24,17 @@ class ListDartTestsResponse extends $pb.GeneratedMessage { ? '' : 'patrol'), createEmptyInstance: create) - ..aOM( + ..aOM( 1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', - subBuilder: DartTestGroup.create) + subBuilder: DartGroupEntry.create) ..hasRequiredFields = false; ListDartTestsResponse._() : super(); factory ListDartTestsResponse({ - DartTestGroup? group, + DartGroupEntry? group, }) { final _result = create(); if (group != null) { @@ -72,9 +72,9 @@ class ListDartTestsResponse extends $pb.GeneratedMessage { static ListDartTestsResponse? _defaultInstance; @$pb.TagNumber(1) - DartTestGroup get group => $_getN(0); + DartGroupEntry get group => $_getN(0); @$pb.TagNumber(1) - set group(DartTestGroup v) { + set group(DartGroupEntry v) { setField(1, v); } @@ -83,14 +83,14 @@ class ListDartTestsResponse extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearGroup() => clearField(1); @$pb.TagNumber(1) - DartTestGroup ensureGroup() => $_ensure(0); + DartGroupEntry ensureGroup() => $_ensure(0); } -class DartTestGroup extends $pb.GeneratedMessage { +class DartGroupEntry extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo( const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' - : 'DartTestGroup', + : 'DartGroupEntry', package: const $pb.PackageName( const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' @@ -101,66 +101,78 @@ class DartTestGroup extends $pb.GeneratedMessage { const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..pc( + ..aOS( 2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' - : 'tests', - $pb.PbFieldType.PM, - subBuilder: DartTestCase.create) - ..pc( + : 'fullName', + protoName: 'fullName') + ..e( 3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' - : 'groups', + : 'type', + $pb.PbFieldType.OE, + defaultOrMaker: DartGroupEntry_GroupEntryType.GROUP, + valueOf: DartGroupEntry_GroupEntryType.valueOf, + enumValues: DartGroupEntry_GroupEntryType.values) + ..pc( + 4, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'entries', $pb.PbFieldType.PM, - subBuilder: DartTestGroup.create) + subBuilder: DartGroupEntry.create) ..hasRequiredFields = false; - DartTestGroup._() : super(); - factory DartTestGroup({ + DartGroupEntry._() : super(); + factory DartGroupEntry({ $core.String? name, - $core.Iterable? tests, - $core.Iterable? groups, + $core.String? fullName, + DartGroupEntry_GroupEntryType? type, + $core.Iterable? entries, }) { final _result = create(); if (name != null) { _result.name = name; } - if (tests != null) { - _result.tests.addAll(tests); + if (fullName != null) { + _result.fullName = fullName; } - if (groups != null) { - _result.groups.addAll(groups); + if (type != null) { + _result.type = type; + } + if (entries != null) { + _result.entries.addAll(entries); } return _result; } - factory DartTestGroup.fromBuffer($core.List<$core.int> i, + factory DartGroupEntry.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory DartTestGroup.fromJson($core.String i, + factory DartGroupEntry.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') - DartTestGroup clone() => DartTestGroup()..mergeFromMessage(this); + DartGroupEntry clone() => DartGroupEntry()..mergeFromMessage(this); @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 'Will be removed in next major version') - DartTestGroup copyWith(void Function(DartTestGroup) updates) => - super.copyWith((message) => updates(message as DartTestGroup)) - as DartTestGroup; // ignore: deprecated_member_use + DartGroupEntry copyWith(void Function(DartGroupEntry) updates) => + super.copyWith((message) => updates(message as DartGroupEntry)) + as DartGroupEntry; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') - static DartTestGroup create() => DartTestGroup._(); - DartTestGroup createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); + static DartGroupEntry create() => DartGroupEntry._(); + DartGroupEntry createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static DartTestGroup getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static DartTestGroup? _defaultInstance; + static DartGroupEntry getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static DartGroupEntry? _defaultInstance; @$pb.TagNumber(1) $core.String get name => $_getSZ(0); @@ -175,77 +187,31 @@ class DartTestGroup extends $pb.GeneratedMessage { void clearName() => clearField(1); @$pb.TagNumber(2) - $core.List get tests => $_getList(1); - - @$pb.TagNumber(3) - $core.List get groups => $_getList(2); -} + $core.String get fullName => $_getSZ(1); + @$pb.TagNumber(2) + set fullName($core.String v) { + $_setString(1, v); + } -class DartTestCase extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - const $core.bool.fromEnvironment('protobuf.omit_message_names') - ? '' - : 'DartTestCase', - package: const $pb.PackageName( - const $core.bool.fromEnvironment('protobuf.omit_message_names') - ? '' - : 'patrol'), - createEmptyInstance: create) - ..aOS( - 1, - const $core.bool.fromEnvironment('protobuf.omit_field_names') - ? '' - : 'name') - ..hasRequiredFields = false; + @$pb.TagNumber(2) + $core.bool hasFullName() => $_has(1); + @$pb.TagNumber(2) + void clearFullName() => clearField(2); - DartTestCase._() : super(); - factory DartTestCase({ - $core.String? name, - }) { - final _result = create(); - if (name != null) { - _result.name = name; - } - return _result; + @$pb.TagNumber(3) + DartGroupEntry_GroupEntryType get type => $_getN(2); + @$pb.TagNumber(3) + set type(DartGroupEntry_GroupEntryType v) { + setField(3, v); } - factory DartTestCase.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory DartTestCase.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - DartTestCase clone() => DartTestCase()..mergeFromMessage(this); - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - DartTestCase copyWith(void Function(DartTestCase) updates) => - super.copyWith((message) => updates(message as DartTestCase)) - as DartTestCase; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static DartTestCase create() => DartTestCase._(); - DartTestCase createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); - @$core.pragma('dart2js:noInline') - static DartTestCase getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static DartTestCase? _defaultInstance; - @$pb.TagNumber(1) - $core.String get name => $_getSZ(0); - @$pb.TagNumber(1) - set name($core.String v) { - $_setString(0, v); - } + @$pb.TagNumber(3) + $core.bool hasType() => $_has(2); + @$pb.TagNumber(3) + void clearType() => clearField(3); - @$pb.TagNumber(1) - $core.bool hasName() => $_has(0); - @$pb.TagNumber(1) - void clearName() => clearField(1); + @$pb.TagNumber(4) + $core.List get entries => $_getList(3); } class RunDartTestRequest extends $pb.GeneratedMessage { diff --git a/packages/patrol/lib/src/native/contracts/contracts.pbenum.dart b/packages/patrol/lib/src/native/contracts/contracts.pbenum.dart index 05170df17..33b5ef21e 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pbenum.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pbenum.dart @@ -9,6 +9,35 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; +class DartGroupEntry_GroupEntryType extends $pb.ProtobufEnum { + static const DartGroupEntry_GroupEntryType GROUP = + DartGroupEntry_GroupEntryType._( + 0, + const $core.bool.fromEnvironment('protobuf.omit_enum_names') + ? '' + : 'GROUP'); + static const DartGroupEntry_GroupEntryType TEST = + DartGroupEntry_GroupEntryType._( + 1, + const $core.bool.fromEnvironment('protobuf.omit_enum_names') + ? '' + : 'TEST'); + + static const $core.List values = + [ + GROUP, + TEST, + ]; + + static final $core.Map<$core.int, DartGroupEntry_GroupEntryType> _byValue = + $pb.ProtobufEnum.initByValue(values); + static DartGroupEntry_GroupEntryType? valueOf($core.int value) => + _byValue[value]; + + const DartGroupEntry_GroupEntryType._($core.int v, $core.String n) + : super(v, n); +} + class RunDartTestResponse_Result extends $pb.ProtobufEnum { static const RunDartTestResponse_Result SUCCESS = RunDartTestResponse_Result._( diff --git a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart index 3a749a5a4..21dd38b5b 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart @@ -18,7 +18,7 @@ const ListDartTestsResponse$json = const { '3': 1, '4': 1, '5': 11, - '6': '.patrol.DartTestGroup', + '6': '.patrol.DartGroupEntry', '10': 'group' }, ], @@ -26,45 +26,45 @@ const ListDartTestsResponse$json = const { /// Descriptor for `ListDartTestsResponse`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List listDartTestsResponseDescriptor = $convert.base64Decode( - 'ChVMaXN0RGFydFRlc3RzUmVzcG9uc2USKwoFZ3JvdXAYASABKAsyFS5wYXRyb2wuRGFydFRlc3RHcm91cFIFZ3JvdXA='); -@$core.Deprecated('Use dartTestGroupDescriptor instead') -const DartTestGroup$json = const { - '1': 'DartTestGroup', + 'ChVMaXN0RGFydFRlc3RzUmVzcG9uc2USLAoFZ3JvdXAYASABKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSBWdyb3Vw'); +@$core.Deprecated('Use dartGroupEntryDescriptor instead') +const DartGroupEntry$json = const { + '1': 'DartGroupEntry', '2': const [ const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + const {'1': 'fullName', '3': 2, '4': 1, '5': 9, '10': 'fullName'}, const { - '1': 'tests', - '3': 2, - '4': 3, - '5': 11, - '6': '.patrol.DartTestCase', - '10': 'tests' + '1': 'type', + '3': 3, + '4': 1, + '5': 14, + '6': '.patrol.DartGroupEntry.GroupEntryType', + '10': 'type' }, const { - '1': 'groups', - '3': 3, + '1': 'entries', + '3': 4, '4': 3, '5': 11, - '6': '.patrol.DartTestGroup', - '10': 'groups' + '6': '.patrol.DartGroupEntry', + '10': 'entries' }, ], + '4': const [DartGroupEntry_GroupEntryType$json], }; -/// Descriptor for `DartTestGroup`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List dartTestGroupDescriptor = $convert.base64Decode( - 'Cg1EYXJ0VGVzdEdyb3VwEhIKBG5hbWUYASABKAlSBG5hbWUSKgoFdGVzdHMYAiADKAsyFC5wYXRyb2wuRGFydFRlc3RDYXNlUgV0ZXN0cxItCgZncm91cHMYAyADKAsyFS5wYXRyb2wuRGFydFRlc3RHcm91cFIGZ3JvdXBz'); -@$core.Deprecated('Use dartTestCaseDescriptor instead') -const DartTestCase$json = const { - '1': 'DartTestCase', +@$core.Deprecated('Use dartGroupEntryDescriptor instead') +const DartGroupEntry_GroupEntryType$json = const { + '1': 'GroupEntryType', '2': const [ - const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + const {'1': 'GROUP', '2': 0}, + const {'1': 'TEST', '2': 1}, ], }; -/// Descriptor for `DartTestCase`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List dartTestCaseDescriptor = - $convert.base64Decode('CgxEYXJ0VGVzdENhc2USEgoEbmFtZRgBIAEoCVIEbmFtZQ=='); +/// Descriptor for `DartGroupEntry`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List dartGroupEntryDescriptor = $convert.base64Decode( + 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRI5CgR0eXBlGAMgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBCADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); @$core.Deprecated('Use runDartTestRequestDescriptor instead') const RunDartTestRequest$json = const { '1': 'RunDartTestRequest', From 2cf225a52fb1ecc63dcdec02275f7cdc9b401639 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 14:53:56 +0200 Subject: [PATCH 15/38] adapt Dart side to `DartGroupEntry` --- packages/patrol/lib/src/common.dart | 31 +++-- .../lib/src/native/patrol_app_service.dart | 2 +- packages/patrol/test/internals_test.dart | 110 +++++++++++++++--- packages/patrol_cli/lib/src/test_bundler.dart | 2 +- 4 files changed, 113 insertions(+), 32 deletions(-) diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index d4b8f72a6..131a022b6 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -157,17 +157,20 @@ if you use nativeAutomation with false, we recommend using patrolWidgetTest()''' ); } -/// Creates a DartTestGroup by visiting the subgroups of [parentGroup]. +/// Creates a DartGroupEntry by visiting the subgroups of [parentGroup]. /// /// The initial [parentGroup] is the implicit, unnamed top-level [Group] present /// in every test case. @internal -DartTestGroup createDartTestGroup( +DartGroupEntry createDartTestGroup( Group parentGroup, { String name = '', int level = 0, }) { - final groupDTO = DartTestGroup(name: name); + final groupDTO = DartGroupEntry( + name: name, + type: DartGroupEntry_GroupEntryType.GROUP, + ); for (final entry in parentGroup.entries) { // Trim names of current groups @@ -178,7 +181,7 @@ DartTestGroup createDartTestGroup( } if (entry is Group) { - groupDTO.groups.add( + groupDTO.entries.add( createDartTestGroup( entry, name: name, @@ -196,7 +199,9 @@ DartTestGroup createDartTestGroup( throw StateError('Test is not allowed to be defined at level $level'); } - groupDTO.tests.add(DartTestCase(name: name)); + groupDTO.entries.add( + DartGroupEntry(name: name, type: DartGroupEntry_GroupEntryType.TEST), + ); } else { // This should really never happen, because Group and Test are the only // subclasses of GroupEntry. @@ -216,15 +221,17 @@ String deduplicateGroupEntryName(String parentName, String currentName) { ); } -void printGroupStructure(DartTestGroup group, int indentation) { +void printGroupStructure(DartGroupEntry group, int indentation) { final indent = ' ' * indentation; print("$indent-- group: '${group.name}'"); - for (final testCase in group.tests) { - print("$indent -- test: '${testCase.name}'"); - } - - for (final subgroup in group.groups) { - printGroupStructure(subgroup, indentation + 5); + for (final entry in group.entries) { + if (entry.type == DartGroupEntry_GroupEntryType.TEST) { + print("$indent -- test: '${entry.name}'"); + } else { + for (final subgroup in entry.entries) { + printGroupStructure(subgroup, indentation + 5); + } + } } } diff --git a/packages/patrol/lib/src/native/patrol_app_service.dart b/packages/patrol/lib/src/native/patrol_app_service.dart index 2e0e7855e..d2ce94444 100644 --- a/packages/patrol/lib/src/native/patrol_app_service.dart +++ b/packages/patrol/lib/src/native/patrol_app_service.dart @@ -37,7 +37,7 @@ class PatrolAppService extends PatrolAppServiceBase { /// The ambient test group that wraps all the other groups and tests in the /// bundled Dart test file. - final DartTestGroup topLevelDartTestGroup; + final DartGroupEntry topLevelDartTestGroup; /// A completer that completes with the name of the Dart test file that was /// requested to execute by the native side. diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index 0d5954783..cc11204aa 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -7,6 +7,8 @@ import 'package:test_api/src/backend/group.dart'; import 'package:test_api/src/backend/invoker.dart'; import 'package:test_api/src/backend/metadata.dart'; +typedef GroupEntryType = DartGroupEntry_GroupEntryType; + void main() { group('createDartTestGroup()', () { test('fails if a test is defined at top-level', () { @@ -20,7 +22,7 @@ void main() { ]); // when - DartTestGroup callback() => createDartTestGroup(topLevelGroup); + DartGroupEntry callback() => createDartTestGroup(topLevelGroup); // then expect( @@ -29,7 +31,7 @@ void main() { ); }); - test('smoke test', () { + test('smoke test 1', () { // given final topLevelGroup = Group.root([ LocalTest('patrol_test_explorer', Metadata.empty, () {}), @@ -59,33 +61,105 @@ void main() { expect( dartTestGroup, equals( - DartTestGroup( + DartGroupEntry( name: '', - groups: [ - DartTestGroup( + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry( name: 'example_test', - groups: [ - DartTestGroup( + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry( name: 'alpha', - tests: [ - DartTestCase(name: 'first'), - DartTestCase(name: 'second') + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'first', type: GroupEntryType.TEST), + DartGroupEntry(name: 'second', type: GroupEntryType.TEST), ], ), - DartTestGroup( + DartGroupEntry( name: 'bravo', - tests: [ - DartTestCase(name: 'first'), - DartTestCase(name: 'second'), + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'first', type: GroupEntryType.TEST), + DartGroupEntry(name: 'second', type: GroupEntryType.TEST), ], ), ], ), - DartTestGroup( + DartGroupEntry( name: 'open_app_test', - tests: [ - DartTestCase(name: 'open maps'), - DartTestCase(name: 'open browser'), + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'open maps', type: GroupEntryType.TEST), + DartGroupEntry( + name: 'open browser', + type: GroupEntryType.TEST, + ), + ], + ), + ], + ), + ), + ); + }); + + test('smoke test 2', () { + // given + final topLevelGroup = Group.root([ + LocalTest('patrol_test_explorer', Metadata.empty, () {}), + Group( + 'example_test', + [ + _localTest('example_test alpha'), + Group('example_test bravo', [ + _localTest('example_test bravo first'), + _localTest('example_test bravo second'), + ]), + _localTest('example_test charlie'), + Group('example_test delta', [ + _localTest('example_test delta first'), + _localTest('example_test delta second'), + ]), + _localTest('example_test echo'), + ], + ), + ]); + + // when + final dartTestGroup = createDartTestGroup(topLevelGroup); + + // then + expect( + dartTestGroup, + equals( + DartGroupEntry( + name: '', + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry( + name: 'example_test', + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'alpha', type: GroupEntryType.TEST), + DartGroupEntry( + name: 'bravo', + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'first', type: GroupEntryType.TEST), + DartGroupEntry(name: 'second', type: GroupEntryType.TEST), + ], + ), + DartGroupEntry(name: 'charlie', type: GroupEntryType.TEST), + DartGroupEntry( + name: 'delta', + type: GroupEntryType.GROUP, + entries: [ + DartGroupEntry(name: 'first', type: GroupEntryType.TEST), + DartGroupEntry(name: 'second', type: GroupEntryType.TEST), + ], + ), + DartGroupEntry(name: 'echo', type: GroupEntryType.TEST), ], ), ], diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index 9f7635411..8853d1c13 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -71,7 +71,7 @@ Future main() async { final nativeAutomator = NativeAutomator(config: NativeAutomatorConfig()); await nativeAutomator.initialize(); final binding = PatrolBinding.ensureInitialized(); - final testExplorationCompleter = Completer(); + final testExplorationCompleter = Completer(); // A special test to expore the hierarchy of groups and tests. This is a hack // around https://github.com/dart-lang/test/issues/1998. From be512020c0de4cedb6428ab0afa869b2bcffdd48 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 15:30:01 +0200 Subject: [PATCH 16/38] adapt Android side to `DartGroupEntry` --- .../pl/leancode/patrol/ContractsExtensions.kt | 26 +++--- .../patrol/PatrolAppServiceClient.java | 2 +- .../pl/leancode/patrol/PatrolJUnitRunner.java | 9 +- .../patrol/ContractsExtensionsTest.kt | 89 +++++++++++-------- 4 files changed, 69 insertions(+), 57 deletions(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index cd85fbce2..f6eefb321 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -9,19 +9,19 @@ import pl.leancode.patrol.contracts.copy private fun Selector.isEmpty(): Boolean { return ( - !hasText() && - !hasTextStartsWith() && - !hasTextContains() && - !hasClassName() && - !hasContentDescription() && - !hasContentDescriptionStartsWith() && - !hasContentDescriptionContains() && - !hasResourceId() && - !hasInstance() && - !hasEnabled() && - !hasFocused() && - !hasPkg() - ) + !hasText() && + !hasTextStartsWith() && + !hasTextContains() && + !hasClassName() && + !hasContentDescription() && + !hasContentDescriptionStartsWith() && + !hasContentDescriptionContains() && + !hasResourceId() && + !hasInstance() && + !hasEnabled() && + !hasFocused() && + !hasPkg() + ) } fun Selector.toUiSelector(): UiSelector { diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolAppServiceClient.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolAppServiceClient.java index 68caee0b4..880d1e2ee 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolAppServiceClient.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolAppServiceClient.java @@ -28,7 +28,7 @@ public PatrolAppServiceClient(String target) { blockingStub = PatrolAppServiceGrpc.newBlockingStub(channel); } - public DartTestGroup listDartTests() throws StatusRuntimeException { + public DartGroupEntry listDartTests() throws StatusRuntimeException { Empty request = Empty.newBuilder().build(); ListDartTestsResponse response = blockingStub.listDartTests(request); diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java index fc0d93028..e5802e57b 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java @@ -11,14 +11,13 @@ import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnitRunner; import io.grpc.StatusRuntimeException; -import pl.leancode.patrol.contracts.Contracts.DartTestCase; -import pl.leancode.patrol.contracts.Contracts.DartTestGroup; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; +import static pl.leancode.patrol.contracts.Contracts.DartGroupEntry; import static pl.leancode.patrol.contracts.Contracts.RunDartTestResponse; /** @@ -110,10 +109,10 @@ public Object[] listDartTests() { final String TAG = "PatrolJUnitRunner.listDartTests(): "; try { - final DartTestGroup dartTestGroup = patrolAppServiceClient.listDartTests(); - List dartTestCases = ContractsExtensionsKt.listTestsFlat(dartTestGroup, ""); + final DartGroupEntry dartTestGroup = patrolAppServiceClient.listDartTests(); + List dartTestCases = ContractsExtensionsKt.listTestsFlat(dartTestGroup, ""); List dartTestCaseNamesList = new ArrayList<>(); - for (DartTestCase dartTestCase : dartTestCases) { + for (DartGroupEntry dartTestCase : dartTestCases) { dartTestCaseNamesList.add(dartTestCase.getName()); } Object[] dartTestCaseNames = dartTestCaseNamesList.toArray(); 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 6514fcc39..54326426e 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 @@ -1,11 +1,19 @@ package pl.leancode.patrol import org.junit.Test -import pl.leancode.patrol.contracts.dartTestCase -import pl.leancode.patrol.contracts.dartTestGroup +import pl.leancode.patrol.contracts.Contracts.DartGroupEntry +import pl.leancode.patrol.contracts.DartGroupEntryKt +import pl.leancode.patrol.contracts.copy +import pl.leancode.patrol.contracts.dartGroupEntry import kotlin.test.assertContentEquals -// TODO: Make sure these tests are run on CI +fun dartTestGroup(block: DartGroupEntryKt.Dsl.() -> Unit): DartGroupEntry { + return dartGroupEntry(block).copy { type = DartGroupEntry.GroupEntryType.GROUP } +} + +fun dartTestCase(block: DartGroupEntryKt.Dsl.() -> Unit): DartGroupEntry { + return dartGroupEntry(block).copy { type = DartGroupEntry.GroupEntryType.TEST } +} class DartTestGroupExtensionsTest { @@ -14,18 +22,18 @@ class DartTestGroupExtensionsTest { // given val dartTestGroup = dartTestGroup { name = "" - groups += listOf( + entries += listOf( dartTestGroup { name = "example_test" - tests += listOf(dartTestCase { name = "increments counter, exits the app, and comes back" }) + entries += listOf(dartTestCase { name = "increments counter, exits the app, and comes back" }) }, dartTestGroup { name = "open_app_test" - tests += listOf(dartTestCase { name = "open maps" }) + entries += listOf(dartTestCase { name = "open maps" }) }, dartTestGroup { name = "webview_test" - tests += listOf(dartTestCase { name = "interacts with the LeanCode website in a webview" }) + entries += listOf(dartTestCase { name = "interacts with the LeanCode website in a webview" }) } ) } @@ -47,52 +55,57 @@ class DartTestGroupExtensionsTest { @Test fun `listTestsFlat() handles nested hierarchy`() { // given - val dartTestGroup = dartTestGroup { - name = "" - groups += listOf( + val exampleTest = dartTestGroup { + name = "example_test" + entries += listOf( + dartTestCase { name = "the first test" }, dartTestGroup { - name = "example_test" - groups += listOf( + name = "top level group in file" + entries += listOf( dartTestGroup { - name = "top level group in file" - groups += listOf( - dartTestGroup { - name = "alpha" - tests += listOf( - dartTestCase { name = "first" }, - dartTestCase { name = "second" }, - ) - }, - dartTestGroup { - name = "bravo" - tests += listOf( - dartTestCase { name = "first" }, - dartTestCase { name = "second" }, - ) - }, + name = "alpha" + entries += listOf( + dartTestCase { name = "first" }, + dartTestCase { name = "second" }, ) - } - ) - }, - dartTestGroup { - name = "open_app_test" - tests += listOf( - dartTestCase { name = "open maps" }, - dartTestCase { name = "open browser" }, + }, + dartTestCase { name = "test between groups" }, + dartTestGroup { + name = "bravo" + entries += listOf( + dartTestCase { name = "first" }, + dartTestCase { name = "second" }, + ) + }, ) - }, + } + ) + } + + val openAppTest = dartTestGroup { + name = "open_app_test" + entries += listOf( + dartTestCase { name = "open maps" }, + dartTestCase { name = "open browser" }, ) } + val rootDartTestGroup = dartTestGroup { + name = "" + entries += listOf(exampleTest, openAppTest) + } + // when - val dartTestFiles = dartTestGroup.listTestsFlat() + val dartTestFiles = rootDartTestGroup.listTestsFlat() // then assertContentEquals( listOf( // example_test + dartTestCase { name = "example_test the first test" }, dartTestCase { name = "example_test top level group in file alpha first" }, dartTestCase { name = "example_test top level group in file alpha second" }, + dartTestCase { name = "example_test top level group in file test between groups" }, dartTestCase { name = "example_test top level group in file bravo first" }, dartTestCase { name = "example_test top level group in file bravo second" }, // open_app_test From 4ea6ba6e568dedc41c21680d59f075cd528a546a Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 16:21:15 +0200 Subject: [PATCH 17/38] clean ups --- packages/patrol/example/integration_test/example_test.dart | 7 +++++++ packages/patrol/lib/src/common.dart | 6 ++++-- packages/patrol_cli/lib/src/test_bundler.dart | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 267db3552..831001c29 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -4,6 +4,9 @@ import 'package:test_api/src/backend/invoker.dart'; import 'common.dart'; void main() { + patrol('at the beginning, haha!', ($) async { + await _testBody($); + }); group('top level group in file', () { group('alpha', () { patrol('first', ($) async { @@ -14,6 +17,10 @@ void main() { }); }); + patrol('in the middle, haha!', ($) async { + await _testBody($); + }); + group('bravo', () { patrol('first', ($) async { await _testBody($); diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 131a022b6..f4e7b8d40 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -221,7 +221,9 @@ String deduplicateGroupEntryName(String parentName, String currentName) { ); } -void printGroupStructure(DartGroupEntry group, int indentation) { +/// Recursively prints the structure of the test suite. +@internal +void printGroupStructure(DartGroupEntry group, {int indentation = 0}) { final indent = ' ' * indentation; print("$indent-- group: '${group.name}'"); @@ -230,7 +232,7 @@ void printGroupStructure(DartGroupEntry group, int indentation) { print("$indent -- test: '${entry.name}'"); } else { for (final subgroup in entry.entries) { - printGroupStructure(subgroup, indentation + 5); + printGroupStructure(subgroup, indentation: indentation + 5); } } } diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index 8853d1c13..1e85599ce 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -85,7 +85,7 @@ Future main() async { final dartTestGroup = createDartTestGroup(topLevelGroup); testExplorationCompleter.complete(dartTestGroup); print('PATROL_DEBUG: group structure:'); - printGroupStructure(dartTestGroup, 0); + printGroupStructure(dartTestGroup); }); // START: GENERATED TEST GROUPS From 0ccfae2201e565f33ea0d75bff9b320d8328e90a Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 15 Aug 2023 16:23:03 +0200 Subject: [PATCH 18/38] disable xcbeautify because it slurps up xcodebuild exit code --- .github/workflows/patrol-prepare.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index 2141ee5cc..839cfc70d 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -118,7 +118,6 @@ jobs: brew update brew install swift-format brew install clang-format - brew install xcbeautify # Disabled because of generated protobuf code #- name: swift-format lint @@ -161,7 +160,7 @@ jobs: -only-testing RunnerTests \ -configuration Debug \ -sdk iphoneos -destination 'platform=iOS Simulator,name=iPhone 14' \ - -derivedDataPath ../build/ios_unit | xcbeautify + -derivedDataPath ../build/ios_unit prepare-flutter: name: Flutter ${{ matrix.flutter-version }} From 535dfec3ef54b9d1736b43f33b147929280ab457 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 11 Sep 2023 13:19:07 +0200 Subject: [PATCH 19/38] please `dart analyze` --- dev/cli_tests/patrol_develop_test.dart | 2 +- packages/patrol/example/integration_test/example_test.dart | 2 ++ packages/patrol/lib/src/common.dart | 4 ++-- packages/patrol/pubspec.yaml | 3 +-- packages/patrol/test/internals_test.dart | 2 +- packages/patrol_cli/lib/src/crossplatform/flutter_tool.dart | 2 +- packages/patrol_cli/test/crossplatform/app_options_test.dart | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dev/cli_tests/patrol_develop_test.dart b/dev/cli_tests/patrol_develop_test.dart index 5f7cdcfb9..45feec394 100644 --- a/dev/cli_tests/patrol_develop_test.dart +++ b/dev/cli_tests/patrol_develop_test.dart @@ -58,7 +58,7 @@ void main(List args) async { [ 'develop', ...['--target', 'integration_test/example_test.dart'], - ...args + ...args, ], runInShell: true, workingDirectory: exampleAppDirectory.path, diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index 831001c29..a7423522e 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -1,4 +1,5 @@ import 'package:patrol/src/extensions.dart'; +// ignore: depend_on_referenced_packages import 'package:test_api/src/backend/invoker.dart'; import 'common.dart'; @@ -32,6 +33,7 @@ void main() { }); } +// FIXME: Only for debugging and development. To be removed. Future _testBody(PatrolTester $) async { await createApp($); diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 0a2770d94..34907ab33 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -231,11 +231,11 @@ String deduplicateGroupEntryName(String parentName, String currentName) { @internal void printGroupStructure(DartGroupEntry group, {int indentation = 0}) { final indent = ' ' * indentation; - print("$indent-- group: '${group.name}'"); + debugPrint("$indent-- group: '${group.name}'"); for (final entry in group.entries) { if (entry.type == DartGroupEntry_GroupEntryType.TEST) { - print("$indent -- test: '${entry.name}'"); + debugPrint("$indent -- test: '${entry.name}'"); } else { for (final subgroup in entry.entries) { printGroupStructure(subgroup, indentation: indentation + 5); diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index 6143cdd2c..ba797d7b1 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -22,8 +22,7 @@ dependencies: sdk: flutter meta: ^1.7.0 path: ^1.8.2 - patrol_finders: - path: ../patrol_finders + patrol_finders: ^1.0.0 protobuf: ^2.1.0 test_api: '>=0.4.0 <0.7.0' diff --git a/packages/patrol/test/internals_test.dart b/packages/patrol/test/internals_test.dart index cc11204aa..c4d252066 100644 --- a/packages/patrol/test/internals_test.dart +++ b/packages/patrol/test/internals_test.dart @@ -18,7 +18,7 @@ void main() { LocalTest('some_test', Metadata.empty, () => null), Group('example_test', [ LocalTest('example_test some example test', Metadata.empty, () {}), - ]) + ]), ]); // when diff --git a/packages/patrol_cli/lib/src/crossplatform/flutter_tool.dart b/packages/patrol_cli/lib/src/crossplatform/flutter_tool.dart index a963bdcdc..4ca7cda00 100644 --- a/packages/patrol_cli/lib/src/crossplatform/flutter_tool.dart +++ b/packages/patrol_cli/lib/src/crossplatform/flutter_tool.dart @@ -47,7 +47,7 @@ class FlutterTool { target: target, appId: appId, dartDefines: dartDefines, - ) + ), ]); } diff --git a/packages/patrol_cli/test/crossplatform/app_options_test.dart b/packages/patrol_cli/test/crossplatform/app_options_test.dart index 15045ca24..f362fb390 100644 --- a/packages/patrol_cli/test/crossplatform/app_options_test.dart +++ b/packages/patrol_cli/test/crossplatform/app_options_test.dart @@ -76,7 +76,7 @@ void main() { r'.\gradlew.bat', ':app:assembleDevReleaseAndroidTest', r'-Ptarget=C:\Users\john\app\integration_test\app_test.dart', - '-Pdart-defines=RU1BSUw9dXNlckBleGFtcGxlLmNvbQ==,UEFTU1dPUkQ9bnk0bmNhdA==,Zm9vPWJhcg==' + '-Pdart-defines=RU1BSUw9dXNlckBleGFtcGxlLmNvbQ==,UEFTU1dPUkQ9bnk0bmNhdA==,Zm9vPWJhcg==', ]), ); }); @@ -98,7 +98,7 @@ void main() { './gradlew', ':app:assembleDevDebugAndroidTest', '-Ptarget=/Users/john/app/integration_test/app_test.dart', - '-Pdart-defines=RU1BSUw9dXNlckBleGFtcGxlLmNvbQ==,UEFTU1dPUkQ9bnk0bmNhdA==,Zm9vPWJhcg==' + '-Pdart-defines=RU1BSUw9dXNlckBleGFtcGxlLmNvbQ==,UEFTU1dPUkQ9bnk0bmNhdA==,Zm9vPWJhcg==', ]), ); }); From d2d3eb5ec8850eda3e2bab216b6e9343b8233152 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 11 Sep 2023 14:06:43 +0200 Subject: [PATCH 20/38] bring back xcbeautify --- .github/workflows/patrol-prepare.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index 839cfc70d..84270f992 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -154,13 +154,13 @@ jobs: - name: Run unit tests working-directory: packages/patrol/example/ios run: | - xcodebuild test \ + set -o pipefail && xcodebuild test \ -workspace Runner.xcworkspace \ -scheme Runner \ -only-testing RunnerTests \ -configuration Debug \ -sdk iphoneos -destination 'platform=iOS Simulator,name=iPhone 14' \ - -derivedDataPath ../build/ios_unit + -derivedDataPath ../build/ios_unit | xcbeautify --renderer github-actions prepare-flutter: name: Flutter ${{ matrix.flutter-version }} From 43eb88f51a0930c0eff37807bf88ce3057205f2c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 11 Sep 2023 14:21:04 +0200 Subject: [PATCH 21/38] DartGroupEntry: add `encodedFullName` field --- .github/workflows/patrol-prepare.yaml | 1 + contracts.proto | 5 +- .../pl/leancode/patrol/PatrolJUnitRunner.java | 2 +- .../leancode/patrol/contracts/Contracts.java | 332 +++++++++++------- .../patrol/contracts/DartGroupEntryKt.kt | 35 +- .../AutomatorServer/contracts.pb.swift | 42 +-- packages/patrol/lib/src/common.dart | 6 +- .../src/native/contracts/contracts.pb.dart | 38 +- .../native/contracts/contracts.pbjson.dart | 13 +- 9 files changed, 304 insertions(+), 170 deletions(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index 84270f992..05f9dfe46 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -154,6 +154,7 @@ jobs: - name: Run unit tests working-directory: packages/patrol/example/ios run: | + brew install xcbeautify set -o pipefail && xcodebuild test \ -workspace Runner.xcworkspace \ -scheme Runner \ diff --git a/contracts.proto b/contracts.proto index 519a4eca7..7fa4bf989 100644 --- a/contracts.proto +++ b/contracts.proto @@ -15,8 +15,9 @@ message ListDartTestsResponse { message DartGroupEntry { string name = 1; string fullName = 2; - GroupEntryType type = 3; - repeated DartGroupEntry entries = 4; + string encodedFullName = 3; + GroupEntryType type = 4; + repeated DartGroupEntry entries = 5; enum GroupEntryType { GROUP = 0; diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java index e5802e57b..1e5c1bbfa 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java @@ -113,7 +113,7 @@ public Object[] listDartTests() { List dartTestCases = ContractsExtensionsKt.listTestsFlat(dartTestGroup, ""); List dartTestCaseNamesList = new ArrayList<>(); for (DartGroupEntry dartTestCase : dartTestCases) { - dartTestCaseNamesList.add(dartTestCase.getName()); + dartTestCaseNamesList.add(dartTestCase.getFullName()); } Object[] dartTestCaseNames = dartTestCaseNamesList.toArray(); Logger.INSTANCE.i(TAG + "Got Dart tests: " + Arrays.toString(dartTestCaseNames)); diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java index 70afa158a..062f31a7c 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java @@ -33,6 +33,7 @@ public static final class ListDartTestsResponse extends ListDartTestsResponseOrBuilder { private ListDartTestsResponse() { } + private int bitField0_; public static final int GROUP_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.DartGroupEntry group_; /** @@ -40,7 +41,7 @@ private ListDartTestsResponse() { */ @java.lang.Override public boolean hasGroup() { - return group_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.DartGroupEntry group = 1; @@ -55,7 +56,7 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup() { private void setGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); group_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.DartGroupEntry group = 1; @@ -70,13 +71,13 @@ private void mergeGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry va } else { group_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.DartGroupEntry group = 1; */ private void clearGroup() { group_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse parseFrom( @@ -159,7 +160,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -239,10 +240,11 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "group_", }; java.lang.String info = - "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\t"; + "\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u1009\u0000"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -326,27 +328,39 @@ public interface DartGroupEntryOrBuilder extends getFullNameBytes(); /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * string encodedFullName = 3; + * @return The encodedFullName. + */ + java.lang.String getEncodedFullName(); + /** + * string encodedFullName = 3; + * @return The bytes for encodedFullName. + */ + com.google.protobuf.ByteString + getEncodedFullNameBytes(); + + /** + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The enum numeric value on the wire for type. */ int getTypeValue(); /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The type. */ pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getType(); /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ java.util.List getEntriesList(); /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index); /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ int getEntriesCount(); } @@ -361,6 +375,7 @@ public static final class DartGroupEntry extends private DartGroupEntry() { name_ = ""; fullName_ = ""; + encodedFullName_ = ""; entries_ = emptyProtobufList(); } /** @@ -546,10 +561,57 @@ private void setFullNameBytes( } - public static final int TYPE_FIELD_NUMBER = 3; + public static final int ENCODEDFULLNAME_FIELD_NUMBER = 3; + private java.lang.String encodedFullName_; + /** + * string encodedFullName = 3; + * @return The encodedFullName. + */ + @java.lang.Override + public java.lang.String getEncodedFullName() { + return encodedFullName_; + } + /** + * string encodedFullName = 3; + * @return The bytes for encodedFullName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getEncodedFullNameBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(encodedFullName_); + } + /** + * string encodedFullName = 3; + * @param value The encodedFullName to set. + */ + private void setEncodedFullName( + java.lang.String value) { + java.lang.Class valueClass = value.getClass(); + + encodedFullName_ = value; + } + /** + * string encodedFullName = 3; + */ + private void clearEncodedFullName() { + + encodedFullName_ = getDefaultInstance().getEncodedFullName(); + } + /** + * string encodedFullName = 3; + * @param value The bytes for encodedFullName to set. + */ + private void setEncodedFullNameBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + encodedFullName_ = value.toStringUtf8(); + + } + + public static final int TYPE_FIELD_NUMBER = 4; private int type_; /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The enum numeric value on the wire for type. */ @java.lang.Override @@ -557,7 +619,7 @@ public int getTypeValue() { return type_; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The type. */ @java.lang.Override @@ -566,14 +628,14 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getT return result == null ? pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType.UNRECOGNIZED : result; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @param value The enum numeric value on the wire for type to set. */ private void setTypeValue(int value) { type_ = value; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @param value The type to set. */ private void setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType value) { @@ -581,45 +643,45 @@ private void setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Group } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; */ private void clearType() { type_ = 0; } - public static final int ENTRIES_FIELD_NUMBER = 4; + public static final int ENTRIES_FIELD_NUMBER = 5; private com.google.protobuf.Internal.ProtobufList entries_; /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public java.util.List getEntriesList() { return entries_; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public java.util.List getEntriesOrBuilderList() { return entries_; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public int getEntriesCount() { return entries_.size(); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { return entries_.get(index); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public pl.leancode.patrol.contracts.Contracts.DartGroupEntryOrBuilder getEntriesOrBuilder( int index) { @@ -634,7 +696,7 @@ private void ensureEntriesIsMutable() { } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -643,7 +705,7 @@ private void setEntries( entries_.set(index, value); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); @@ -651,7 +713,7 @@ private void addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry va entries_.add(value); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -660,7 +722,7 @@ private void addEntries( entries_.add(index, value); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void addAllEntries( java.lang.Iterable values) { @@ -669,13 +731,13 @@ private void addAllEntries( values, entries_); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void clearEntries() { entries_ = emptyProtobufList(); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ private void removeEntries(int index) { ensureEntriesIsMutable(); @@ -762,7 +824,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartGroupEntry prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -878,7 +940,56 @@ public Builder setFullNameBytes( } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * string encodedFullName = 3; + * @return The encodedFullName. + */ + @java.lang.Override + public java.lang.String getEncodedFullName() { + return instance.getEncodedFullName(); + } + /** + * string encodedFullName = 3; + * @return The bytes for encodedFullName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getEncodedFullNameBytes() { + return instance.getEncodedFullNameBytes(); + } + /** + * string encodedFullName = 3; + * @param value The encodedFullName to set. + * @return This builder for chaining. + */ + public Builder setEncodedFullName( + java.lang.String value) { + copyOnWrite(); + instance.setEncodedFullName(value); + return this; + } + /** + * string encodedFullName = 3; + * @return This builder for chaining. + */ + public Builder clearEncodedFullName() { + copyOnWrite(); + instance.clearEncodedFullName(); + return this; + } + /** + * string encodedFullName = 3; + * @param value The bytes for encodedFullName to set. + * @return This builder for chaining. + */ + public Builder setEncodedFullNameBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setEncodedFullNameBytes(value); + return this; + } + + /** + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The enum numeric value on the wire for type. */ @java.lang.Override @@ -886,7 +997,7 @@ public int getTypeValue() { return instance.getTypeValue(); } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @param value The type to set. * @return This builder for chaining. */ @@ -896,7 +1007,7 @@ public Builder setTypeValue(int value) { return this; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return The type. */ @java.lang.Override @@ -904,7 +1015,7 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getT return instance.getType(); } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @param value The enum numeric value on the wire for type to set. * @return This builder for chaining. */ @@ -914,7 +1025,7 @@ public Builder setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Gro return this; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 3; + * .patrol.DartGroupEntry.GroupEntryType type = 4; * @return This builder for chaining. */ public Builder clearType() { @@ -924,7 +1035,7 @@ public Builder clearType() { } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public java.util.List getEntriesList() { @@ -932,20 +1043,20 @@ public java.util.List get instance.getEntriesList()); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public int getEntriesCount() { return instance.getEntriesCount(); }/** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ @java.lang.Override public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { return instance.getEntries(index); } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -954,7 +1065,7 @@ public Builder setEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -964,7 +1075,7 @@ public Builder setEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); @@ -972,7 +1083,7 @@ public Builder addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -981,7 +1092,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder addEntries( pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -990,7 +1101,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -1000,7 +1111,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder addAllEntries( java.lang.Iterable values) { @@ -1009,7 +1120,7 @@ public Builder addAllEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder clearEntries() { copyOnWrite(); @@ -1017,7 +1128,7 @@ public Builder clearEntries() { return this; } /** - * repeated .patrol.DartGroupEntry entries = 4; + * repeated .patrol.DartGroupEntry entries = 5; */ public Builder removeEntries(int index) { copyOnWrite(); @@ -1043,13 +1154,14 @@ protected final java.lang.Object dynamicMethod( java.lang.Object[] objects = new java.lang.Object[] { "name_", "fullName_", + "encodedFullName_", "type_", "entries_", pl.leancode.patrol.contracts.Contracts.DartGroupEntry.class, }; java.lang.String info = - "\u0000\u0004\u0000\u0000\u0001\u0004\u0004\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + - "\u0003\f\u0004\u001b"; + "\u0000\u0005\u0000\u0000\u0001\u0005\u0005\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + + "\u0003\u0208\u0004\f\u0005\u001b"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -1258,7 +1370,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -1717,7 +1829,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2040,7 +2152,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ConfigureRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2313,7 +2425,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenAppRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2702,7 +2814,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapOnNotificationRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2994,7 +3106,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Empty prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3184,7 +3296,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenQuickSettingsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3426,7 +3538,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DarkModeRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3604,6 +3716,7 @@ public static final class GetNativeViewsRequest extends private GetNativeViewsRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -3611,7 +3724,7 @@ private GetNativeViewsRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -3626,7 +3739,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -3641,13 +3754,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -3777,7 +3890,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3906,12 +4019,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -4169,7 +4283,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4457,7 +4571,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4748,7 +4862,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4980,6 +5094,7 @@ public static final class TapRequest extends private TapRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -4987,7 +5102,7 @@ private TapRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -5002,7 +5117,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -5017,13 +5132,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -5153,7 +5268,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -5282,12 +5397,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -5423,26 +5539,10 @@ private EnterTextRequest() { public enum KeyboardBehavior implements com.google.protobuf.Internal.EnumLite { /** - *
-       * The default keyboard behavior.
-       *
-       * Keyboard will be shown when entering text starts, and will be
-       * automatically dismissed afterwards.
-       * 
- * * SHOW_AND_DISMISS = 0; */ SHOW_AND_DISMISS(0), /** - *
-       * The alternative keyboard behavior.
-       *
-       * On Android, no keyboard will be shown at all. The text will simply appear
-       * inside the TextField.
-       *
-       * On iOS, the keyboard will not be dismissed after entering text.
-       * 
- * * ALTERNATIVE = 1; */ ALTERNATIVE(1), @@ -5450,26 +5550,10 @@ public enum KeyboardBehavior ; /** - *
-       * The default keyboard behavior.
-       *
-       * Keyboard will be shown when entering text starts, and will be
-       * automatically dismissed afterwards.
-       * 
- * * SHOW_AND_DISMISS = 0; */ public static final int SHOW_AND_DISMISS_VALUE = 0; /** - *
-       * The alternative keyboard behavior.
-       *
-       * On Android, no keyboard will be shown at all. The text will simply appear
-       * inside the TextField.
-       *
-       * On iOS, the keyboard will not be dismissed after entering text.
-       * 
- * * ALTERNATIVE = 1; */ public static final int ALTERNATIVE_VALUE = 1; @@ -5885,7 +5969,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.EnterTextRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6536,7 +6620,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SwipeRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6860,6 +6944,7 @@ public static final class WaitUntilVisibleRequest extends private WaitUntilVisibleRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -6867,7 +6952,7 @@ private WaitUntilVisibleRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -6882,7 +6967,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -6897,13 +6982,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -7033,7 +7118,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.WaitUntilVisibleRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7162,12 +7247,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -7467,7 +7553,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.HandlePermissionRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7840,7 +7926,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SetLocationAccuracyRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8103,7 +8189,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8348,7 +8434,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -9354,7 +9440,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Selector prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -10685,7 +10771,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.NativeView prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -11575,7 +11661,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Notification prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -12104,7 +12190,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SubmitTestResultsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt index 42eba2f8e..ed0f054e2 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt @@ -62,7 +62,24 @@ public object DartGroupEntryKt { } /** - * `.patrol.DartGroupEntry.GroupEntryType type = 3;` + * `string encodedFullName = 3;` + */ + public var encodedFullName: kotlin.String + @JvmName("getEncodedFullName") + get() = _builder.getEncodedFullName() + @JvmName("setEncodedFullName") + set(value) { + _builder.setEncodedFullName(value) + } + /** + * `string encodedFullName = 3;` + */ + public fun clearEncodedFullName() { + _builder.clearEncodedFullName() + } + + /** + * `.patrol.DartGroupEntry.GroupEntryType type = 4;` */ public var type: pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType @JvmName("getType") @@ -79,7 +96,7 @@ public object DartGroupEntryKt { _builder.setTypeValue(value) } /** - * `.patrol.DartGroupEntry.GroupEntryType type = 3;` + * `.patrol.DartGroupEntry.GroupEntryType type = 4;` */ public fun clearType() { _builder.clearType() @@ -92,7 +109,7 @@ public object DartGroupEntryKt { @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) public class EntriesProxy private constructor() : com.google.protobuf.kotlin.DslProxy() /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` */ public val entries: com.google.protobuf.kotlin.DslList @kotlin.jvm.JvmSynthetic @@ -100,7 +117,7 @@ public object DartGroupEntryKt { _builder.getEntriesList() ) /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` * @param value The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -109,7 +126,7 @@ public object DartGroupEntryKt { _builder.addEntries(value) } /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` * @param value The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -119,7 +136,7 @@ public object DartGroupEntryKt { add(value) } /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` * @param values The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -128,7 +145,7 @@ public object DartGroupEntryKt { _builder.addAllEntries(values) } /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` * @param values The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -138,7 +155,7 @@ public object DartGroupEntryKt { addAll(values) } /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` * @param index The index to set the value at. * @param value The entries to set. */ @@ -148,7 +165,7 @@ public object DartGroupEntryKt { _builder.setEntries(index, value) } /** - * `repeated .patrol.DartGroupEntry entries = 4;` + * `repeated .patrol.DartGroupEntry entries = 5;` */ @kotlin.jvm.JvmSynthetic @kotlin.jvm.JvmName("clearEntries") diff --git a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift index ee414c11f..d1f13bf88 100644 --- a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift +++ b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift @@ -50,6 +50,8 @@ public struct Patrol_DartGroupEntry { public var fullName: String = String() + public var encodedFullName: String = String() + public var type: Patrol_DartGroupEntry.GroupEntryType = .group public var entries: [Patrol_DartGroupEntry] = [] @@ -91,7 +93,7 @@ public struct Patrol_DartGroupEntry { extension Patrol_DartGroupEntry.GroupEntryType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ + public static let allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ .group, .test, ] @@ -169,7 +171,7 @@ public struct Patrol_RunDartTestResponse { extension Patrol_RunDartTestResponse.Result: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_RunDartTestResponse.Result] = [ + public static let allCases: [Patrol_RunDartTestResponse.Result] = [ .success, .skipped, .failure, @@ -428,19 +430,7 @@ public struct Patrol_EnterTextRequest { public enum KeyboardBehavior: SwiftProtobuf.Enum { public typealias RawValue = Int - - /// The default keyboard behavior. - /// - /// Keyboard will be shown when entering text starts, and will be - /// automatically dismissed afterwards. case showAndDismiss // = 0 - - /// The alternative keyboard behavior. - /// - /// On Android, no keyboard will be shown at all. The text will simply appear - /// inside the TextField. - /// - /// On iOS, the keyboard will not be dismissed after entering text. case alternative // = 1 case UNRECOGNIZED(Int) @@ -473,7 +463,7 @@ public struct Patrol_EnterTextRequest { extension Patrol_EnterTextRequest.KeyboardBehavior: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ + public static let allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ .showAndDismiss, .alternative, ] @@ -573,7 +563,7 @@ public struct Patrol_HandlePermissionRequest { extension Patrol_HandlePermissionRequest.Code: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_HandlePermissionRequest.Code] = [ + public static let allCases: [Patrol_HandlePermissionRequest.Code] = [ .whileUsing, .onlyThisTime, .denied, @@ -626,7 +616,7 @@ public struct Patrol_SetLocationAccuracyRequest { extension Patrol_SetLocationAccuracyRequest.LocationAccuracy: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ + public static let allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ .coarse, .fine, ] @@ -941,8 +931,9 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), 2: .same(proto: "fullName"), - 3: .same(proto: "type"), - 4: .same(proto: "entries"), + 3: .same(proto: "encodedFullName"), + 4: .same(proto: "type"), + 5: .same(proto: "entries"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -953,8 +944,9 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm switch fieldNumber { case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() case 2: try { try decoder.decodeSingularStringField(value: &self.fullName) }() - case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.encodedFullName) }() + case 4: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() default: break } } @@ -967,11 +959,14 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm if !self.fullName.isEmpty { try visitor.visitSingularStringField(value: self.fullName, fieldNumber: 2) } + if !self.encodedFullName.isEmpty { + try visitor.visitSingularStringField(value: self.encodedFullName, fieldNumber: 3) + } if self.type != .group { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 4) } if !self.entries.isEmpty { - try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 4) + try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 5) } try unknownFields.traverse(visitor: &visitor) } @@ -979,6 +974,7 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static func ==(lhs: Patrol_DartGroupEntry, rhs: Patrol_DartGroupEntry) -> Bool { if lhs.name != rhs.name {return false} if lhs.fullName != rhs.fullName {return false} + if lhs.encodedFullName != rhs.encodedFullName {return false} if lhs.type != rhs.type {return false} if lhs.entries != rhs.entries {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 34907ab33..ae1933bcd 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -206,7 +206,11 @@ DartGroupEntry createDartTestGroup( } groupDTO.entries.add( - DartGroupEntry(name: name, type: DartGroupEntry_GroupEntryType.TEST), + DartGroupEntry( + name: name, + fullName: entry.name, + type: DartGroupEntry_GroupEntryType.TEST, + ), ); } else { // This should really never happen, because Group and Test are the only diff --git a/packages/patrol/lib/src/native/contracts/contracts.pb.dart b/packages/patrol/lib/src/native/contracts/contracts.pb.dart index b718df484..81b0e6c0e 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pb.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pb.dart @@ -107,8 +107,14 @@ class DartGroupEntry extends $pb.GeneratedMessage { ? '' : 'fullName', protoName: 'fullName') - ..e( + ..aOS( 3, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'encodedFullName', + protoName: 'encodedFullName') + ..e( + 4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type', @@ -117,7 +123,7 @@ class DartGroupEntry extends $pb.GeneratedMessage { valueOf: DartGroupEntry_GroupEntryType.valueOf, enumValues: DartGroupEntry_GroupEntryType.values) ..pc( - 4, + 5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'entries', @@ -129,6 +135,7 @@ class DartGroupEntry extends $pb.GeneratedMessage { factory DartGroupEntry({ $core.String? name, $core.String? fullName, + $core.String? encodedFullName, DartGroupEntry_GroupEntryType? type, $core.Iterable? entries, }) { @@ -139,6 +146,9 @@ class DartGroupEntry extends $pb.GeneratedMessage { if (fullName != null) { _result.fullName = fullName; } + if (encodedFullName != null) { + _result.encodedFullName = encodedFullName; + } if (type != null) { _result.type = type; } @@ -199,19 +209,31 @@ class DartGroupEntry extends $pb.GeneratedMessage { void clearFullName() => clearField(2); @$pb.TagNumber(3) - DartGroupEntry_GroupEntryType get type => $_getN(2); + $core.String get encodedFullName => $_getSZ(2); @$pb.TagNumber(3) - set type(DartGroupEntry_GroupEntryType v) { - setField(3, v); + set encodedFullName($core.String v) { + $_setString(2, v); } @$pb.TagNumber(3) - $core.bool hasType() => $_has(2); + $core.bool hasEncodedFullName() => $_has(2); @$pb.TagNumber(3) - void clearType() => clearField(3); + void clearEncodedFullName() => clearField(3); + + @$pb.TagNumber(4) + DartGroupEntry_GroupEntryType get type => $_getN(3); + @$pb.TagNumber(4) + set type(DartGroupEntry_GroupEntryType v) { + setField(4, v); + } @$pb.TagNumber(4) - $core.List get entries => $_getList(3); + $core.bool hasType() => $_has(3); + @$pb.TagNumber(4) + void clearType() => clearField(4); + + @$pb.TagNumber(5) + $core.List get entries => $_getList(4); } class RunDartTestRequest extends $pb.GeneratedMessage { diff --git a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart index 571b6c735..b3d1ca57b 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart @@ -34,16 +34,23 @@ const DartGroupEntry$json = const { const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, const {'1': 'fullName', '3': 2, '4': 1, '5': 9, '10': 'fullName'}, const { - '1': 'type', + '1': 'encodedFullName', '3': 3, '4': 1, + '5': 9, + '10': 'encodedFullName' + }, + const { + '1': 'type', + '3': 4, + '4': 1, '5': 14, '6': '.patrol.DartGroupEntry.GroupEntryType', '10': 'type' }, const { '1': 'entries', - '3': 4, + '3': 5, '4': 3, '5': 11, '6': '.patrol.DartGroupEntry', @@ -64,7 +71,7 @@ const DartGroupEntry_GroupEntryType$json = const { /// Descriptor for `DartGroupEntry`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List dartGroupEntryDescriptor = $convert.base64Decode( - 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRI5CgR0eXBlGAMgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBCADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); + 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRIoCg9lbmNvZGVkRnVsbE5hbWUYAyABKAlSD2VuY29kZWRGdWxsTmFtZRI5CgR0eXBlGAQgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBSADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); @$core.Deprecated('Use runDartTestRequestDescriptor instead') const RunDartTestRequest$json = const { '1': 'RunDartTestRequest', From 1f2ab8ac75d4d92603655ea5126a4b470b7cb3da Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 11 Sep 2023 15:13:19 +0200 Subject: [PATCH 22/38] Revert "DartGroupEntry: add `encodedFullName` field" This reverts commit 43eb88f51a0930c0eff37807bf88ce3057205f2c. --- .github/workflows/patrol-prepare.yaml | 2 +- contracts.proto | 5 +- .../pl/leancode/patrol/PatrolJUnitRunner.java | 2 +- .../leancode/patrol/contracts/Contracts.java | 332 +++++++----------- .../patrol/contracts/DartGroupEntryKt.kt | 35 +- .../AutomatorServer/contracts.pb.swift | 42 ++- packages/patrol/lib/src/common.dart | 6 +- .../src/native/contracts/contracts.pb.dart | 38 +- .../native/contracts/contracts.pbjson.dart | 13 +- 9 files changed, 171 insertions(+), 304 deletions(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index 05f9dfe46..c50a231f5 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -154,7 +154,7 @@ jobs: - name: Run unit tests working-directory: packages/patrol/example/ios run: | - brew install xcbeautify + brew install xcbeautify set -o pipefail && xcodebuild test \ -workspace Runner.xcworkspace \ -scheme Runner \ diff --git a/contracts.proto b/contracts.proto index 7fa4bf989..519a4eca7 100644 --- a/contracts.proto +++ b/contracts.proto @@ -15,9 +15,8 @@ message ListDartTestsResponse { message DartGroupEntry { string name = 1; string fullName = 2; - string encodedFullName = 3; - GroupEntryType type = 4; - repeated DartGroupEntry entries = 5; + GroupEntryType type = 3; + repeated DartGroupEntry entries = 4; enum GroupEntryType { GROUP = 0; diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java index 1e5c1bbfa..e5802e57b 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/PatrolJUnitRunner.java @@ -113,7 +113,7 @@ public Object[] listDartTests() { List dartTestCases = ContractsExtensionsKt.listTestsFlat(dartTestGroup, ""); List dartTestCaseNamesList = new ArrayList<>(); for (DartGroupEntry dartTestCase : dartTestCases) { - dartTestCaseNamesList.add(dartTestCase.getFullName()); + dartTestCaseNamesList.add(dartTestCase.getName()); } Object[] dartTestCaseNames = dartTestCaseNamesList.toArray(); Logger.INSTANCE.i(TAG + "Got Dart tests: " + Arrays.toString(dartTestCaseNames)); diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java index 062f31a7c..70afa158a 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java @@ -33,7 +33,6 @@ public static final class ListDartTestsResponse extends ListDartTestsResponseOrBuilder { private ListDartTestsResponse() { } - private int bitField0_; public static final int GROUP_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.DartGroupEntry group_; /** @@ -41,7 +40,7 @@ private ListDartTestsResponse() { */ @java.lang.Override public boolean hasGroup() { - return ((bitField0_ & 0x00000001) != 0); + return group_ != null; } /** * .patrol.DartGroupEntry group = 1; @@ -56,7 +55,7 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup() { private void setGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); group_ = value; - bitField0_ |= 0x00000001; + } /** * .patrol.DartGroupEntry group = 1; @@ -71,13 +70,13 @@ private void mergeGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry va } else { group_ = value; } - bitField0_ |= 0x00000001; + } /** * .patrol.DartGroupEntry group = 1; */ private void clearGroup() { group_ = null; - bitField0_ = (bitField0_ & ~0x00000001); + } public static pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse parseFrom( @@ -160,7 +159,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -240,11 +239,10 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { - "bitField0_", "group_", }; java.lang.String info = - "\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u1009\u0000"; + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\t"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -328,39 +326,27 @@ public interface DartGroupEntryOrBuilder extends getFullNameBytes(); /** - * string encodedFullName = 3; - * @return The encodedFullName. - */ - java.lang.String getEncodedFullName(); - /** - * string encodedFullName = 3; - * @return The bytes for encodedFullName. - */ - com.google.protobuf.ByteString - getEncodedFullNameBytes(); - - /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The enum numeric value on the wire for type. */ int getTypeValue(); /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The type. */ pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getType(); /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ java.util.List getEntriesList(); /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index); /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ int getEntriesCount(); } @@ -375,7 +361,6 @@ public static final class DartGroupEntry extends private DartGroupEntry() { name_ = ""; fullName_ = ""; - encodedFullName_ = ""; entries_ = emptyProtobufList(); } /** @@ -561,57 +546,10 @@ private void setFullNameBytes( } - public static final int ENCODEDFULLNAME_FIELD_NUMBER = 3; - private java.lang.String encodedFullName_; - /** - * string encodedFullName = 3; - * @return The encodedFullName. - */ - @java.lang.Override - public java.lang.String getEncodedFullName() { - return encodedFullName_; - } - /** - * string encodedFullName = 3; - * @return The bytes for encodedFullName. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getEncodedFullNameBytes() { - return com.google.protobuf.ByteString.copyFromUtf8(encodedFullName_); - } - /** - * string encodedFullName = 3; - * @param value The encodedFullName to set. - */ - private void setEncodedFullName( - java.lang.String value) { - java.lang.Class valueClass = value.getClass(); - - encodedFullName_ = value; - } - /** - * string encodedFullName = 3; - */ - private void clearEncodedFullName() { - - encodedFullName_ = getDefaultInstance().getEncodedFullName(); - } - /** - * string encodedFullName = 3; - * @param value The bytes for encodedFullName to set. - */ - private void setEncodedFullNameBytes( - com.google.protobuf.ByteString value) { - checkByteStringIsUtf8(value); - encodedFullName_ = value.toStringUtf8(); - - } - - public static final int TYPE_FIELD_NUMBER = 4; + public static final int TYPE_FIELD_NUMBER = 3; private int type_; /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The enum numeric value on the wire for type. */ @java.lang.Override @@ -619,7 +557,7 @@ public int getTypeValue() { return type_; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The type. */ @java.lang.Override @@ -628,14 +566,14 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getT return result == null ? pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType.UNRECOGNIZED : result; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @param value The enum numeric value on the wire for type to set. */ private void setTypeValue(int value) { type_ = value; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @param value The type to set. */ private void setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType value) { @@ -643,45 +581,45 @@ private void setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Group } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; */ private void clearType() { type_ = 0; } - public static final int ENTRIES_FIELD_NUMBER = 5; + public static final int ENTRIES_FIELD_NUMBER = 4; private com.google.protobuf.Internal.ProtobufList entries_; /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public java.util.List getEntriesList() { return entries_; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public java.util.List getEntriesOrBuilderList() { return entries_; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public int getEntriesCount() { return entries_.size(); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { return entries_.get(index); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public pl.leancode.patrol.contracts.Contracts.DartGroupEntryOrBuilder getEntriesOrBuilder( int index) { @@ -696,7 +634,7 @@ private void ensureEntriesIsMutable() { } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -705,7 +643,7 @@ private void setEntries( entries_.set(index, value); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); @@ -713,7 +651,7 @@ private void addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry va entries_.add(value); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -722,7 +660,7 @@ private void addEntries( entries_.add(index, value); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void addAllEntries( java.lang.Iterable values) { @@ -731,13 +669,13 @@ private void addAllEntries( values, entries_); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void clearEntries() { entries_ = emptyProtobufList(); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ private void removeEntries(int index) { ensureEntriesIsMutable(); @@ -824,7 +762,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartGroupEntry prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -940,56 +878,7 @@ public Builder setFullNameBytes( } /** - * string encodedFullName = 3; - * @return The encodedFullName. - */ - @java.lang.Override - public java.lang.String getEncodedFullName() { - return instance.getEncodedFullName(); - } - /** - * string encodedFullName = 3; - * @return The bytes for encodedFullName. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getEncodedFullNameBytes() { - return instance.getEncodedFullNameBytes(); - } - /** - * string encodedFullName = 3; - * @param value The encodedFullName to set. - * @return This builder for chaining. - */ - public Builder setEncodedFullName( - java.lang.String value) { - copyOnWrite(); - instance.setEncodedFullName(value); - return this; - } - /** - * string encodedFullName = 3; - * @return This builder for chaining. - */ - public Builder clearEncodedFullName() { - copyOnWrite(); - instance.clearEncodedFullName(); - return this; - } - /** - * string encodedFullName = 3; - * @param value The bytes for encodedFullName to set. - * @return This builder for chaining. - */ - public Builder setEncodedFullNameBytes( - com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setEncodedFullNameBytes(value); - return this; - } - - /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The enum numeric value on the wire for type. */ @java.lang.Override @@ -997,7 +886,7 @@ public int getTypeValue() { return instance.getTypeValue(); } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @param value The type to set. * @return This builder for chaining. */ @@ -1007,7 +896,7 @@ public Builder setTypeValue(int value) { return this; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The type. */ @java.lang.Override @@ -1015,7 +904,7 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType getT return instance.getType(); } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @param value The enum numeric value on the wire for type to set. * @return This builder for chaining. */ @@ -1025,7 +914,7 @@ public Builder setType(pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Gro return this; } /** - * .patrol.DartGroupEntry.GroupEntryType type = 4; + * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return This builder for chaining. */ public Builder clearType() { @@ -1035,7 +924,7 @@ public Builder clearType() { } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public java.util.List getEntriesList() { @@ -1043,20 +932,20 @@ public java.util.List get instance.getEntriesList()); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public int getEntriesCount() { return instance.getEntriesCount(); }/** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ @java.lang.Override public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getEntries(int index) { return instance.getEntries(index); } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -1065,7 +954,7 @@ public Builder setEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder setEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -1075,7 +964,7 @@ public Builder setEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { copyOnWrite(); @@ -1083,7 +972,7 @@ public Builder addEntries(pl.leancode.patrol.contracts.Contracts.DartGroupEntry return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { @@ -1092,7 +981,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder addEntries( pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -1101,7 +990,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder addEntries( int index, pl.leancode.patrol.contracts.Contracts.DartGroupEntry.Builder builderForValue) { @@ -1111,7 +1000,7 @@ public Builder addEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder addAllEntries( java.lang.Iterable values) { @@ -1120,7 +1009,7 @@ public Builder addAllEntries( return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder clearEntries() { copyOnWrite(); @@ -1128,7 +1017,7 @@ public Builder clearEntries() { return this; } /** - * repeated .patrol.DartGroupEntry entries = 5; + * repeated .patrol.DartGroupEntry entries = 4; */ public Builder removeEntries(int index) { copyOnWrite(); @@ -1154,14 +1043,13 @@ protected final java.lang.Object dynamicMethod( java.lang.Object[] objects = new java.lang.Object[] { "name_", "fullName_", - "encodedFullName_", "type_", "entries_", pl.leancode.patrol.contracts.Contracts.DartGroupEntry.class, }; java.lang.String info = - "\u0000\u0005\u0000\u0000\u0001\u0005\u0005\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + - "\u0003\u0208\u0004\f\u0005\u001b"; + "\u0000\u0004\u0000\u0000\u0001\u0004\u0004\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + + "\u0003\f\u0004\u001b"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -1370,7 +1258,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -1829,7 +1717,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestResponse prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2152,7 +2040,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ConfigureRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2425,7 +2313,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenAppRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2814,7 +2702,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapOnNotificationRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3106,7 +2994,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Empty prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3296,7 +3184,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenQuickSettingsRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3538,7 +3426,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DarkModeRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3716,7 +3604,6 @@ public static final class GetNativeViewsRequest extends private GetNativeViewsRequest() { appId_ = ""; } - private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -3724,7 +3611,7 @@ private GetNativeViewsRequest() { */ @java.lang.Override public boolean hasSelector() { - return ((bitField0_ & 0x00000001) != 0); + return selector_ != null; } /** * .patrol.Selector selector = 1; @@ -3739,7 +3626,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; @@ -3754,13 +3641,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - bitField0_ = (bitField0_ & ~0x00000001); + } public static final int APPID_FIELD_NUMBER = 2; @@ -3890,7 +3777,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4019,13 +3906,12 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { - "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + - "\u0208"; + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + + ""; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -4283,7 +4169,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsResponse prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4571,7 +4457,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4862,7 +4748,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsResponse prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -5094,7 +4980,6 @@ public static final class TapRequest extends private TapRequest() { appId_ = ""; } - private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -5102,7 +4987,7 @@ private TapRequest() { */ @java.lang.Override public boolean hasSelector() { - return ((bitField0_ & 0x00000001) != 0); + return selector_ != null; } /** * .patrol.Selector selector = 1; @@ -5117,7 +5002,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; @@ -5132,13 +5017,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - bitField0_ = (bitField0_ & ~0x00000001); + } public static final int APPID_FIELD_NUMBER = 2; @@ -5268,7 +5153,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -5397,13 +5282,12 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { - "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + - "\u0208"; + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + + ""; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -5539,10 +5423,26 @@ private EnterTextRequest() { public enum KeyboardBehavior implements com.google.protobuf.Internal.EnumLite { /** + *
+       * The default keyboard behavior.
+       *
+       * Keyboard will be shown when entering text starts, and will be
+       * automatically dismissed afterwards.
+       * 
+ * * SHOW_AND_DISMISS = 0; */ SHOW_AND_DISMISS(0), /** + *
+       * The alternative keyboard behavior.
+       *
+       * On Android, no keyboard will be shown at all. The text will simply appear
+       * inside the TextField.
+       *
+       * On iOS, the keyboard will not be dismissed after entering text.
+       * 
+ * * ALTERNATIVE = 1; */ ALTERNATIVE(1), @@ -5550,10 +5450,26 @@ public enum KeyboardBehavior ; /** + *
+       * The default keyboard behavior.
+       *
+       * Keyboard will be shown when entering text starts, and will be
+       * automatically dismissed afterwards.
+       * 
+ * * SHOW_AND_DISMISS = 0; */ public static final int SHOW_AND_DISMISS_VALUE = 0; /** + *
+       * The alternative keyboard behavior.
+       *
+       * On Android, no keyboard will be shown at all. The text will simply appear
+       * inside the TextField.
+       *
+       * On iOS, the keyboard will not be dismissed after entering text.
+       * 
+ * * ALTERNATIVE = 1; */ public static final int ALTERNATIVE_VALUE = 1; @@ -5969,7 +5885,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.EnterTextRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6620,7 +6536,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SwipeRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6944,7 +6860,6 @@ public static final class WaitUntilVisibleRequest extends private WaitUntilVisibleRequest() { appId_ = ""; } - private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -6952,7 +6867,7 @@ private WaitUntilVisibleRequest() { */ @java.lang.Override public boolean hasSelector() { - return ((bitField0_ & 0x00000001) != 0); + return selector_ != null; } /** * .patrol.Selector selector = 1; @@ -6967,7 +6882,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; @@ -6982,13 +6897,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - bitField0_ |= 0x00000001; + } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - bitField0_ = (bitField0_ & ~0x00000001); + } public static final int APPID_FIELD_NUMBER = 2; @@ -7118,7 +7033,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.WaitUntilVisibleRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7247,13 +7162,12 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { - "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + - "\u0208"; + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + + ""; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -7553,7 +7467,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.HandlePermissionRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7926,7 +7840,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SetLocationAccuracyRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8189,7 +8103,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8434,7 +8348,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleResponse prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -9440,7 +9354,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Selector prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -10771,7 +10685,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.NativeView prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -11661,7 +11575,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Notification prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -12190,7 +12104,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SubmitTestResultsRequest prototype) { - return DEFAULT_INSTANCE.createBuilder(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt index ed0f054e2..42eba2f8e 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt @@ -62,24 +62,7 @@ public object DartGroupEntryKt { } /** - * `string encodedFullName = 3;` - */ - public var encodedFullName: kotlin.String - @JvmName("getEncodedFullName") - get() = _builder.getEncodedFullName() - @JvmName("setEncodedFullName") - set(value) { - _builder.setEncodedFullName(value) - } - /** - * `string encodedFullName = 3;` - */ - public fun clearEncodedFullName() { - _builder.clearEncodedFullName() - } - - /** - * `.patrol.DartGroupEntry.GroupEntryType type = 4;` + * `.patrol.DartGroupEntry.GroupEntryType type = 3;` */ public var type: pl.leancode.patrol.contracts.Contracts.DartGroupEntry.GroupEntryType @JvmName("getType") @@ -96,7 +79,7 @@ public object DartGroupEntryKt { _builder.setTypeValue(value) } /** - * `.patrol.DartGroupEntry.GroupEntryType type = 4;` + * `.patrol.DartGroupEntry.GroupEntryType type = 3;` */ public fun clearType() { _builder.clearType() @@ -109,7 +92,7 @@ public object DartGroupEntryKt { @kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class) public class EntriesProxy private constructor() : com.google.protobuf.kotlin.DslProxy() /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` */ public val entries: com.google.protobuf.kotlin.DslList @kotlin.jvm.JvmSynthetic @@ -117,7 +100,7 @@ public object DartGroupEntryKt { _builder.getEntriesList() ) /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` * @param value The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -126,7 +109,7 @@ public object DartGroupEntryKt { _builder.addEntries(value) } /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` * @param value The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -136,7 +119,7 @@ public object DartGroupEntryKt { add(value) } /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` * @param values The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -145,7 +128,7 @@ public object DartGroupEntryKt { _builder.addAllEntries(values) } /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` * @param values The entries to add. */ @kotlin.jvm.JvmSynthetic @@ -155,7 +138,7 @@ public object DartGroupEntryKt { addAll(values) } /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` * @param index The index to set the value at. * @param value The entries to set. */ @@ -165,7 +148,7 @@ public object DartGroupEntryKt { _builder.setEntries(index, value) } /** - * `repeated .patrol.DartGroupEntry entries = 5;` + * `repeated .patrol.DartGroupEntry entries = 4;` */ @kotlin.jvm.JvmSynthetic @kotlin.jvm.JvmName("clearEntries") diff --git a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift index d1f13bf88..ee414c11f 100644 --- a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift +++ b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift @@ -50,8 +50,6 @@ public struct Patrol_DartGroupEntry { public var fullName: String = String() - public var encodedFullName: String = String() - public var type: Patrol_DartGroupEntry.GroupEntryType = .group public var entries: [Patrol_DartGroupEntry] = [] @@ -93,7 +91,7 @@ public struct Patrol_DartGroupEntry { extension Patrol_DartGroupEntry.GroupEntryType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ + public static var allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ .group, .test, ] @@ -171,7 +169,7 @@ public struct Patrol_RunDartTestResponse { extension Patrol_RunDartTestResponse.Result: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Patrol_RunDartTestResponse.Result] = [ + public static var allCases: [Patrol_RunDartTestResponse.Result] = [ .success, .skipped, .failure, @@ -430,7 +428,19 @@ public struct Patrol_EnterTextRequest { public enum KeyboardBehavior: SwiftProtobuf.Enum { public typealias RawValue = Int + + /// The default keyboard behavior. + /// + /// Keyboard will be shown when entering text starts, and will be + /// automatically dismissed afterwards. case showAndDismiss // = 0 + + /// The alternative keyboard behavior. + /// + /// On Android, no keyboard will be shown at all. The text will simply appear + /// inside the TextField. + /// + /// On iOS, the keyboard will not be dismissed after entering text. case alternative // = 1 case UNRECOGNIZED(Int) @@ -463,7 +473,7 @@ public struct Patrol_EnterTextRequest { extension Patrol_EnterTextRequest.KeyboardBehavior: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ + public static var allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ .showAndDismiss, .alternative, ] @@ -563,7 +573,7 @@ public struct Patrol_HandlePermissionRequest { extension Patrol_HandlePermissionRequest.Code: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Patrol_HandlePermissionRequest.Code] = [ + public static var allCases: [Patrol_HandlePermissionRequest.Code] = [ .whileUsing, .onlyThisTime, .denied, @@ -616,7 +626,7 @@ public struct Patrol_SetLocationAccuracyRequest { extension Patrol_SetLocationAccuracyRequest.LocationAccuracy: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ + public static var allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ .coarse, .fine, ] @@ -931,9 +941,8 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), 2: .same(proto: "fullName"), - 3: .same(proto: "encodedFullName"), - 4: .same(proto: "type"), - 5: .same(proto: "entries"), + 3: .same(proto: "type"), + 4: .same(proto: "entries"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -944,9 +953,8 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm switch fieldNumber { case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() case 2: try { try decoder.decodeSingularStringField(value: &self.fullName) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.encodedFullName) }() - case 4: try { try decoder.decodeSingularEnumField(value: &self.type) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() default: break } } @@ -959,14 +967,11 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm if !self.fullName.isEmpty { try visitor.visitSingularStringField(value: self.fullName, fieldNumber: 2) } - if !self.encodedFullName.isEmpty { - try visitor.visitSingularStringField(value: self.encodedFullName, fieldNumber: 3) - } if self.type != .group { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 4) + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) } if !self.entries.isEmpty { - try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 5) + try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } @@ -974,7 +979,6 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static func ==(lhs: Patrol_DartGroupEntry, rhs: Patrol_DartGroupEntry) -> Bool { if lhs.name != rhs.name {return false} if lhs.fullName != rhs.fullName {return false} - if lhs.encodedFullName != rhs.encodedFullName {return false} if lhs.type != rhs.type {return false} if lhs.entries != rhs.entries {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index ae1933bcd..34907ab33 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -206,11 +206,7 @@ DartGroupEntry createDartTestGroup( } groupDTO.entries.add( - DartGroupEntry( - name: name, - fullName: entry.name, - type: DartGroupEntry_GroupEntryType.TEST, - ), + DartGroupEntry(name: name, type: DartGroupEntry_GroupEntryType.TEST), ); } else { // This should really never happen, because Group and Test are the only diff --git a/packages/patrol/lib/src/native/contracts/contracts.pb.dart b/packages/patrol/lib/src/native/contracts/contracts.pb.dart index 81b0e6c0e..b718df484 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pb.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pb.dart @@ -107,14 +107,8 @@ class DartGroupEntry extends $pb.GeneratedMessage { ? '' : 'fullName', protoName: 'fullName') - ..aOS( - 3, - const $core.bool.fromEnvironment('protobuf.omit_field_names') - ? '' - : 'encodedFullName', - protoName: 'encodedFullName') ..e( - 4, + 3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type', @@ -123,7 +117,7 @@ class DartGroupEntry extends $pb.GeneratedMessage { valueOf: DartGroupEntry_GroupEntryType.valueOf, enumValues: DartGroupEntry_GroupEntryType.values) ..pc( - 5, + 4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'entries', @@ -135,7 +129,6 @@ class DartGroupEntry extends $pb.GeneratedMessage { factory DartGroupEntry({ $core.String? name, $core.String? fullName, - $core.String? encodedFullName, DartGroupEntry_GroupEntryType? type, $core.Iterable? entries, }) { @@ -146,9 +139,6 @@ class DartGroupEntry extends $pb.GeneratedMessage { if (fullName != null) { _result.fullName = fullName; } - if (encodedFullName != null) { - _result.encodedFullName = encodedFullName; - } if (type != null) { _result.type = type; } @@ -209,31 +199,19 @@ class DartGroupEntry extends $pb.GeneratedMessage { void clearFullName() => clearField(2); @$pb.TagNumber(3) - $core.String get encodedFullName => $_getSZ(2); + DartGroupEntry_GroupEntryType get type => $_getN(2); @$pb.TagNumber(3) - set encodedFullName($core.String v) { - $_setString(2, v); + set type(DartGroupEntry_GroupEntryType v) { + setField(3, v); } @$pb.TagNumber(3) - $core.bool hasEncodedFullName() => $_has(2); + $core.bool hasType() => $_has(2); @$pb.TagNumber(3) - void clearEncodedFullName() => clearField(3); - - @$pb.TagNumber(4) - DartGroupEntry_GroupEntryType get type => $_getN(3); - @$pb.TagNumber(4) - set type(DartGroupEntry_GroupEntryType v) { - setField(4, v); - } + void clearType() => clearField(3); @$pb.TagNumber(4) - $core.bool hasType() => $_has(3); - @$pb.TagNumber(4) - void clearType() => clearField(4); - - @$pb.TagNumber(5) - $core.List get entries => $_getList(4); + $core.List get entries => $_getList(3); } class RunDartTestRequest extends $pb.GeneratedMessage { diff --git a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart index b3d1ca57b..571b6c735 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart @@ -33,16 +33,9 @@ const DartGroupEntry$json = const { '2': const [ const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, const {'1': 'fullName', '3': 2, '4': 1, '5': 9, '10': 'fullName'}, - const { - '1': 'encodedFullName', - '3': 3, - '4': 1, - '5': 9, - '10': 'encodedFullName' - }, const { '1': 'type', - '3': 4, + '3': 3, '4': 1, '5': 14, '6': '.patrol.DartGroupEntry.GroupEntryType', @@ -50,7 +43,7 @@ const DartGroupEntry$json = const { }, const { '1': 'entries', - '3': 5, + '3': 4, '4': 3, '5': 11, '6': '.patrol.DartGroupEntry', @@ -71,7 +64,7 @@ const DartGroupEntry_GroupEntryType$json = const { /// Descriptor for `DartGroupEntry`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List dartGroupEntryDescriptor = $convert.base64Decode( - 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRIoCg9lbmNvZGVkRnVsbE5hbWUYAyABKAlSD2VuY29kZWRGdWxsTmFtZRI5CgR0eXBlGAQgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBSADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); + 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRI5CgR0eXBlGAMgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBCADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); @$core.Deprecated('Use runDartTestRequestDescriptor instead') const RunDartTestRequest$json = const { '1': 'RunDartTestRequest', From 6185b2e38c3a831ac999c65eee02379a2871f6af Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 08:36:09 +0200 Subject: [PATCH 23/38] remove FIXME that is already fixed --- .github/workflows/patrol-prepare.yaml | 2 +- .../src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index c50a231f5..f4d317e10 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -118,6 +118,7 @@ jobs: brew update brew install swift-format brew install clang-format + brew install xcbeautify # Disabled because of generated protobuf code #- name: swift-format lint @@ -154,7 +155,6 @@ jobs: - name: Run unit tests working-directory: packages/patrol/example/ios run: | - brew install xcbeautify set -o pipefail && xcodebuild test \ -workspace Runner.xcworkspace \ -scheme Runner \ diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index f6eefb321..593b74404 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -191,9 +191,6 @@ fun Selector.toBySelector(): BySelector { fun DartGroupEntry.listTestsFlat(parentGroupName: String = ""): List { val tests = mutableListOf() - // FIXME: This doesn't preserve the order of groups and tests in Dart! - // We should iterate over "group entries", instead of iterating over "groups" and "tests". - for (test in entriesList) { if (test.type == DartGroupEntry.GroupEntryType.TEST) { if (parentGroupName.isEmpty()) { From 85aa81feac521032bc2580acd869005fc3f77852 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 10:29:21 +0200 Subject: [PATCH 24/38] iOS preparations: adjust `testCreateMethodNameFromPatrolGeneratedGroup` --- .../integration_test/example_test.dart | 6 +- .../example/ios/RunnerTests/RunnerTests.swift | 8 ++ .../example/ios/RunnerUITests/RunnerUITests.m | 111 ++++++++++++++++++ .../ios/Classes/PatrolAppServiceClient.swift | 5 +- packages/patrol/ios/Classes/PatrolUtils.m | 14 ++- 5 files changed, 138 insertions(+), 6 deletions(-) diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index a7423522e..c4d964e8f 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -5,7 +5,9 @@ import 'package:test_api/src/backend/invoker.dart'; import 'common.dart'; void main() { - patrol('at the beginning, haha!', ($) async { + // FIXME: iOS implementation not tested with non-alphabetic test names. + + patrol('at the beginning', ($) async { await _testBody($); }); group('top level group in file', () { @@ -18,7 +20,7 @@ void main() { }); }); - patrol('in the middle, haha!', ($) async { + patrol('in the middle', ($) async { await _testBody($); }); diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift index a72ddeb7f..a90f09b18 100644 --- a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -39,4 +39,12 @@ final class RunnerTests: XCTestCase { let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } + + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithGroups() { + let input = "example_test at the beginning" + let expectedOutput = "exampleTestatthebeginning" // FIXME: This is temporary + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + NSLog(result) + XCTAssertEqual(result, expectedOutput) + } } diff --git a/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m b/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m index bfc5dbda2..8391f4a48 100644 --- a/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m +++ b/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m @@ -2,4 +2,115 @@ @import patrol; @import ObjectiveC.runtime; +// This file is a one giant macro to make the setup as easy as possible for the developer. +// To edit it: +// 1. Remove the trailing backslashes: $ sed 's/\\$//' ios/Classes/PatrolIntegrationTestRunner.h +// 2. Paste its contents into the RunnerUITests.m in the RunnerUITests target +// 3. Make the changes, make sure it works +// 4. Re-add trailing backslashes: $ sed 's/$/\\/' ios/Classes/PatrolIntegrationTestRunner.h +// 5. Copy the contents from RunnerUITests.m back here +// 6. Go back to using a macro in RunnerTests.m + +// For every Flutter dart test, dynamically generate an Objective-C method mirroring the test results +// so it is reported as a native XCTest run result. +#define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) + @interface __test_class : XCTestCase + @end + + @implementation __test_class + + +(NSArray *)testInvocations { + /* Start native automation gRPC server */ + PatrolServer *server = [[PatrolServer alloc] init]; + [server startWithCompletionHandler:^(NSError * err) { + NSLog(@"Server loop done, error: %@", err); + }]; + + /* Create a client for PatrolAppService, which lets us list and run Dart tests */ + __block PatrolAppServiceClient *appServiceClient = [[PatrolAppServiceClient alloc] init]; + + /* Allow the Local Network permission required by Dart Observatory */ + XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; + XCUIElementQuery *systemAlerts = springboard.alerts; + if (systemAlerts.buttons[@"Allow"].exists) { + [systemAlerts.buttons[@"Allow"] tap]; + } + + /* Run the app for the first time to gather Dart tests */ + [[[XCUIApplication alloc] init] launch]; + + /* Spin the runloop waiting until the app reports that it is ready to report Dart tests */ + while (!server.appReady) { + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; + } + + __block NSArray *dartTestFiles = NULL; + [appServiceClient + listDartTestsWithCompletionHandler:^(NSArray *_Nullable dartTests, NSError *_Nullable err) { + if (err != NULL) { + NSLog(@"listDartTests(): failed, err: %@", err); + } + + dartTestFiles = dartTests; + }]; + + /* Spin the runloop waiting until the app reports the Dart tests it contains */ + while (!dartTestFiles) { + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; + } + + NSLog(@"Got %lu Dart tests: %@", dartTestFiles.count, dartTestFiles); + + NSMutableArray *invocations = [[NSMutableArray alloc] init]; + + /** + * Once Dart tests are available, we: + * + * Step 1. Dynamically add test case methods that request execution of an individual Dart test file. + * + * Step 2. Create invocations to the generated methods and return them + */ + + for (NSString * dartTestFile in dartTestFiles) { + /* Step 1 - dynamically create test cases */ + + IMP implementation = imp_implementationWithBlock(^(id _self) { + [[[XCUIApplication alloc] init] launch]; + + __block RunDartTestResponse *response = NULL; + [appServiceClient runDartTestWithName:dartTestFile + completionHandler:^(RunDartTestResponse *_Nullable r, NSError *_Nullable err) { + if (err != NULL) { + NSLog(@"runDartTestWithName(%@): failed, err: %@", dartTestFile, err); + } + + response = r; + }]; + + /* Wait until Dart test finishes */ + while (!response) { + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; + } + + XCTAssertTrue(response.passed, @"%@", response.details); + }); + NSString *selectorName = [PatrolUtils createMethodNameFromPatrolGeneratedGroup:dartTestFile]; + SEL selector = NSSelectorFromString(selectorName); + class_addMethod(self, selector, implementation, "v@:"); + + /* Step 2 – create invocations to the dynamically created methods */ + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + invocation.selector = selector; + + NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", selectorName, signature); + + [invocations addObject:invocation]; + } + + return invocations; + } + + @end + PATROL_INTEGRATION_TEST_IOS_RUNNER(RunnerUITests) diff --git a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift index b344b7f79..d956da989 100644 --- a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift +++ b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift @@ -41,7 +41,10 @@ import NIO let request = Patrol_Empty() let response = try await client.listDartTests(request) - return response.group.groups.map { $0.name } + return response.group.entries.map { + $0.name + } + // return response.group.groups.map { $0.name } } @objc public func runDartTest(name: String) async throws -> RunDartTestResponse { diff --git a/packages/patrol/ios/Classes/PatrolUtils.m b/packages/patrol/ios/Classes/PatrolUtils.m index 5dc802099..157dfa254 100644 --- a/packages/patrol/ios/Classes/PatrolUtils.m +++ b/packages/patrol/ios/Classes/PatrolUtils.m @@ -27,10 +27,18 @@ + (NSString *)createMethodNameFromPatrolGeneratedGroup:(NSString *)dartGroupName [[components subarrayWithRange:NSMakeRange(0, components.count - 1)] mutableCopy]; if (pathComponents.count > 0) { NSString *path = [pathComponents componentsJoinedByString:@"_"]; - return [NSString stringWithFormat:@"%@_%@", path, fileName]; - } else { - return fileName; + [fileName setString:[NSString stringWithFormat:@"%@_%@", path, fileName]]; } + + // Objective-C method names must be alphanumeric. + NSMutableCharacterSet *allowedCharacters = [NSMutableCharacterSet alphanumericCharacterSet]; // invertedSet + [allowedCharacters addCharactersInString:@"_"]; + NSCharacterSet *disallowedCharacters = allowedCharacters.invertedSet; + + // Remove disallowed characters. + NSString *upperCamelTestName = + [[fileName componentsSeparatedByCharactersInSet:disallowedCharacters] componentsJoinedByString:@""]; + return upperCamelTestName; } @end From c9c68b2ff242f9e681a4e12a9a620524c7e3decc Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 11:12:08 +0200 Subject: [PATCH 25/38] `group()`s work both on Android and iOS --- .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../ios/Classes/PatrolAppServiceClient.swift | 41 ++++++++++++++++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj b/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj index 13a049c99..db11d1e62 100644 --- a/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj @@ -265,7 +265,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1430; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/packages/patrol/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/patrol/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 327fff847..05552f28c 100644 --- a/packages/patrol/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/patrol/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ RunDartTestResponse { @@ -58,3 +59,39 @@ import NIO ) } } + +extension Patrol_DartGroupEntry { + + func listTestsFlat(parentGroupName: String) -> [Patrol_DartGroupEntry] { + var tests = [Patrol_DartGroupEntry]() + + for test in self.entries { + if test.type == Patrol_DartGroupEntry.GroupEntryType.test { + if parentGroupName.isEmpty { + // This case is invalid, because every test will have at least + // 1 named group - its filename. + + continue // What else can we do? + } + + // TODO: There has to be some copy() function + tests.append( + .with { + $0.name = "\(parentGroupName) \(test.name)" + $0.fullName = test.fullName + $0.type = test.type + $0.entries = test.entries + }) + } else if test.type == Patrol_DartGroupEntry.GroupEntryType.group { + if parentGroupName.isEmpty { + tests.append(contentsOf: test.listTestsFlat(parentGroupName: test.name)) + } else { + tests.append( + contentsOf: test.listTestsFlat(parentGroupName: "\(parentGroupName) \(test.name)")) + } + } + } + + return tests + } +} From 84c6bfdbd99c484cd6073d6a1617bebd3c9e1da8 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 11:21:52 +0200 Subject: [PATCH 26/38] Patrol_DartGroupEntry.listTestsFlat() extensions: clean up --- .../ios/Classes/PatrolAppServiceClient.swift | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift index 4a438b659..3cf153c21 100644 --- a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift +++ b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift @@ -66,28 +66,25 @@ extension Patrol_DartGroupEntry { var tests = [Patrol_DartGroupEntry]() for test in self.entries { + var test = test + if test.type == Patrol_DartGroupEntry.GroupEntryType.test { if parentGroupName.isEmpty { // This case is invalid, because every test will have at least // 1 named group - its filename. - continue // What else can we do? + continue // Ignore - what else can we do? } - // TODO: There has to be some copy() function - tests.append( - .with { - $0.name = "\(parentGroupName) \(test.name)" - $0.fullName = test.fullName - $0.type = test.type - $0.entries = test.entries - }) + test.name = "\(parentGroupName) \(test.name)" + tests.append(test) } else if test.type == Patrol_DartGroupEntry.GroupEntryType.group { if parentGroupName.isEmpty { tests.append(contentsOf: test.listTestsFlat(parentGroupName: test.name)) } else { tests.append( - contentsOf: test.listTestsFlat(parentGroupName: "\(parentGroupName) \(test.name)")) + contentsOf: test.listTestsFlat(parentGroupName: "\(parentGroupName) \(test.name)") + ) } } } From 083cf7078c6c1732b513cb8b61693795e16d1354 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 11:36:11 +0200 Subject: [PATCH 27/38] contracts.proto: remove fullName from DartGroupEntry --- contracts.proto | 1 - .../leancode/patrol/contracts/Contracts.java | 252 ++++-------------- .../patrol/contracts/DartGroupEntryKt.kt | 17 -- .../example/ios/RunnerTests/RunnerTests.swift | 4 +- .../AutomatorServer/contracts.pb.swift | 30 +-- .../src/native/contracts/contracts.pb.dart | 28 +- .../native/contracts/contracts.pbjson.dart | 3 +- 7 files changed, 70 insertions(+), 265 deletions(-) diff --git a/contracts.proto b/contracts.proto index 519a4eca7..27d2e105c 100644 --- a/contracts.proto +++ b/contracts.proto @@ -14,7 +14,6 @@ message ListDartTestsResponse { message DartGroupEntry { string name = 1; - string fullName = 2; GroupEntryType type = 3; repeated DartGroupEntry entries = 4; diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java index 70afa158a..a05cc7707 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/Contracts.java @@ -33,6 +33,7 @@ public static final class ListDartTestsResponse extends ListDartTestsResponseOrBuilder { private ListDartTestsResponse() { } + private int bitField0_; public static final int GROUP_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.DartGroupEntry group_; /** @@ -40,7 +41,7 @@ private ListDartTestsResponse() { */ @java.lang.Override public boolean hasGroup() { - return group_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.DartGroupEntry group = 1; @@ -55,7 +56,7 @@ public pl.leancode.patrol.contracts.Contracts.DartGroupEntry getGroup() { private void setGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry value) { value.getClass(); group_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.DartGroupEntry group = 1; @@ -70,13 +71,13 @@ private void mergeGroup(pl.leancode.patrol.contracts.Contracts.DartGroupEntry va } else { group_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.DartGroupEntry group = 1; */ private void clearGroup() { group_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse parseFrom( @@ -159,7 +160,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ListDartTestsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -239,10 +240,11 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "group_", }; java.lang.String info = - "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\t"; + "\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u1009\u0000"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -313,18 +315,6 @@ public interface DartGroupEntryOrBuilder extends com.google.protobuf.ByteString getNameBytes(); - /** - * string fullName = 2; - * @return The fullName. - */ - java.lang.String getFullName(); - /** - * string fullName = 2; - * @return The bytes for fullName. - */ - com.google.protobuf.ByteString - getFullNameBytes(); - /** * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The enum numeric value on the wire for type. @@ -360,7 +350,6 @@ public static final class DartGroupEntry extends DartGroupEntryOrBuilder { private DartGroupEntry() { name_ = ""; - fullName_ = ""; entries_ = emptyProtobufList(); } /** @@ -499,53 +488,6 @@ private void setNameBytes( } - public static final int FULLNAME_FIELD_NUMBER = 2; - private java.lang.String fullName_; - /** - * string fullName = 2; - * @return The fullName. - */ - @java.lang.Override - public java.lang.String getFullName() { - return fullName_; - } - /** - * string fullName = 2; - * @return The bytes for fullName. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getFullNameBytes() { - return com.google.protobuf.ByteString.copyFromUtf8(fullName_); - } - /** - * string fullName = 2; - * @param value The fullName to set. - */ - private void setFullName( - java.lang.String value) { - java.lang.Class valueClass = value.getClass(); - - fullName_ = value; - } - /** - * string fullName = 2; - */ - private void clearFullName() { - - fullName_ = getDefaultInstance().getFullName(); - } - /** - * string fullName = 2; - * @param value The bytes for fullName to set. - */ - private void setFullNameBytes( - com.google.protobuf.ByteString value) { - checkByteStringIsUtf8(value); - fullName_ = value.toStringUtf8(); - - } - public static final int TYPE_FIELD_NUMBER = 3; private int type_; /** @@ -762,7 +704,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DartGroupEntry prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -828,55 +770,6 @@ public Builder setNameBytes( return this; } - /** - * string fullName = 2; - * @return The fullName. - */ - @java.lang.Override - public java.lang.String getFullName() { - return instance.getFullName(); - } - /** - * string fullName = 2; - * @return The bytes for fullName. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getFullNameBytes() { - return instance.getFullNameBytes(); - } - /** - * string fullName = 2; - * @param value The fullName to set. - * @return This builder for chaining. - */ - public Builder setFullName( - java.lang.String value) { - copyOnWrite(); - instance.setFullName(value); - return this; - } - /** - * string fullName = 2; - * @return This builder for chaining. - */ - public Builder clearFullName() { - copyOnWrite(); - instance.clearFullName(); - return this; - } - /** - * string fullName = 2; - * @param value The bytes for fullName to set. - * @return This builder for chaining. - */ - public Builder setFullNameBytes( - com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setFullNameBytes(value); - return this; - } - /** * .patrol.DartGroupEntry.GroupEntryType type = 3; * @return The enum numeric value on the wire for type. @@ -1042,14 +935,13 @@ protected final java.lang.Object dynamicMethod( case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { "name_", - "fullName_", "type_", "entries_", pl.leancode.patrol.contracts.Contracts.DartGroupEntry.class, }; java.lang.String info = - "\u0000\u0004\u0000\u0000\u0001\u0004\u0004\u0000\u0001\u0000\u0001\u0208\u0002\u0208" + - "\u0003\f\u0004\u001b"; + "\u0000\u0003\u0000\u0000\u0001\u0004\u0003\u0000\u0001\u0000\u0001\u0208\u0003\f" + + "\u0004\u001b"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -1258,7 +1150,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -1717,7 +1609,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.RunDartTestResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2040,7 +1932,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.ConfigureRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2313,7 +2205,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenAppRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2702,7 +2594,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapOnNotificationRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -2994,7 +2886,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Empty prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3184,7 +3076,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.OpenQuickSettingsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3426,7 +3318,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.DarkModeRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3604,6 +3496,7 @@ public static final class GetNativeViewsRequest extends private GetNativeViewsRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -3611,7 +3504,7 @@ private GetNativeViewsRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -3626,7 +3519,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -3641,13 +3534,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -3777,7 +3670,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -3906,12 +3799,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -4169,7 +4063,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNativeViewsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4457,7 +4351,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4748,7 +4642,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.GetNotificationsResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -4980,6 +4874,7 @@ public static final class TapRequest extends private TapRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -4987,7 +4882,7 @@ private TapRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -5002,7 +4897,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -5017,13 +4912,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -5153,7 +5048,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.TapRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -5282,12 +5177,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -5423,26 +5319,10 @@ private EnterTextRequest() { public enum KeyboardBehavior implements com.google.protobuf.Internal.EnumLite { /** - *
-       * The default keyboard behavior.
-       *
-       * Keyboard will be shown when entering text starts, and will be
-       * automatically dismissed afterwards.
-       * 
- * * SHOW_AND_DISMISS = 0; */ SHOW_AND_DISMISS(0), /** - *
-       * The alternative keyboard behavior.
-       *
-       * On Android, no keyboard will be shown at all. The text will simply appear
-       * inside the TextField.
-       *
-       * On iOS, the keyboard will not be dismissed after entering text.
-       * 
- * * ALTERNATIVE = 1; */ ALTERNATIVE(1), @@ -5450,26 +5330,10 @@ public enum KeyboardBehavior ; /** - *
-       * The default keyboard behavior.
-       *
-       * Keyboard will be shown when entering text starts, and will be
-       * automatically dismissed afterwards.
-       * 
- * * SHOW_AND_DISMISS = 0; */ public static final int SHOW_AND_DISMISS_VALUE = 0; /** - *
-       * The alternative keyboard behavior.
-       *
-       * On Android, no keyboard will be shown at all. The text will simply appear
-       * inside the TextField.
-       *
-       * On iOS, the keyboard will not be dismissed after entering text.
-       * 
- * * ALTERNATIVE = 1; */ public static final int ALTERNATIVE_VALUE = 1; @@ -5885,7 +5749,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.EnterTextRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6536,7 +6400,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SwipeRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -6860,6 +6724,7 @@ public static final class WaitUntilVisibleRequest extends private WaitUntilVisibleRequest() { appId_ = ""; } + private int bitField0_; public static final int SELECTOR_FIELD_NUMBER = 1; private pl.leancode.patrol.contracts.Contracts.Selector selector_; /** @@ -6867,7 +6732,7 @@ private WaitUntilVisibleRequest() { */ @java.lang.Override public boolean hasSelector() { - return selector_ != null; + return ((bitField0_ & 0x00000001) != 0); } /** * .patrol.Selector selector = 1; @@ -6882,7 +6747,7 @@ public pl.leancode.patrol.contracts.Contracts.Selector getSelector() { private void setSelector(pl.leancode.patrol.contracts.Contracts.Selector value) { value.getClass(); selector_ = value; - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; @@ -6897,13 +6762,13 @@ private void mergeSelector(pl.leancode.patrol.contracts.Contracts.Selector value } else { selector_ = value; } - + bitField0_ |= 0x00000001; } /** * .patrol.Selector selector = 1; */ private void clearSelector() { selector_ = null; - + bitField0_ = (bitField0_ & ~0x00000001); } public static final int APPID_FIELD_NUMBER = 2; @@ -7033,7 +6898,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.WaitUntilVisibleRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7162,12 +7027,13 @@ protected final java.lang.Object dynamicMethod( } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { + "bitField0_", "selector_", "appId_", }; java.lang.String info = - "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0002\u0208" + - ""; + "\u0000\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u1009\u0000\u0002" + + "\u0208"; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through @@ -7467,7 +7333,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.HandlePermissionRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -7840,7 +7706,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SetLocationAccuracyRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8103,7 +7969,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -8348,7 +8214,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.PermissionDialogVisibleResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -9354,7 +9220,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Selector prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -10685,7 +10551,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.NativeView prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -11575,7 +11441,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.Notification prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -12104,7 +11970,7 @@ public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(pl.leancode.patrol.contracts.Contracts.SubmitTestResultsRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.createBuilder(prototype); } /** diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt index 42eba2f8e..e3f6f7fab 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/DartGroupEntryKt.kt @@ -44,23 +44,6 @@ public object DartGroupEntryKt { _builder.clearName() } - /** - * `string fullName = 2;` - */ - public var fullName: kotlin.String - @JvmName("getFullName") - get() = _builder.getFullName() - @JvmName("setFullName") - set(value) { - _builder.setFullName(value) - } - /** - * `string fullName = 2;` - */ - public fun clearFullName() { - _builder.clearFullName() - } - /** * `.patrol.DartGroupEntry.GroupEntryType type = 3;` */ diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift index a90f09b18..49f05de2b 100644 --- a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -39,10 +39,10 @@ final class RunnerTests: XCTestCase { let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithGroups() { let input = "example_test at the beginning" - let expectedOutput = "exampleTestatthebeginning" // FIXME: This is temporary + let expectedOutput = "exampleTestatthebeginning" // FIXME: This is temporary let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) NSLog(result) XCTAssertEqual(result, expectedOutput) diff --git a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift index ee414c11f..328760625 100644 --- a/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift +++ b/packages/patrol/ios/Classes/AutomatorServer/contracts.pb.swift @@ -48,8 +48,6 @@ public struct Patrol_DartGroupEntry { public var name: String = String() - public var fullName: String = String() - public var type: Patrol_DartGroupEntry.GroupEntryType = .group public var entries: [Patrol_DartGroupEntry] = [] @@ -91,7 +89,7 @@ public struct Patrol_DartGroupEntry { extension Patrol_DartGroupEntry.GroupEntryType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ + public static let allCases: [Patrol_DartGroupEntry.GroupEntryType] = [ .group, .test, ] @@ -169,7 +167,7 @@ public struct Patrol_RunDartTestResponse { extension Patrol_RunDartTestResponse.Result: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_RunDartTestResponse.Result] = [ + public static let allCases: [Patrol_RunDartTestResponse.Result] = [ .success, .skipped, .failure, @@ -428,19 +426,7 @@ public struct Patrol_EnterTextRequest { public enum KeyboardBehavior: SwiftProtobuf.Enum { public typealias RawValue = Int - - /// The default keyboard behavior. - /// - /// Keyboard will be shown when entering text starts, and will be - /// automatically dismissed afterwards. case showAndDismiss // = 0 - - /// The alternative keyboard behavior. - /// - /// On Android, no keyboard will be shown at all. The text will simply appear - /// inside the TextField. - /// - /// On iOS, the keyboard will not be dismissed after entering text. case alternative // = 1 case UNRECOGNIZED(Int) @@ -473,7 +459,7 @@ public struct Patrol_EnterTextRequest { extension Patrol_EnterTextRequest.KeyboardBehavior: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ + public static let allCases: [Patrol_EnterTextRequest.KeyboardBehavior] = [ .showAndDismiss, .alternative, ] @@ -573,7 +559,7 @@ public struct Patrol_HandlePermissionRequest { extension Patrol_HandlePermissionRequest.Code: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_HandlePermissionRequest.Code] = [ + public static let allCases: [Patrol_HandlePermissionRequest.Code] = [ .whileUsing, .onlyThisTime, .denied, @@ -626,7 +612,7 @@ public struct Patrol_SetLocationAccuracyRequest { extension Patrol_SetLocationAccuracyRequest.LocationAccuracy: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - public static var allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ + public static let allCases: [Patrol_SetLocationAccuracyRequest.LocationAccuracy] = [ .coarse, .fine, ] @@ -940,7 +926,6 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static let protoMessageName: String = _protobuf_package + ".DartGroupEntry" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), - 2: .same(proto: "fullName"), 3: .same(proto: "type"), 4: .same(proto: "entries"), ] @@ -952,7 +937,6 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.fullName) }() case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() case 4: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() default: break @@ -964,9 +948,6 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm if !self.name.isEmpty { try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) } - if !self.fullName.isEmpty { - try visitor.visitSingularStringField(value: self.fullName, fieldNumber: 2) - } if self.type != .group { try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) } @@ -978,7 +959,6 @@ extension Patrol_DartGroupEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageIm public static func ==(lhs: Patrol_DartGroupEntry, rhs: Patrol_DartGroupEntry) -> Bool { if lhs.name != rhs.name {return false} - if lhs.fullName != rhs.fullName {return false} if lhs.type != rhs.type {return false} if lhs.entries != rhs.entries {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/packages/patrol/lib/src/native/contracts/contracts.pb.dart b/packages/patrol/lib/src/native/contracts/contracts.pb.dart index b718df484..e027abda5 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pb.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pb.dart @@ -101,12 +101,6 @@ class DartGroupEntry extends $pb.GeneratedMessage { const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS( - 2, - const $core.bool.fromEnvironment('protobuf.omit_field_names') - ? '' - : 'fullName', - protoName: 'fullName') ..e( 3, const $core.bool.fromEnvironment('protobuf.omit_field_names') @@ -128,7 +122,6 @@ class DartGroupEntry extends $pb.GeneratedMessage { DartGroupEntry._() : super(); factory DartGroupEntry({ $core.String? name, - $core.String? fullName, DartGroupEntry_GroupEntryType? type, $core.Iterable? entries, }) { @@ -136,9 +129,6 @@ class DartGroupEntry extends $pb.GeneratedMessage { if (name != null) { _result.name = name; } - if (fullName != null) { - _result.fullName = fullName; - } if (type != null) { _result.type = type; } @@ -186,32 +176,20 @@ class DartGroupEntry extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearName() => clearField(1); - @$pb.TagNumber(2) - $core.String get fullName => $_getSZ(1); - @$pb.TagNumber(2) - set fullName($core.String v) { - $_setString(1, v); - } - - @$pb.TagNumber(2) - $core.bool hasFullName() => $_has(1); - @$pb.TagNumber(2) - void clearFullName() => clearField(2); - @$pb.TagNumber(3) - DartGroupEntry_GroupEntryType get type => $_getN(2); + DartGroupEntry_GroupEntryType get type => $_getN(1); @$pb.TagNumber(3) set type(DartGroupEntry_GroupEntryType v) { setField(3, v); } @$pb.TagNumber(3) - $core.bool hasType() => $_has(2); + $core.bool hasType() => $_has(1); @$pb.TagNumber(3) void clearType() => clearField(3); @$pb.TagNumber(4) - $core.List get entries => $_getList(3); + $core.List get entries => $_getList(2); } class RunDartTestRequest extends $pb.GeneratedMessage { diff --git a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart index 571b6c735..cd6e12490 100644 --- a/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart +++ b/packages/patrol/lib/src/native/contracts/contracts.pbjson.dart @@ -32,7 +32,6 @@ const DartGroupEntry$json = const { '1': 'DartGroupEntry', '2': const [ const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'fullName', '3': 2, '4': 1, '5': 9, '10': 'fullName'}, const { '1': 'type', '3': 3, @@ -64,7 +63,7 @@ const DartGroupEntry_GroupEntryType$json = const { /// Descriptor for `DartGroupEntry`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List dartGroupEntryDescriptor = $convert.base64Decode( - 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEhoKCGZ1bGxOYW1lGAIgASgJUghmdWxsTmFtZRI5CgR0eXBlGAMgASgOMiUucGF0cm9sLkRhcnRHcm91cEVudHJ5Lkdyb3VwRW50cnlUeXBlUgR0eXBlEjAKB2VudHJpZXMYBCADKAsyFi5wYXRyb2wuRGFydEdyb3VwRW50cnlSB2VudHJpZXMiJQoOR3JvdXBFbnRyeVR5cGUSCQoFR1JPVVAQABIICgRURVNUEAE='); + 'Cg5EYXJ0R3JvdXBFbnRyeRISCgRuYW1lGAEgASgJUgRuYW1lEjkKBHR5cGUYAyABKA4yJS5wYXRyb2wuRGFydEdyb3VwRW50cnkuR3JvdXBFbnRyeVR5cGVSBHR5cGUSMAoHZW50cmllcxgEIAMoCzIWLnBhdHJvbC5EYXJ0R3JvdXBFbnRyeVIHZW50cmllcyIlCg5Hcm91cEVudHJ5VHlwZRIJCgVHUk9VUBAAEggKBFRFU1QQAQ=='); @$core.Deprecated('Use runDartTestRequestDescriptor instead') const RunDartTestRequest$json = const { '1': 'RunDartTestRequest', From a20e1f374604757888a221497af9bdefc901706a Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 11:37:44 +0200 Subject: [PATCH 28/38] clean up: RunnerUITests - bring back macro usage --- .../example/ios/RunnerTests/RunnerTests.swift | 2 - .../example/ios/RunnerUITests/RunnerUITests.m | 111 ------------------ 2 files changed, 113 deletions(-) diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift index 49f05de2b..3ad264bde 100644 --- a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -1,5 +1,3 @@ -// TODO: Run these tests on CI - import XCTest import patrol diff --git a/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m b/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m index 8391f4a48..bfc5dbda2 100644 --- a/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m +++ b/packages/patrol/example/ios/RunnerUITests/RunnerUITests.m @@ -2,115 +2,4 @@ @import patrol; @import ObjectiveC.runtime; -// This file is a one giant macro to make the setup as easy as possible for the developer. -// To edit it: -// 1. Remove the trailing backslashes: $ sed 's/\\$//' ios/Classes/PatrolIntegrationTestRunner.h -// 2. Paste its contents into the RunnerUITests.m in the RunnerUITests target -// 3. Make the changes, make sure it works -// 4. Re-add trailing backslashes: $ sed 's/$/\\/' ios/Classes/PatrolIntegrationTestRunner.h -// 5. Copy the contents from RunnerUITests.m back here -// 6. Go back to using a macro in RunnerTests.m - -// For every Flutter dart test, dynamically generate an Objective-C method mirroring the test results -// so it is reported as a native XCTest run result. -#define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) - @interface __test_class : XCTestCase - @end - - @implementation __test_class - - +(NSArray *)testInvocations { - /* Start native automation gRPC server */ - PatrolServer *server = [[PatrolServer alloc] init]; - [server startWithCompletionHandler:^(NSError * err) { - NSLog(@"Server loop done, error: %@", err); - }]; - - /* Create a client for PatrolAppService, which lets us list and run Dart tests */ - __block PatrolAppServiceClient *appServiceClient = [[PatrolAppServiceClient alloc] init]; - - /* Allow the Local Network permission required by Dart Observatory */ - XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; - XCUIElementQuery *systemAlerts = springboard.alerts; - if (systemAlerts.buttons[@"Allow"].exists) { - [systemAlerts.buttons[@"Allow"] tap]; - } - - /* Run the app for the first time to gather Dart tests */ - [[[XCUIApplication alloc] init] launch]; - - /* Spin the runloop waiting until the app reports that it is ready to report Dart tests */ - while (!server.appReady) { - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; - } - - __block NSArray *dartTestFiles = NULL; - [appServiceClient - listDartTestsWithCompletionHandler:^(NSArray *_Nullable dartTests, NSError *_Nullable err) { - if (err != NULL) { - NSLog(@"listDartTests(): failed, err: %@", err); - } - - dartTestFiles = dartTests; - }]; - - /* Spin the runloop waiting until the app reports the Dart tests it contains */ - while (!dartTestFiles) { - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; - } - - NSLog(@"Got %lu Dart tests: %@", dartTestFiles.count, dartTestFiles); - - NSMutableArray *invocations = [[NSMutableArray alloc] init]; - - /** - * Once Dart tests are available, we: - * - * Step 1. Dynamically add test case methods that request execution of an individual Dart test file. - * - * Step 2. Create invocations to the generated methods and return them - */ - - for (NSString * dartTestFile in dartTestFiles) { - /* Step 1 - dynamically create test cases */ - - IMP implementation = imp_implementationWithBlock(^(id _self) { - [[[XCUIApplication alloc] init] launch]; - - __block RunDartTestResponse *response = NULL; - [appServiceClient runDartTestWithName:dartTestFile - completionHandler:^(RunDartTestResponse *_Nullable r, NSError *_Nullable err) { - if (err != NULL) { - NSLog(@"runDartTestWithName(%@): failed, err: %@", dartTestFile, err); - } - - response = r; - }]; - - /* Wait until Dart test finishes */ - while (!response) { - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; - } - - XCTAssertTrue(response.passed, @"%@", response.details); - }); - NSString *selectorName = [PatrolUtils createMethodNameFromPatrolGeneratedGroup:dartTestFile]; - SEL selector = NSSelectorFromString(selectorName); - class_addMethod(self, selector, implementation, "v@:"); - - /* Step 2 – create invocations to the dynamically created methods */ - NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; - invocation.selector = selector; - - NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", selectorName, signature); - - [invocations addObject:invocation]; - } - - return invocations; - } - - @end - PATROL_INTEGRATION_TEST_IOS_RUNNER(RunnerUITests) From 1b44a732080858f683eadb45db39fea95a3c7e15 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 12:01:36 +0200 Subject: [PATCH 29/38] update comments and outdated variable names --- .../patrol/ContractsExtensionsTest.kt | 8 +- .../ios/Classes/PatrolAppServiceClient.swift | 2 - .../ios/Classes/PatrolIntegrationTestRunner.h | 196 +++++++++--------- packages/patrol/lib/src/binding.dart | 9 +- .../lib/src/native/patrol_app_service.dart | 34 +-- 5 files changed, 125 insertions(+), 124 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 54326426e..bd7c491f6 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 @@ -39,7 +39,7 @@ class DartTestGroupExtensionsTest { } // when - val dartTestFiles = dartTestGroup.listTestsFlat() + val dartTests = dartTestGroup.listTestsFlat() // then assertContentEquals( @@ -48,7 +48,7 @@ class DartTestGroupExtensionsTest { dartTestCase { name = "open_app_test open maps" }, dartTestCase { name = "webview_test interacts with the LeanCode website in a webview" }, ), - dartTestFiles, + dartTests, ) } @@ -96,7 +96,7 @@ class DartTestGroupExtensionsTest { } // when - val dartTestFiles = rootDartTestGroup.listTestsFlat() + val dartTests = rootDartTestGroup.listTestsFlat() // then assertContentEquals( @@ -112,7 +112,7 @@ class DartTestGroupExtensionsTest { dartTestCase { name = "open_app_test open maps" }, dartTestCase { name = "open_app_test open browser" }, ), - dartTestFiles, + dartTests, ) } } diff --git a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift index 3cf153c21..ad6e210df 100644 --- a/packages/patrol/ios/Classes/PatrolAppServiceClient.swift +++ b/packages/patrol/ios/Classes/PatrolAppServiceClient.swift @@ -41,8 +41,6 @@ import NIO let request = Patrol_Empty() let response = try await client.listDartTests(request) - NSLog("RAW: Got tests: \(response.group)") - return response.group.listTestsFlat(parentGroupName: "").map { $0.name } diff --git a/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h b/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h index b5a123da6..ab8f5a83f 100644 --- a/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h +++ b/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h @@ -9,102 +9,102 @@ // For every Flutter dart test, dynamically generate an Objective-C method mirroring the test results // so it is reported as a native XCTest run result. -#define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) \ - @interface __test_class : XCTestCase \ - @end \ - \ - @implementation __test_class \ - \ - +(NSArray *)testInvocations { \ - /* Start native automation gRPC server */ \ - PatrolServer *server = [[PatrolServer alloc] init]; \ - [server startWithCompletionHandler:^(NSError * err) { \ - NSLog(@"Server loop done, error: %@", err); \ - }]; \ - \ - /* Create a client for PatrolAppService, which lets us list and run Dart tests */ \ - __block PatrolAppServiceClient *appServiceClient = [[PatrolAppServiceClient alloc] init]; \ - \ - /* Allow the Local Network permission required by Dart Observatory */ \ - XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; \ - XCUIElementQuery *systemAlerts = springboard.alerts; \ - if (systemAlerts.buttons[@"Allow"].exists) { \ - [systemAlerts.buttons[@"Allow"] tap]; \ - } \ - \ - /* Run the app for the first time to gather Dart tests */ \ - [[[XCUIApplication alloc] init] launch]; \ - \ - /* Spin the runloop waiting until the app reports that it is ready to report Dart tests */ \ - while (!server.appReady) { \ - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ - } \ - \ - __block NSArray *dartTestFiles = NULL; \ - [appServiceClient \ - listDartTestsWithCompletionHandler:^(NSArray *_Nullable dartTests, NSError *_Nullable err) { \ - if (err != NULL) { \ - NSLog(@"listDartTests(): failed, err: %@", err); \ - } \ - \ - dartTestFiles = dartTests; \ - }]; \ - \ - /* Spin the runloop waiting until the app reports the Dart tests it contains */ \ - while (!dartTestFiles) { \ - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ - } \ - \ - NSLog(@"Got %lu Dart tests: %@", dartTestFiles.count, dartTestFiles); \ - \ - NSMutableArray *invocations = [[NSMutableArray alloc] init]; \ - \ - /** \ - * Once Dart tests are available, we: \ - * \ - * Step 1. Dynamically add test case methods that request execution of an individual Dart test file. \ - * \ - * Step 2. Create invocations to the generated methods and return them \ - */ \ - \ - for (NSString * dartTestFile in dartTestFiles) { \ - /* Step 1 - dynamically create test cases */ \ - \ - IMP implementation = imp_implementationWithBlock(^(id _self) { \ - [[[XCUIApplication alloc] init] launch]; \ - \ - __block RunDartTestResponse *response = NULL; \ - [appServiceClient runDartTestWithName:dartTestFile \ - completionHandler:^(RunDartTestResponse *_Nullable r, NSError *_Nullable err) { \ - if (err != NULL) { \ - NSLog(@"runDartTestWithName(%@): failed, err: %@", dartTestFile, err); \ - } \ - \ - response = r; \ - }]; \ - \ - /* Wait until Dart test finishes */ \ - while (!response) { \ - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ - } \ - \ - XCTAssertTrue(response.passed, @"%@", response.details); \ - }); \ - NSString *selectorName = [PatrolUtils createMethodNameFromPatrolGeneratedGroup:dartTestFile]; \ - SEL selector = NSSelectorFromString(selectorName); \ - class_addMethod(self, selector, implementation, "v@:"); \ - \ - /* Step 2 – create invocations to the dynamically created methods */ \ - NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ - invocation.selector = selector; \ - \ - NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", selectorName, signature); \ - \ - [invocations addObject:invocation]; \ - } \ - \ - return invocations; \ - } \ - \ +#define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) \ + @interface __test_class : XCTestCase \ + @end \ + \ + @implementation __test_class \ + \ + +(NSArray *)testInvocations { \ + /* Start native automation gRPC server */ \ + PatrolServer *server = [[PatrolServer alloc] init]; \ + [server startWithCompletionHandler:^(NSError * err) { \ + NSLog(@"Server loop done, error: %@", err); \ + }]; \ + \ + /* Create a client for PatrolAppService, which lets us list and run Dart tests */ \ + __block PatrolAppServiceClient *appServiceClient = [[PatrolAppServiceClient alloc] init]; \ + \ + /* Allow the Local Network permission required by Dart Observatory */ \ + XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; \ + XCUIElementQuery *systemAlerts = springboard.alerts; \ + if (systemAlerts.buttons[@"Allow"].exists) { \ + [systemAlerts.buttons[@"Allow"] tap]; \ + } \ + \ + /* Run the app for the first time to gather Dart tests */ \ + [[[XCUIApplication alloc] init] launch]; \ + \ + /* Spin the runloop waiting until the app reports that it is ready to report Dart tests */ \ + while (!server.appReady) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + \ + __block NSArray *dartTests = NULL; \ + [appServiceClient \ + listDartTestsWithCompletionHandler:^(NSArray *_Nullable tests, NSError *_Nullable err) { \ + if (err != NULL) { \ + NSLog(@"listDartTests(): failed, err: %@", err); \ + } \ + \ + dartTests = tests; \ + }]; \ + \ + /* Spin the runloop waiting until the app reports the Dart tests it contains */ \ + while (!dartTests) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + \ + NSLog(@"Got %lu Dart tests: %@", dartTests.count, dartTests); \ + \ + NSMutableArray *invocations = [[NSMutableArray alloc] init]; \ + \ + /** \ + * Once Dart tests are available, we: \ + * \ + * Step 1. Dynamically add test case methods that request execution of an individual Dart test file. \ + * \ + * Step 2. Create invocations to the generated methods and return them \ + */ \ + \ + for (NSString * dartTest in dartTests) { \ + /* Step 1 - dynamically create test cases */ \ + \ + IMP implementation = imp_implementationWithBlock(^(id _self) { \ + [[[XCUIApplication alloc] init] launch]; \ + \ + __block RunDartTestResponse *response = NULL; \ + [appServiceClient runDartTestWithName:dartTest \ + completionHandler:^(RunDartTestResponse *_Nullable r, NSError *_Nullable err) { \ + if (err != NULL) { \ + NSLog(@"runDartTestWithName(%@): failed, err: %@", dartTest, err); \ + } \ + \ + response = r; \ + }]; \ + \ + /* Wait until Dart test finishes */ \ + while (!response) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + \ + XCTAssertTrue(response.passed, @"%@", response.details); \ + }); \ + NSString *selectorName = [PatrolUtils createMethodNameFromPatrolGeneratedGroup:dartTest]; \ + SEL selector = NSSelectorFromString(selectorName); \ + class_addMethod(self, selector, implementation, "v@:"); \ + \ + /* Step 2 – create invocations to the dynamically created methods */ \ + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ + invocation.selector = selector; \ + \ + NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", selectorName, signature); \ + \ + [invocations addObject:invocation]; \ + } \ + \ + return invocations; \ + } \ + \ @end\ diff --git a/packages/patrol/lib/src/binding.dart b/packages/patrol/lib/src/binding.dart index 4237a676c..02a61d8b7 100644 --- a/packages/patrol/lib/src/binding.dart +++ b/packages/patrol/lib/src/binding.dart @@ -46,11 +46,10 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { PatrolBinding() { final oldTestExceptionReporter = reportTestException; reportTestException = (details, testDescription) { - final currentDartTestFile = _currentDartTest; - if (currentDartTestFile != null) { + final currentDartTest = _currentDartTest; + if (currentDartTest != null) { assert(!constants.hotRestartEnabled); - _testResults[currentDartTestFile] = - Failure(testDescription, '$details'); + _testResults[currentDartTest] = Failure(testDescription, '$details'); } oldTestExceptionReporter(details, testDescription); }; @@ -175,7 +174,7 @@ class PatrolBinding extends IntegrationTestWidgetsFlutterBinding { void attachRootWidget(Widget rootWidget) { assert( (_currentDartTest != null) != (constants.hotRestartEnabled), - '_currentDartTestFile can be null if and only if Hot Restart is enabled', + '_currentDartTest can be null if and only if Hot Restart is enabled', ); const testLabelEnabled = bool.fromEnvironment('PATROL_TEST_LABEL_ENABLED'); diff --git a/packages/patrol/lib/src/native/patrol_app_service.dart b/packages/patrol/lib/src/native/patrol_app_service.dart index d2ce94444..37b684ee0 100644 --- a/packages/patrol/lib/src/native/patrol_app_service.dart +++ b/packages/patrol/lib/src/native/patrol_app_service.dart @@ -1,10 +1,12 @@ +//TODO: Use a logger instead of print + // ignore_for_file: avoid_print -// TODO: Use a logger instead of print import 'dart:async'; import 'dart:io' as io; import 'package:grpc/grpc.dart'; +import 'package:patrol/src/common.dart'; import 'package:patrol/src/native/contracts/contracts.pbgrpc.dart'; const _port = 8082; @@ -84,30 +86,32 @@ class PatrolAppService extends PatrolAppServiceBase { ); } - /// Returns when the native side requests execution of a Dart test file. + /// Returns when the native side requests execution of a Dart test. If the + /// native side requsted execution of [dartTest], returns true. Otherwise + /// returns false. /// - /// The native side requests execution by RPC-ing [runDartTest] and providing - /// name of a Dart test file. + /// It's used inside of [patrolTest] to halt execution of test body until + /// [runDartTest] is called. /// - /// Returns true if the native side requsted execution of [dartTestFile]. - /// Returns false otherwise. - Future waitForExecutionRequest(String dartTestFile) async { - print('PatrolAppService: registered "$dartTestFile"'); - - final requestedDartTestFile = await testExecutionRequested; - if (requestedDartTestFile != dartTestFile) { - // If the requested Dart test file is not the one we're waiting for now, - // it means that dartTestFile was already executed. Return false so that + /// The native side requests execution by RPC-ing [runDartTest] and providing + /// name of a Dart test that it wants to currently execute [dartTest]. + Future waitForExecutionRequest(String dartTest) async { + print('PatrolAppService: registered "$dartTest"'); + + final requestedDartTest = await testExecutionRequested; + if (requestedDartTest != dartTest) { + // If the requested Dart test is not the one we're waiting for now, + // it means that dartTest was already executed. Return false so that // callers can skip the already executed test. print( - 'PatrolAppService: registered test "$dartTestFile" was not matched by requested test "$requestedDartTestFile"', + 'PatrolAppService: registered test "$dartTest" was not matched by requested test "$requestedDartTest"', ); return false; } - print('PatrolAppService: requested execution of test "$dartTestFile"'); + print('PatrolAppService: requested execution of test "$dartTest"'); return true; } From a53e42a43e57bc5afc7251ff7d10fa6698403f6e Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 12:20:43 +0200 Subject: [PATCH 30/38] improve code comment --- packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h | 2 +- packages/patrol_cli/lib/src/test_bundler.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h b/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h index ab8f5a83f..d376cedb8 100644 --- a/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h +++ b/packages/patrol/ios/Classes/PatrolIntegrationTestRunner.h @@ -94,7 +94,7 @@ SEL selector = NSSelectorFromString(selectorName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ - /* Step 2 – create invocations to the dynamically created methods */ \ + /* Step 2 – create invocations to the dynamically created methods */ \ NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index 1e85599ce..d52c24033 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -79,8 +79,8 @@ Future main() async { // This test must be the first to run. If not, the native side likely won't // receive any tests, and everything will fall apart. test('patrol_test_explorer', () { - // Counterintuitively, this callback runs *after* the calls to group() - // below. + // Maybe somewhat counterintuitively, this callback runs *after* the calls + // to group() below. final topLevelGroup = Invoker.current!.liveTest.groups.first; final dartTestGroup = createDartTestGroup(topLevelGroup); testExplorationCompleter.complete(dartTestGroup); From 35823b3459b64221cafd5f030e99cbc00a19a2a0 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 14:41:32 +0200 Subject: [PATCH 31/38] fix test names on iOS --- .../example/ios/RunnerTests/RunnerTests.swift | 74 ++++++++++++++----- packages/patrol/ios/Classes/PatrolUtils.h | 2 + packages/patrol/ios/Classes/PatrolUtils.m | 70 ++++++++++++++++-- 3 files changed, 122 insertions(+), 24 deletions(-) diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift index 3ad264bde..205b8e94c 100644 --- a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -2,47 +2,87 @@ import XCTest import patrol final class RunnerTests: XCTestCase { - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithDotAndUnderscore() { - let input = "example.example_test" - let expectedOutput = "example_exampleTest" - + func testCreateMethodNameFromPatrolGeneratedGroup_example1() { + let input = "example_test simple test" + let expectedOutput = "exampleTest___simpleTest" let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithUnderscoreOnly() { - let input = "example_test" - let expectedOutput = "exampleTest" + func testCreateMethodNameFromPatrolGeneratedGroup_example2() { + let input = "example.example_test group name test name" + let expectedOutput = "example_exampleTest___groupNameTestName" + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithMultipleDotsAndUnderscores() { - let input = "flows.login.sign_in" - let expectedOutput = "flows_login_signIn" + func testCreateMethodNameFromPatrolGeneratedGroup_example3() { + let input = "flows.login.sign_in logs into the app" + let expectedOutput = "flows_login_signIn___logsIntoTheApp" let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithSingleComponent() { + func testCreateMethodNameFromPatrolGeneratedGroup_example4() { + // Malformed edge case let input = "single" - let expectedOutput = "single" + let expectedOutput = "single___" let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithEmptyString() { + func testCreateMethodNameFromPatrolGeneratedGroup_example5() { + // Malformed edge case let input = "" - let expectedOutput = "" + let expectedOutput = "___" let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } - func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithGroups() { + func testCreateMethodNameFromPatrolGeneratedGroup_example6() { let input = "example_test at the beginning" - let expectedOutput = "exampleTestatthebeginning" // FIXME: This is temporary + let expectedOutput = "exampleTest___atTheBeginning" // FIXME: This is temporary let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) - NSLog(result) + XCTAssertEqual(result, expectedOutput) + } + + func testConvertFirstPart_example1() { + let input = "example_test" + let expectedOutput = "exampleTest" + + let result = PatrolUtils.convertFirstPart(input) + XCTAssertEqual(result, expectedOutput) + } + + func testConvertFirstPart_example2() { + let input = "example.example_test" + let expectedOutput = "example_exampleTest" + + let result = PatrolUtils.convertFirstPart(input) + XCTAssertEqual(result, expectedOutput) + } + + func testConvertFirstPart_example3() { + let input = "flows.login.sign_in" + let expectedOutput = "flows_login_signIn" + let result = PatrolUtils.convertFirstPart(input) + XCTAssertEqual(result, expectedOutput) + } + + func testConvertSecondPart_example1() { + let input = "completes main flow" + let expectedOutput = "completesMainFlow" + + let result = PatrolUtils.convertSecondPart(input) + XCTAssertEqual(result, expectedOutput) + } + + func testConvertSecondPart_example2() { + let input = "first group secondTest completes_fast!!!" + let expectedOutput = "firstGroupSecondTestCompletes_fast" + + let result = PatrolUtils.convertSecondPart(input) XCTAssertEqual(result, expectedOutput) } } diff --git a/packages/patrol/ios/Classes/PatrolUtils.h b/packages/patrol/ios/Classes/PatrolUtils.h index 76c93ba18..2ae389146 100644 --- a/packages/patrol/ios/Classes/PatrolUtils.h +++ b/packages/patrol/ios/Classes/PatrolUtils.h @@ -6,6 +6,8 @@ NS_ASSUME_NONNULL_BEGIN /// Converts test group names in Dart (generated by Patrol CLI) into a valid Objective-C method name. + (NSString *)createMethodNameFromPatrolGeneratedGroup:(NSString *)dartTestGroup; ++ (NSString *)convertFirstPart:(NSString *)filePath; ++ (NSString *)convertSecondPart:(NSString *)filePath; @end NS_ASSUME_NONNULL_END diff --git a/packages/patrol/ios/Classes/PatrolUtils.m b/packages/patrol/ios/Classes/PatrolUtils.m index 157dfa254..6e778dc36 100644 --- a/packages/patrol/ios/Classes/PatrolUtils.m +++ b/packages/patrol/ios/Classes/PatrolUtils.m @@ -6,10 +6,36 @@ @implementation PatrolUtils + (NSString *)createMethodNameFromPatrolGeneratedGroup:(NSString *)dartGroupName { - NSMutableString *temp = [NSMutableString stringWithString:dartGroupName]; + // Let's assume dartGroupName is "examples.example_test completes main flow". + // It consists of two parts. + // + // The first part, "examples.example_test", reflects the location of the Dart + // test file in the filesystem at integration_test/examples/example_test. + // For the first part of this name to be a valid Objective-C identifier, we convert + // it to "examples_exampleTest" + // + // The second part, "completes main flow" is the name of the test. For it to be a + // valid Objective-C identifier, we convert it to "completesMainFlow". + // + // Then both parts are concatenated together with a "___", resulting in + // "examples_exampleTest___completesMainFlow" + NSArray *parts = [[self class] splitIntoParts:dartGroupName]; + + NSString *firstPart = [[self class] convertFirstPart:parts[0]]; + NSString *secondPart = [[self class] convertSecondPart:parts[1]]; + + NSString *result = @""; + result = [result stringByAppendingString:firstPart]; + result = [result stringByAppendingString:@"___"]; + result = [result stringByAppendingString:secondPart]; + + return result; +} + ++ (NSString *)convertFirstPart:(NSString *)filePath { // Split the string by dot - NSArray *components = [[temp componentsSeparatedByString:@"."] mutableCopy]; + NSArray *components = [[filePath componentsSeparatedByString:@"."] mutableCopy]; // Convert the filename from snake_case to camelCase NSMutableString *fileName = [components.lastObject mutableCopy]; @@ -23,22 +49,52 @@ + (NSString *)createMethodNameFromPatrolGeneratedGroup:(NSString *)dartGroupName [fileName appendString:camelCaseWord]; } - NSMutableArray *pathComponents = - [[components subarrayWithRange:NSMakeRange(0, components.count - 1)] mutableCopy]; + NSRange range = NSMakeRange(0, components.count - 1); + NSMutableArray *pathComponents = [[components subarrayWithRange:range] mutableCopy]; if (pathComponents.count > 0) { NSString *path = [pathComponents componentsJoinedByString:@"_"]; [fileName setString:[NSString stringWithFormat:@"%@_%@", path, fileName]]; } + return fileName; +} + ++ (NSString *)convertSecondPart:(NSString *)testName { + // Convert the filename from "space delimeted words" to camelCasedWords + // NSString.capitalizedString could be used here as well. + + NSArray *words = [testName componentsSeparatedByString:@" "]; + NSMutableString *capitalizedTestName = [words.firstObject mutableCopy]; + [capitalizedTestName setString:words[0]]; + for (NSUInteger i = 1; i < words.count; i++) { + NSString *word = words[i]; + NSString *firstLetter = [[word substringToIndex:1] capitalizedString]; + NSString *restOfWord = [word substringFromIndex:1]; + NSString *camelCaseWord = [firstLetter stringByAppendingString:restOfWord]; + [capitalizedTestName appendString:camelCaseWord]; + } + // Objective-C method names must be alphanumeric. NSMutableCharacterSet *allowedCharacters = [NSMutableCharacterSet alphanumericCharacterSet]; // invertedSet [allowedCharacters addCharactersInString:@"_"]; NSCharacterSet *disallowedCharacters = allowedCharacters.invertedSet; // Remove disallowed characters. - NSString *upperCamelTestName = - [[fileName componentsSeparatedByCharactersInSet:disallowedCharacters] componentsJoinedByString:@""]; - return upperCamelTestName; + NSString *filteredTestName = + [[capitalizedTestName componentsSeparatedByCharactersInSet:disallowedCharacters] componentsJoinedByString:@""]; + return filteredTestName; +} + ++ (NSArray *)splitIntoParts:(NSString *)testName { + // The first space in the original dartGroupName is a good separator for the 2 parts. + NSArray *parts = [[testName componentsSeparatedByString:@" "] mutableCopy]; + NSString *firstPart = parts[0]; + NSString *secondPart = [[parts subarrayWithRange:NSMakeRange(1, parts.count - 1)] componentsJoinedByString:@" "]; + + NSMutableArray *result = [[NSMutableArray alloc] init]; + [result addObject:firstPart]; + [result addObject:secondPart]; + return result; } @end From 0345cf4adc1654321ec89285045b9ffb1acf9c8f Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 14:56:31 +0200 Subject: [PATCH 32/38] patrol-prepare workflow: move set -o pipefail to a separate line --- .github/workflows/patrol-prepare.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index f4d317e10..1654c0908 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -155,7 +155,8 @@ jobs: - name: Run unit tests working-directory: packages/patrol/example/ios run: | - set -o pipefail && xcodebuild test \ + set -o pipefail + xcodebuild test \ -workspace Runner.xcworkspace \ -scheme Runner \ -only-testing RunnerTests \ From a2db518a359f7eddf4fb9336bd05f95f8d6ec345 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 14:58:51 +0200 Subject: [PATCH 33/38] remove leftover comment --- .../patrol/example/ios/RunnerTests/RunnerTests.swift | 2 +- packages/patrol/lib/src/native/patrol_app_service.dart | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift index 205b8e94c..eecf7234b 100644 --- a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -42,7 +42,7 @@ final class RunnerTests: XCTestCase { func testCreateMethodNameFromPatrolGeneratedGroup_example6() { let input = "example_test at the beginning" - let expectedOutput = "exampleTest___atTheBeginning" // FIXME: This is temporary + let expectedOutput = "exampleTest___atTheBeginning" let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) XCTAssertEqual(result, expectedOutput) } diff --git a/packages/patrol/lib/src/native/patrol_app_service.dart b/packages/patrol/lib/src/native/patrol_app_service.dart index 37b684ee0..db3f470c2 100644 --- a/packages/patrol/lib/src/native/patrol_app_service.dart +++ b/packages/patrol/lib/src/native/patrol_app_service.dart @@ -1,7 +1,7 @@ -//TODO: Use a logger instead of print - // ignore_for_file: avoid_print +// TODO: Use a logger instead of print + import 'dart:async'; import 'dart:io' as io; @@ -100,9 +100,9 @@ class PatrolAppService extends PatrolAppServiceBase { final requestedDartTest = await testExecutionRequested; if (requestedDartTest != dartTest) { - // If the requested Dart test is not the one we're waiting for now, - // it means that dartTest was already executed. Return false so that - // callers can skip the already executed test. + // If the requested Dart test is not the one we're waiting for now, it + // means that dartTest was already executed. Return false so that callers + // can skip the already executed test. print( 'PatrolAppService: registered test "$dartTest" was not matched by requested test "$requestedDartTest"', From 04b41fba856e2d7bc0a71f5360cdf3bec7acdcfa Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 17:15:24 +0200 Subject: [PATCH 34/38] example app tests: handle `else` case for Platform --- packages/patrol/example/integration_test/open_app_test.dart | 4 ++++ packages/patrol/example/integration_test/swipe_test.dart | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/patrol/example/integration_test/open_app_test.dart b/packages/patrol/example/integration_test/open_app_test.dart index 0cf550fbd..fa1a4b231 100644 --- a/packages/patrol/example/integration_test/open_app_test.dart +++ b/packages/patrol/example/integration_test/open_app_test.dart @@ -11,6 +11,8 @@ void main() { mapsId = 'com.apple.Maps'; } else if (Platform.isAndroid) { mapsId = 'com.google.android.apps.maps'; + } else { + throw UnsupportedError('Unsupported platform'); } await createApp($); @@ -33,6 +35,8 @@ void main() { browserId = 'com.apple.mobilesafari'; } else if (Platform.isAndroid) { browserId = 'com.android.chrome'; + } else { + throw UnsupportedError('Unsupported platform'); } await createApp($); diff --git a/packages/patrol/example/integration_test/swipe_test.dart b/packages/patrol/example/integration_test/swipe_test.dart index ef959d108..02ef39835 100644 --- a/packages/patrol/example/integration_test/swipe_test.dart +++ b/packages/patrol/example/integration_test/swipe_test.dart @@ -8,6 +8,8 @@ void main() { appId = 'com.apple.Preferences'; } else if (Platform.isAndroid) { appId = 'com.android.settings'; + } else { + throw UnsupportedError('Unsupported platform'); } patrol('scrolls the Settings app', ($) async { From 86b9b1293d5c4be32fa6fdb5fd8e9faf8fd84ff0 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 12 Sep 2023 17:22:00 +0200 Subject: [PATCH 35/38] DartGroupEntry.listDartTests: fail more loudly when invariant is violated --- .../src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt | 2 +- packages/patrol/ios/Classes/PatrolAppServiceClient.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt index 593b74404..69100a636 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/ContractsExtensions.kt @@ -195,7 +195,7 @@ fun DartGroupEntry.listTestsFlat(parentGroupName: String = ""): List Date: Wed, 13 Sep 2023 10:31:47 +0200 Subject: [PATCH 36/38] convert unnecessary `late`s to `final`s --- packages/patrol/example/integration_test/open_app_test.dart | 4 ++-- packages/patrol/example/integration_test/swipe_test.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/patrol/example/integration_test/open_app_test.dart b/packages/patrol/example/integration_test/open_app_test.dart index fa1a4b231..c52a7a13c 100644 --- a/packages/patrol/example/integration_test/open_app_test.dart +++ b/packages/patrol/example/integration_test/open_app_test.dart @@ -6,7 +6,7 @@ import 'common.dart'; void main() { patrol('open maps', ($) async { - late String mapsId; + final String mapsId; if (Platform.isIOS) { mapsId = 'com.apple.Maps'; } else if (Platform.isAndroid) { @@ -30,7 +30,7 @@ void main() { }); patrol('open browser', ($) async { - late String browserId; + final String browserId; if (Platform.isIOS) { browserId = 'com.apple.mobilesafari'; } else if (Platform.isAndroid) { diff --git a/packages/patrol/example/integration_test/swipe_test.dart b/packages/patrol/example/integration_test/swipe_test.dart index 02ef39835..370223659 100644 --- a/packages/patrol/example/integration_test/swipe_test.dart +++ b/packages/patrol/example/integration_test/swipe_test.dart @@ -3,7 +3,7 @@ import 'dart:io' show Platform; import 'common.dart'; void main() { - late String appId; + final String appId; if (Platform.isIOS) { appId = 'com.apple.Preferences'; } else if (Platform.isAndroid) { From 19fecdc0460d2d00ecc8f93b743919c8f3fced0b Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Wed, 13 Sep 2023 10:41:22 +0200 Subject: [PATCH 37/38] TestBundler: update `print` message in generated test_bundle.dart --- packages/patrol_cli/lib/src/test_bundler.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index d52c24033..69e01200d 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -84,7 +84,7 @@ Future main() async { final topLevelGroup = Invoker.current!.liveTest.groups.first; final dartTestGroup = createDartTestGroup(topLevelGroup); testExplorationCompleter.complete(dartTestGroup); - print('PATROL_DEBUG: group structure:'); + print('patrol_test_explorer: obtained Dart-side test hierarchy:'); printGroupStructure(dartTestGroup); }); From ef29f1de8889b94d66cb4dccbc0d2c5d87c66534 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Wed, 13 Sep 2023 10:52:36 +0200 Subject: [PATCH 38/38] bring back old example_test --- .../integration_test/example_test.dart | 54 ++++++------------- .../example/integration_test/internal/README | 2 + .../integration_test/internal/group_test.dart | 45 ++++++++++++++++ 3 files changed, 64 insertions(+), 37 deletions(-) create mode 100644 packages/patrol/example/integration_test/internal/README create mode 100644 packages/patrol/example/integration_test/internal/group_test.dart diff --git a/packages/patrol/example/integration_test/example_test.dart b/packages/patrol/example/integration_test/example_test.dart index c4d964e8f..62aeac09a 100644 --- a/packages/patrol/example/integration_test/example_test.dart +++ b/packages/patrol/example/integration_test/example_test.dart @@ -1,47 +1,27 @@ -import 'package:patrol/src/extensions.dart'; -// ignore: depend_on_referenced_packages -import 'package:test_api/src/backend/invoker.dart'; +import 'package:flutter/material.dart'; import 'common.dart'; void main() { - // FIXME: iOS implementation not tested with non-alphabetic test names. + patrol( + 'counter state is the same after going to Home and switching apps', + ($) async { + await createApp($); - patrol('at the beginning', ($) async { - await _testBody($); - }); - group('top level group in file', () { - group('alpha', () { - patrol('first', ($) async { - await _testBody($); - }); - patrol('second', ($) async { - await _testBody($); - }); - }); + await $(FloatingActionButton).tap(); + expect($(#counterText).text, '1'); - patrol('in the middle', ($) async { - await _testBody($); - }); + await $(#textField).enterText('Hello, Flutter!'); + expect($('Hello, Flutter!'), findsOneWidget); - group('bravo', () { - patrol('first', ($) async { - await _testBody($); - }); - patrol('second', ($) async { - await _testBody($); - }); - }); - }); -} - -// FIXME: Only for debugging and development. To be removed. -Future _testBody(PatrolTester $) async { - await createApp($); + await $.native.pressHome(); + await $.native.openApp(); - final testName = Invoker.current!.fullCurrentTestName(); - await $(#textField).enterText(testName); + expect($(#counterText).text, '1'); + await $(FloatingActionButton).tap(); - await $.native.pressHome(); - await $.native.openApp(); + expect($(#counterText).text, '2'); + expect($('Hello, Flutter!'), findsOneWidget); + }, + ); } diff --git a/packages/patrol/example/integration_test/internal/README b/packages/patrol/example/integration_test/internal/README new file mode 100644 index 000000000..b708d68e8 --- /dev/null +++ b/packages/patrol/example/integration_test/internal/README @@ -0,0 +1,2 @@ +Tests in this directory are used for developing & testing Patrol itself, not for +demonstrating the API. diff --git a/packages/patrol/example/integration_test/internal/group_test.dart b/packages/patrol/example/integration_test/internal/group_test.dart new file mode 100644 index 000000000..4acbc78ca --- /dev/null +++ b/packages/patrol/example/integration_test/internal/group_test.dart @@ -0,0 +1,45 @@ +import 'package:patrol/src/extensions.dart'; +// ignore: depend_on_referenced_packages +import 'package:test_api/src/backend/invoker.dart'; + +import '../common.dart'; + +void main() { + patrol('at the beginning', ($) async { + await _testBody($); + }); + + group('top level group in file', () { + group('alpha', () { + patrol('first', ($) async { + await _testBody($); + }); + patrol('second', ($) async { + await _testBody($); + }); + }); + + patrol('in the middle', ($) async { + await _testBody($); + }); + + group('bravo', () { + patrol('first', ($) async { + await _testBody($); + }); + patrol('second', ($) async { + await _testBody($); + }); + }); + }); +} + +Future _testBody(PatrolTester $) async { + await createApp($); + + final testName = Invoker.current!.fullCurrentTestName(); + await $(#textField).enterText(testName); + + await $.native.pressHome(); + await $.native.openApp(); +}