Skip to content

Commit

Permalink
final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Oct 25, 2023
1 parent ae868ab commit 6a6615e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import 'package:flutter/material.dart';
import 'package:patrol/src/extensions.dart';
// ignore: implementation_imports
import 'package:patrol/src/logs.dart';
// ignore: depend_on_referenced_packages
import 'package:test_api/src/backend/invoker.dart';

import '../common.dart';

String get currentTest => Invoker.current!.fullCurrentTestName();

void _print(String text) => print('TEST_DEBUG: $text');

void main() {
group('parent', () {
patrolSetUpAll(() async {
await Future<void>.delayed(Duration(seconds: 1));
patrolDebug('ran setUpAll (1) before "$currentTest"');
_print('ran patrolSetUpAll (1) before "$currentTest"');
});

patrolSetUpAll(() async {
await Future<void>.delayed(Duration(seconds: 1));
patrolDebug('ran setUpAll (2) before "$currentTest"');
_print('ran patrolSetUpAll (2) before "$currentTest"');
});

patrolTest('testA', nativeAutomation: true, _body);
Expand All @@ -29,7 +29,7 @@ void main() {

Future<void> _body(PatrolTester $) async {
final testName = Invoker.current!.fullCurrentTestName();
patrolDebug('ran body of test "$testName"');
_print('ran body of test "$testName"');

await createApp($);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@ import '../common.dart';

String get currentTest => Invoker.current!.fullCurrentTestName();

void _print(String text) => print('PATROL_DEBUG: $text');
void _print(String text) => print('TEST_DEBUG: $text');

void main() {
patrolSetUp(() async {
await Future<void>.delayed(Duration(seconds: 1));
_print('setting up before $currentTest');
_print('ran patrolSetUp (1) up before "$currentTest"');
});

patrolTearDown(() async {
await Future<void>.delayed(Duration(seconds: 1));
_print('tearing down after $currentTest');
_print('ran patrolTearDown (1) after "$currentTest"');
});

patrolTest('testFirst', nativeAutomation: true, _body);

group('groupA', () {
patrolSetUp(() async {
if (currentTest == 'callbacks_test groupA testB') {
throw Exception('PATROL_DEBUG: Crashing testB on purpose!');
if (currentTest == 'internal.callbacks_test groupA testB') {
throw Exception('TEST_DEBUG: "$currentTest" crashed on purpose');
}
_print('setting up before $currentTest');

_print('ran patrolSetUp (2) before "$currentTest"');
});

patrolTearDown(() async {
_print('tearing down after $currentTest');
_print('ran patrolTearDown (2) after "$currentTest"');
});

patrolTest('testA', nativeAutomation: true, _body);
Expand All @@ -44,7 +45,7 @@ void main() {

Future<void> _body(PatrolTester $) async {
final testName = Invoker.current!.fullCurrentTestName();
_print('test body: name=$testName');
_print('ran body of test "$testName"');

await createApp($);

Expand Down
9 changes: 6 additions & 3 deletions packages/patrol/lib/src/native/contracts/contracts.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/patrol_cli/lib/src/test_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart';
import 'package:path/path.dart' show basename;
import 'package:patrol_cli/src/devices.dart';

// TODO(bartekpacia): Lots of this code is not needed after #1004 is done.
// TODO: Lots of this code is not needed after #1004 is done.

enum TargetRunStatus { failedToBuild, failedToExecute, passed, canceled }

Expand Down
2 changes: 1 addition & 1 deletion schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ abstract class NativeAutomator<IOSServer, AndroidServer, DartClient> {
// other
void debug();

// TODO(bartekpacia): Move these RPCc into a new service (PatrolNativeTestService) because it doesn't fit here
// TODO: Move these RPCc into a new service (PatrolNativeTestService) because it doesn't fit here
void markPatrolAppServiceReady();
void markLifecycleCallbackExecuted(
MarkLifecycleCallbackExecutedRequest request);
Expand Down

0 comments on commit 6a6615e

Please sign in to comment.