Skip to content

Commit

Permalink
create callbacks_test.dart
Browse files Browse the repository at this point in the history
So far so good - this is suspicious.
  • Loading branch information
bartekpacia committed Sep 21, 2023
1 parent 877bdae commit 3ded673
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions packages/patrol/example/integration_test/callbacks_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:patrol/src/extensions.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('PATROL_DEBUG: $text');

void main() {
patrolSetUp(() async {
_print('setting up before $currentTest');
});

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

group('groupA', () {
patrolSetUp(() async {
_print('setting up before $currentTest');
});

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

patrolTest('testA', nativeAutomation: true, _body);
patrolTest('testB', nativeAutomation: true, _body);
patrolTest('testC', nativeAutomation: true, _body);
});
}

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

await createApp($);

await $(FloatingActionButton).tap();
expect($(#counterText).text, '1');

await $(#textField).enterText(testName);

await $.pumpAndSettle(duration: Duration(seconds: 2));
}

0 comments on commit 3ded673

Please sign in to comment.