From 2e161eb4590a830014b549de0e1e7b522fc1d73d Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:13:49 +0100 Subject: [PATCH 01/17] Add trailing commas --- example/lib/simple_menu/view/simple_menu.dart | 2 +- .../fluttium/lib/src/actions/clear_text.dart | 2 +- packages/fluttium/lib/src/registry.dart | 4 +-- .../helpers/matchers/is_delete_backwards.dart | 2 +- .../test/helpers/matchers/is_text.dart | 2 +- packages/fluttium/test/src/registry_test.dart | 6 ++-- .../test_command/test_command_test.dart | 26 +++++++------- .../test/src/json_decode_safely_test.dart | 2 +- .../test/src/fluttium_driver_test.dart | 36 +++++++++---------- .../test/src/step_result_test.dart | 4 +-- .../lib/src/fluttium/fluttium_yaml.dart | 2 +- .../lib/src/user_flow/user_flow_yaml.dart | 2 +- .../src/fluttium/action_location_test.dart | 2 +- .../src/user_flow/user_flow_step_test.dart | 2 +- packages/fluttium_protocol/example/main.dart | 6 ++-- .../test/src/emitter_test.dart | 14 ++++---- 16 files changed, 57 insertions(+), 57 deletions(-) diff --git a/example/lib/simple_menu/view/simple_menu.dart b/example/lib/simple_menu/view/simple_menu.dart index e993d2f8..4834ad6d 100644 --- a/example/lib/simple_menu/view/simple_menu.dart +++ b/example/lib/simple_menu/view/simple_menu.dart @@ -36,7 +36,7 @@ class _SimpleMenuPageState extends State { child: Row( children: [Text('Menu Item 1')], ), - ) + ), ], context: context, position: _getRelativeRect(widgetKey), diff --git a/packages/fluttium/lib/src/actions/clear_text.dart b/packages/fluttium/lib/src/actions/clear_text.dart index 28a643e1..81a44192 100644 --- a/packages/fluttium/lib/src/actions/clear_text.dart +++ b/packages/fluttium/lib/src/actions/clear_text.dart @@ -58,7 +58,7 @@ class ClearText extends Action { SystemChannels.textInput.codec.encodeMethodCall( const MethodCall('TextInputClient.performSelectors', [ -1, - ['deleteBackward:'] + ['deleteBackward:'], ]), ), ); diff --git a/packages/fluttium/lib/src/registry.dart b/packages/fluttium/lib/src/registry.dart index c6c46094..08611611 100644 --- a/packages/fluttium/lib/src/registry.dart +++ b/packages/fluttium/lib/src/registry.dart @@ -38,7 +38,7 @@ class Registry { timeout: timeout, ), aliases: const [ - Alias(['in'], #within) + Alias(['in'], #within), ], ), 'swipe': ActionRegistration( @@ -57,7 +57,7 @@ class Registry { timeout: timeout, ), aliases: const [ - Alias(['in'], #within) + Alias(['in'], #within), ], ), }; diff --git a/packages/fluttium/test/helpers/matchers/is_delete_backwards.dart b/packages/fluttium/test/helpers/matchers/is_delete_backwards.dart index 94d93abe..1a625bcf 100644 --- a/packages/fluttium/test/helpers/matchers/is_delete_backwards.dart +++ b/packages/fluttium/test/helpers/matchers/is_delete_backwards.dart @@ -6,7 +6,7 @@ Matcher get isDeleteBackward { 'method': 'TextInputClient.performSelectors', 'args': [ -1, - ['deleteBackward:'] + ['deleteBackward:'], ], }); diff --git a/packages/fluttium/test/helpers/matchers/is_text.dart b/packages/fluttium/test/helpers/matchers/is_text.dart index 627c2a70..ce93e9c0 100644 --- a/packages/fluttium/test/helpers/matchers/is_text.dart +++ b/packages/fluttium/test/helpers/matchers/is_text.dart @@ -9,7 +9,7 @@ Matcher isText(String text) { TextEditingValue( text: text, selection: TextSelection.collapsed(offset: text.length), - ).toJSON() + ).toJSON(), ], }); diff --git a/packages/fluttium/test/src/registry_test.dart b/packages/fluttium/test/src/registry_test.dart index 8a3b65a8..b27de996 100644 --- a/packages/fluttium/test/src/registry_test.dart +++ b/packages/fluttium/test/src/registry_test.dart @@ -65,7 +65,7 @@ void main() { 'action', _TestActionWithArguments.new, aliases: [ - Alias(['withKey'], #key) + Alias(['withKey'], #key), ], ); @@ -73,7 +73,7 @@ void main() { expect( registry.actions['action']!.aliases, equals([ - Alias(['withKey'], #key) + Alias(['withKey'], #key), ]), ); }); @@ -130,7 +130,7 @@ void main() { 'action', _TestActionWithArguments.new, aliases: [ - Alias(['withKey'], #key) + Alias(['withKey'], #key), ], ); diff --git a/packages/fluttium_cli/test/src/commands/test_command/test_command_test.dart b/packages/fluttium_cli/test/src/commands/test_command/test_command_test.dart index 89f43c16..c1aa84cf 100644 --- a/packages/fluttium_cli/test/src/commands/test_command/test_command_test.dart +++ b/packages/fluttium_cli/test/src/commands/test_command/test_command_test.dart @@ -769,9 +769,9 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to fileStep.copyWith( status: StepStatus.done, files: { - 'file.txt': [1, 2, 3] + 'file.txt': [1, 2, 3], }, - ) + ), ]); await Future.delayed(Duration.zero); @@ -834,7 +834,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.running), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -845,7 +845,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.failed), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -911,7 +911,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.running), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -923,7 +923,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.done), - step3.copyWith(status: StepStatus.done) + step3.copyWith(status: StepStatus.done), ]); await Future.delayed(Duration.zero); @@ -970,7 +970,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.running), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -982,7 +982,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.failed), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -1087,7 +1087,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.running), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -1132,7 +1132,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.running), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -1143,7 +1143,7 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to stepStateController.add([ step1.copyWith(status: StepStatus.done), step2.copyWith(status: StepStatus.failed), - step3 + step3, ]); await Future.delayed(Duration.zero); @@ -1235,11 +1235,11 @@ Either adjust the constraint in the Fluttium configuration or update the CLI to step1.copyWith( status: StepStatus.done, files: { - 'test_file': [1, 2, 3] + 'test_file': [1, 2, 3], }, ), step2, - step3 + step3, ]); await Future.delayed(Duration.zero); diff --git a/packages/fluttium_cli/test/src/json_decode_safely_test.dart b/packages/fluttium_cli/test/src/json_decode_safely_test.dart index 3685b588..43abdca2 100644 --- a/packages/fluttium_cli/test/src/json_decode_safely_test.dart +++ b/packages/fluttium_cli/test/src/json_decode_safely_test.dart @@ -66,7 +66,7 @@ Some output 'b': { 'd': 5, 'e': 6, - 'f': [7, 8, 9] + 'f': [7, 8, 9], }, 'c': 4, }), diff --git a/packages/fluttium_driver/test/src/fluttium_driver_test.dart b/packages/fluttium_driver/test/src/fluttium_driver_test.dart index e1d9b933..e2938bff 100644 --- a/packages/fluttium_driver/test/src/fluttium_driver_test.dart +++ b/packages/fluttium_driver/test/src/fluttium_driver_test.dart @@ -118,7 +118,7 @@ void main() { (_) async => [ GeneratedFile.created( path: '/project_directory/.fluttium_test_launcher.dart', - ) + ), ], ); launcherGeneratorHooks = _MockGeneratorHooks(); @@ -209,7 +209,7 @@ name: project_name 'run', '/project_directory/.fluttium_test_launcher.dart', '-d', - 'deviceId' + 'deviceId', ]), ), runInShell: any(named: 'runInShell'), @@ -352,11 +352,11 @@ name: project_name 'source': ''' hosted: https://pub.dev/packages/hosted_action - version: ^1.2.3''' + version: ^1.2.3''', }, { 'name': 'git_action_simple', - 'source': 'git@github.com/wolfenrain/git_action_simple' + 'source': 'git@github.com/wolfenrain/git_action_simple', }, { 'name': 'git_action_advanced', @@ -365,21 +365,21 @@ name: project_name git: url: git@github.com/wolfenrain/git_action_advanced ref: dev - path: packages/advanced''' + path: packages/advanced''', }, { 'name': 'path_action', 'source': ''' - path: /project_directory/path_action''' + path: /project_directory/path_action''', } ], 'steps': [ { - 'step': json.encode({'pressOn': 'Text'}) + 'step': json.encode({'pressOn': 'Text'}), }, { - 'step': json.encode({'expectVisible': 'Text'}) + 'step': json.encode({'expectVisible': 'Text'}), } ], }), @@ -456,7 +456,7 @@ name: project_name 'run', '/project_directory/.fluttium_test_launcher.dart', '-d', - 'deviceId' + 'deviceId', ]), ), runInShell: any(named: 'runInShell', that: isTrue), @@ -512,7 +512,7 @@ name: project_name 'stepName1', status: StepStatus.done, files: const { - 'fileName': [1, 2, 3] + 'fileName': [1, 2, 3], }, ), StepState( @@ -744,9 +744,9 @@ extension on MessageType { {'type': 'start'}, { 'type': 'data', - 'data': r'"{\"type\":\"fatal\",\"data\":\"\\\"fatal reason\\\"\"}"' + 'data': r'"{\"type\":\"fatal\",\"data\":\"\\\"fatal reason\\\"\"}"', }, - {'type': 'done'} + {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); case MessageType.announce: return [ @@ -754,9 +754,9 @@ extension on MessageType { { 'type': 'data', 'data': - '"{\\"type\\":\\"announce\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"' + '"{\\"type\\":\\"announce\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"', }, - {'type': 'done'} + {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); case MessageType.start: return [ @@ -764,7 +764,7 @@ extension on MessageType { { 'type': 'data', 'data': - '"{\\"type\\":\\"start\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"' + '"{\\"type\\":\\"start\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"', }, {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); @@ -774,7 +774,7 @@ extension on MessageType { { 'type': 'data', 'data': - '"{\\"type\\":\\"done\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"' + '"{\\"type\\":\\"done\\",\\"data\\":\\"\\\\\\"$stepName\\\\\\"\\"}"', }, {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); @@ -784,7 +784,7 @@ extension on MessageType { { 'type': 'data', 'data': - '"{\\"type\\":\\"fail\\",\\"data\\":\\"[\\\\\\"$stepName\\\\\\",\\\\\\"reason\\\\\\"]\\"}"' + '"{\\"type\\":\\"fail\\",\\"data\\":\\"[\\\\\\"$stepName\\\\\\",\\\\\\"reason\\\\\\"]\\"}"', }, {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); @@ -794,7 +794,7 @@ extension on MessageType { { 'type': 'data', 'data': - r'"{\"type\":\"store\",\"data\":\"[\\\"fileName\\\",[1,2,3]]\"}"' + r'"{\"type\":\"store\",\"data\":\"[\\\"fileName\\\",[1,2,3]]\"}"', }, {'type': 'done'}, ].map((data) => utf8.encode('${json.encode(data)}\n')); diff --git a/packages/fluttium_driver/test/src/step_result_test.dart b/packages/fluttium_driver/test/src/step_result_test.dart index a0612a40..047d9f40 100644 --- a/packages/fluttium_driver/test/src/step_result_test.dart +++ b/packages/fluttium_driver/test/src/step_result_test.dart @@ -18,7 +18,7 @@ void main() { final copied = state.copyWith( status: StepStatus.done, files: { - 'file': [1, 2, 3] + 'file': [1, 2, 3], }, failReason: 'failReason', ); @@ -28,7 +28,7 @@ void main() { expect( copied.files, equals({ - 'file': [1, 2, 3] + 'file': [1, 2, 3], }), ); expect(copied.failReason, equals('failReason')); diff --git a/packages/fluttium_interfaces/lib/src/fluttium/fluttium_yaml.dart b/packages/fluttium_interfaces/lib/src/fluttium/fluttium_yaml.dart index f3a75666..a955ec9b 100644 --- a/packages/fluttium_interfaces/lib/src/fluttium/fluttium_yaml.dart +++ b/packages/fluttium_interfaces/lib/src/fluttium/fluttium_yaml.dart @@ -31,7 +31,7 @@ class FluttiumYaml extends Equatable { actions: { for (final entry in (yaml['actions'] as Map? ?? {}).entries) - entry.key: ActionLocation.fromJson(entry.value) + entry.key: ActionLocation.fromJson(entry.value), }, driver: DriverConfiguration.fromJson( yaml['driver'] as Map? ?? {}, diff --git a/packages/fluttium_interfaces/lib/src/user_flow/user_flow_yaml.dart b/packages/fluttium_interfaces/lib/src/user_flow/user_flow_yaml.dart index 697e15f1..5f4ec30b 100644 --- a/packages/fluttium_interfaces/lib/src/user_flow/user_flow_yaml.dart +++ b/packages/fluttium_interfaces/lib/src/user_flow/user_flow_yaml.dart @@ -28,7 +28,7 @@ class UserFlowYaml extends Equatable { description: metaData['description'] as String? ?? '', steps: [ for (final step in stepData.cast>()) - UserFlowStep.fromJson(step) + UserFlowStep.fromJson(step), ], ); } diff --git a/packages/fluttium_interfaces/test/src/fluttium/action_location_test.dart b/packages/fluttium_interfaces/test/src/fluttium/action_location_test.dart index 0ca7da43..cc091883 100644 --- a/packages/fluttium_interfaces/test/src/fluttium/action_location_test.dart +++ b/packages/fluttium_interfaces/test/src/fluttium/action_location_test.dart @@ -66,7 +66,7 @@ void main() { 'url': 'git@git.some.where/some/action.git', 'ref': 'main', 'path': 'some/path', - } + }, }); expect(location.hosted, isNull); diff --git a/packages/fluttium_interfaces/test/src/user_flow/user_flow_step_test.dart b/packages/fluttium_interfaces/test/src/user_flow/user_flow_step_test.dart index 49cd71c0..9cd1ef48 100644 --- a/packages/fluttium_interfaces/test/src/user_flow/user_flow_step_test.dart +++ b/packages/fluttium_interfaces/test/src/user_flow/user_flow_step_test.dart @@ -19,7 +19,7 @@ void main() { final step = UserFlowStep.fromJson(const { 'expectVisible': { 'text': 'findByText', - } + }, }); expect(step.actionName, equals('expectVisible')); diff --git a/packages/fluttium_protocol/example/main.dart b/packages/fluttium_protocol/example/main.dart index 0d67567f..0c8af5a2 100644 --- a/packages/fluttium_protocol/example/main.dart +++ b/packages/fluttium_protocol/example/main.dart @@ -22,19 +22,19 @@ Stream> _fakeData() async* { {'type': 'start'}, { 'type': 'data', - 'data': r'"{\"type\":\"announce\",\"data\":\"\\\"stepName\\\"\"}"' + 'data': r'"{\"type\":\"announce\",\"data\":\"\\\"stepName\\\"\"}"', }, {'type': 'done'}, {'type': 'start'}, { 'type': 'data', - 'data': r'"{\"type\":\"start\",\"data\":\"\\\"stepName\\\"\"}"' + 'data': r'"{\"type\":\"start\",\"data\":\"\\\"stepName\\\"\"}"', }, {'type': 'done'}, {'type': 'start'}, { 'type': 'data', - 'data': r'"{\"type\":\"done\",\"data\":\"\\\"stepName\\\"\"}"' + 'data': r'"{\"type\":\"done\",\"data\":\"\\\"stepName\\\"\"}"', }, {'type': 'done'}, ]; diff --git a/packages/fluttium_protocol/test/src/emitter_test.dart b/packages/fluttium_protocol/test/src/emitter_test.dart index 516d08fd..954e7bb5 100644 --- a/packages/fluttium_protocol/test/src/emitter_test.dart +++ b/packages/fluttium_protocol/test/src/emitter_test.dart @@ -18,7 +18,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"announce\\\",\\\"data\\\":\\\"\\\\\\\"step\\\\\\\"\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -36,7 +36,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"start\\\",\\\"data\\\":\\\"\\\\\\\"step\\\\\\\"\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -54,7 +54,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"done\\\",\\\"data\\\":\\\"\\\\\\\"step\\\\\\\"\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -73,7 +73,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"store\\\",\\\"data\\\":\\\"[\\\\\\\"fileName\\\\\\\",[]]\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -98,7 +98,7 @@ void main() { r'{"type":"data","data":"\"89,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160\""}', r'{"type":"data","data":"\",161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,1\""}', r'{"type":"data","data":"\"32,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231]]\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -117,7 +117,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"fatal\\\",\\\"data\\\":\\\"\\\\\\\"reason\\\\\\\"\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); @@ -135,7 +135,7 @@ void main() { equals([ '{"type":"start"}', r'{"type":"data","data":"\"{\\\"type\\\":\\\"fail\\\",\\\"data\\\":\\\"[\\\\\\\"step\\\\\\\",\\\\\\\"reason\\\\\\\"]\\\"}\""}', - '{"type":"done"}' + '{"type":"done"}', ]), ); }); From 674df59328535f6fd5414dd6d3656c06d361be24 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:14:20 +0100 Subject: [PATCH 02/17] Add const --- .../lib/src/expect_environment_text.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/actions/expect_environment_text/lib/src/expect_environment_text.dart b/example/actions/expect_environment_text/lib/src/expect_environment_text.dart index e75655c5..18b70599 100644 --- a/example/actions/expect_environment_text/lib/src/expect_environment_text.dart +++ b/example/actions/expect_environment_text/lib/src/expect_environment_text.dart @@ -16,7 +16,7 @@ class ExpectEnvironmentText extends Action { /// Called when it executes the action in a flow file. @override Future execute(Tester tester) async { - if (!await ExpectVisible( + if (!await const ExpectVisible( text: "Environment: (Development|Staging|Production|None){1}", ).execute(tester)) { return false; From 3b9337b5dde1132ccc7fe441f8c93e77be835e2d Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:14:33 +0100 Subject: [PATCH 03/17] Use single quotes --- .../lib/src/expect_environment_text.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/actions/expect_environment_text/lib/src/expect_environment_text.dart b/example/actions/expect_environment_text/lib/src/expect_environment_text.dart index 18b70599..cb5d0f28 100644 --- a/example/actions/expect_environment_text/lib/src/expect_environment_text.dart +++ b/example/actions/expect_environment_text/lib/src/expect_environment_text.dart @@ -17,7 +17,7 @@ class ExpectEnvironmentText extends Action { @override Future execute(Tester tester) async { if (!await const ExpectVisible( - text: "Environment: (Development|Staging|Production|None){1}", + text: 'Environment: (Development|Staging|Production|None){1}', ).execute(tester)) { return false; } From 543f24057b07c73b012200f4524b7fc2022a1df0 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:14:57 +0100 Subject: [PATCH 04/17] Sort imports --- example/actions/expect_environment_text/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/actions/expect_environment_text/pubspec.yaml b/example/actions/expect_environment_text/pubspec.yaml index b7c7f4ae..c81eea10 100644 --- a/example/actions/expect_environment_text/pubspec.yaml +++ b/example/actions/expect_environment_text/pubspec.yaml @@ -6,6 +6,6 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - fluttium: ^0.1.0-dev.1 flutter: sdk: flutter + fluttium: ^0.1.0-dev.1 From fc3fdadcabce6c4b62ff41064c71abce40099ca9 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:15:53 +0100 Subject: [PATCH 05/17] Fix template use --- packages/fluttium/lib/src/actions/swipe.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/lib/src/actions/swipe.dart b/packages/fluttium/lib/src/actions/swipe.dart index 858a78b2..f7e96b87 100644 --- a/packages/fluttium/lib/src/actions/swipe.dart +++ b/packages/fluttium/lib/src/actions/swipe.dart @@ -15,7 +15,7 @@ import 'package:fluttium/src/actions/scroll.dart'; /// ``` /// {@endtemplate} class Swipe extends Scroll { - /// {@template swipe} + /// {@macro swipe} Swipe({ required super.within, required super.until, From eeb3b21005e530d1a74cabf6d9c988aefdcd48d1 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:19:27 +0100 Subject: [PATCH 06/17] Add toString() to mock to fix invalid implementation error --- packages/fluttium/test/src/tester_test.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index bbb21c38..4d8d3f79 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -26,7 +26,12 @@ class _MockRegistry extends Mock implements Registry {} class _MockChannelBuffers extends Mock implements ChannelBuffers {} -class _MockPipelineOwner extends Mock implements PipelineOwner {} +class _MockPipelineOwner extends Mock implements PipelineOwner { + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return super.toString(); + } +} class _MockSemanticsOwner extends Mock implements SemanticsOwner {} From f6a665e1dd94749fcbcee725a17e0308abe97a1e Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:27:34 +0100 Subject: [PATCH 07/17] Update deprecations, refactor nullability --- packages/fluttium/lib/src/tester.dart | 14 +++++++------- packages/fluttium/test/src/tester_test.dart | 12 ++++++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/fluttium/lib/src/tester.dart b/packages/fluttium/lib/src/tester.dart index 34e76814..09369c7b 100644 --- a/packages/fluttium/lib/src/tester.dart +++ b/packages/fluttium/lib/src/tester.dart @@ -23,7 +23,8 @@ class Tester { final Registry _registry; - SemanticsOwner get _semanticsOwner => _binding.pipelineOwner.semanticsOwner!; + SemanticsOwner? get _semanticsOwner => + RendererBinding.instance.rootPipelineOwner.semanticsOwner; /// The current screen's media query information. MediaQueryData get mediaQuery => @@ -103,7 +104,7 @@ class Tester { /// /// The [text] can be a [String] that can also be used as a [RegExp]. Future find(String text, {Duration? timeout}) async { - var nodes = _findNodes(_semanticsOwner.rootSemanticsNode!, text); + var nodes = _findNodes(_semanticsOwner?.rootSemanticsNode, text); final end = clock.now().add(timeout ?? const Duration(seconds: 10)); while (nodes.isEmpty) { @@ -111,15 +112,15 @@ class Tester { if (clock.now().isAfter(end)) { return null; } - nodes = _findNodes(_semanticsOwner.rootSemanticsNode!, text); + nodes = _findNodes(_semanticsOwner?.rootSemanticsNode, text); } return nodes.first; } - List _findNodes(SemanticsNode node, String text) { + List _findNodes(SemanticsNode? node, String text) { final nodes = []; - node.visitChildren((n) { + node?.visitChildren((n) { // Add all descendants that match the pattern. if (!n.mergeAllDescendantsIntoThisNode) { nodes.addAll(_findNodes(n, text)); @@ -169,8 +170,7 @@ class Tester { /// Wait for the semantics tree to be fully build. Future ready() async { - while (_binding.pipelineOwner.semanticsOwner == null || - _binding.pipelineOwner.semanticsOwner!.rootSemanticsNode == null) { + while (_semanticsOwner?.rootSemanticsNode == null) { await _binding.endOfFrame; } } diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 4d8d3f79..472f1164 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -307,7 +307,8 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => binding.pipelineOwner).thenReturn(pipelineOwner); + when(() => RendererBinding.instance.rootPipelineOwner) + .thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); rootNode = MockSemanticsNode(); @@ -493,7 +494,8 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => binding.pipelineOwner).thenReturn(pipelineOwner); + when(() => RendererBinding.instance.rootPipelineOwner) + .thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); rootNode = MockSemanticsNode(); @@ -503,7 +505,8 @@ void main() { test('resolve when ready', () { expect(tester.ready(), completes); - verify(() => binding.pipelineOwner.semanticsOwner).called(equals(2)); + verify(() => RendererBinding.instance.rootPipelineOwner.semanticsOwner) + .called(equals(2)); verify(() => semanticsOwner.rootSemanticsNode).called(equals(1)); }); @@ -515,7 +518,8 @@ void main() { expect(tester.ready(), completes); - verify(() => binding.pipelineOwner.semanticsOwner).called(equals(2)); + verify(() => RendererBinding.instance.rootPipelineOwner.semanticsOwner) + .called(equals(2)); verify(() => semanticsOwner.rootSemanticsNode).called(equals(1)); verify(() => binding.endOfFrame).called(equals(1)); }); From beda7478ce0fc52bbcf7b43ac417dd2f7b0d919c Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:40:42 +0100 Subject: [PATCH 08/17] Update packages/fluttium/test/src/tester_test.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/test/src/tester_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 472f1164..35e156b2 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -505,7 +505,7 @@ void main() { test('resolve when ready', () { expect(tester.ready(), completes); - verify(() => RendererBinding.instance.rootPipelineOwner.semanticsOwner) + verify(() => binding.rootPipelineOwner.semanticsOwner) .called(equals(2)); verify(() => semanticsOwner.rootSemanticsNode).called(equals(1)); }); From 8311c7c4198404dbd77fdc99c16b7489355c9e05 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:40:49 +0100 Subject: [PATCH 09/17] Update packages/fluttium/test/src/tester_test.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/test/src/tester_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 35e156b2..152cd3f3 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -518,7 +518,7 @@ void main() { expect(tester.ready(), completes); - verify(() => RendererBinding.instance.rootPipelineOwner.semanticsOwner) + verify(() => binding.rootPipelineOwner.semanticsOwner) .called(equals(2)); verify(() => semanticsOwner.rootSemanticsNode).called(equals(1)); verify(() => binding.endOfFrame).called(equals(1)); From d62af74a9908617482430c0124d3d1eec2122e45 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:40:55 +0100 Subject: [PATCH 10/17] Update packages/fluttium/test/src/tester_test.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/test/src/tester_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 152cd3f3..8fd17d29 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -494,7 +494,7 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => RendererBinding.instance.rootPipelineOwner) + when(() => binding.rootPipelineOwner) .thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); From 1069851183c1e0241f36d9858665cdf2c437907c Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:41:04 +0100 Subject: [PATCH 11/17] Update packages/fluttium/test/src/tester_test.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/test/src/tester_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 8fd17d29..881552a1 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -307,7 +307,7 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => RendererBinding.instance.rootPipelineOwner) + when(() => binding.rootPipelineOwner) .thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); From 83b5c60634e0a9e49f34b427ba52dcefee896635 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:41:22 +0100 Subject: [PATCH 12/17] Update packages/fluttium/lib/src/tester.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/lib/src/tester.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/lib/src/tester.dart b/packages/fluttium/lib/src/tester.dart index 09369c7b..f7df9a0f 100644 --- a/packages/fluttium/lib/src/tester.dart +++ b/packages/fluttium/lib/src/tester.dart @@ -112,7 +112,7 @@ class Tester { if (clock.now().isAfter(end)) { return null; } - nodes = _findNodes(_semanticsOwner?.rootSemanticsNode, text); + nodes = _findNodes(_semanticsOwner!.rootSemanticsNode, text); } return nodes.first; From a9eca43455e60213bea5ee06c7dfac6101785704 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:41:28 +0100 Subject: [PATCH 13/17] Update packages/fluttium/lib/src/tester.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/lib/src/tester.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/lib/src/tester.dart b/packages/fluttium/lib/src/tester.dart index f7df9a0f..aab84053 100644 --- a/packages/fluttium/lib/src/tester.dart +++ b/packages/fluttium/lib/src/tester.dart @@ -104,7 +104,7 @@ class Tester { /// /// The [text] can be a [String] that can also be used as a [RegExp]. Future find(String text, {Duration? timeout}) async { - var nodes = _findNodes(_semanticsOwner?.rootSemanticsNode, text); + var nodes = _findNodes(_semanticsOwner!.rootSemanticsNode, text); final end = clock.now().add(timeout ?? const Duration(seconds: 10)); while (nodes.isEmpty) { From 3e1a3dc7c2b2be9bbb2748a6ccaae66d54a2e1d2 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:41:33 +0100 Subject: [PATCH 14/17] Update packages/fluttium/lib/src/tester.dart Co-authored-by: Jochum van der Ploeg --- packages/fluttium/lib/src/tester.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/lib/src/tester.dart b/packages/fluttium/lib/src/tester.dart index aab84053..b5c19b93 100644 --- a/packages/fluttium/lib/src/tester.dart +++ b/packages/fluttium/lib/src/tester.dart @@ -24,7 +24,7 @@ class Tester { final Registry _registry; SemanticsOwner? get _semanticsOwner => - RendererBinding.instance.rootPipelineOwner.semanticsOwner; + _binding.rootPipelineOwner.semanticsOwner; /// The current screen's media query information. MediaQueryData get mediaQuery => From 6048ea968eb15ad35be12f2120dba333ba9f5583 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:47:32 +0100 Subject: [PATCH 15/17] Update packages/fluttium/lib/src/tester.dart --- packages/fluttium/lib/src/tester.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fluttium/lib/src/tester.dart b/packages/fluttium/lib/src/tester.dart index b5c19b93..f6734b0b 100644 --- a/packages/fluttium/lib/src/tester.dart +++ b/packages/fluttium/lib/src/tester.dart @@ -170,7 +170,7 @@ class Tester { /// Wait for the semantics tree to be fully build. Future ready() async { - while (_semanticsOwner?.rootSemanticsNode == null) { + while (_semanticsOwner!.rootSemanticsNode == null) { await _binding.endOfFrame; } } From 7259a07adfac6837c27a0ae17fa540144926ce8d Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:55:50 +0100 Subject: [PATCH 16/17] Remove line to fix ci --- .github/actions/flutter_package/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/flutter_package/action.yaml b/.github/actions/flutter_package/action.yaml index 24a1930f..7b29f081 100644 --- a/.github/actions/flutter_package/action.yaml +++ b/.github/actions/flutter_package/action.yaml @@ -52,7 +52,6 @@ runs: shell: ${{ inputs.shell }} run: | flutter pub global activate very_good_cli - very_good --analytics false very_good packages get --recursive - working-directory: ${{ inputs.working_directory }} From 3a213d035f0240734752e059310dd39f09b21b81 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Sat, 14 Sep 2024 11:03:41 +0100 Subject: [PATCH 17/17] dart format --- packages/fluttium/test/src/tester_test.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/fluttium/test/src/tester_test.dart b/packages/fluttium/test/src/tester_test.dart index 881552a1..5fbde686 100644 --- a/packages/fluttium/test/src/tester_test.dart +++ b/packages/fluttium/test/src/tester_test.dart @@ -307,8 +307,7 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => binding.rootPipelineOwner) - .thenReturn(pipelineOwner); + when(() => binding.rootPipelineOwner).thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); rootNode = MockSemanticsNode(); @@ -494,8 +493,7 @@ void main() { semanticsOwner = _MockSemanticsOwner(); final pipelineOwner = _MockPipelineOwner(); - when(() => binding.rootPipelineOwner) - .thenReturn(pipelineOwner); + when(() => binding.rootPipelineOwner).thenReturn(pipelineOwner); when(() => pipelineOwner.semanticsOwner).thenReturn(semanticsOwner); rootNode = MockSemanticsNode();