From 3ded673ff00cd0030f9e3dca4f8eb7a2ec78f36f Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Thu, 21 Sep 2023 11:41:11 +0200 Subject: [PATCH] create `callbacks_test.dart` So far so good - this is suspicious. --- .../integration_test/callbacks_test.dart | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/patrol/example/integration_test/callbacks_test.dart diff --git a/packages/patrol/example/integration_test/callbacks_test.dart b/packages/patrol/example/integration_test/callbacks_test.dart new file mode 100644 index 000000000..0255aa65f --- /dev/null +++ b/packages/patrol/example/integration_test/callbacks_test.dart @@ -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 _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)); +}