From b5cb975a73b1b42afedf10544544f8a88a4d1d3a Mon Sep 17 00:00:00 2001 From: Piotr Maszota Date: Tue, 21 Nov 2023 13:58:13 +0100 Subject: [PATCH] Create macos_app_test for flutter interactions --- .../integration_test/macos_app_test.dart | 30 +++++++++++++++++++ packages/patrol/example/lib/keys.dart | 1 + .../patrol/example/lib/scrolling_screen.dart | 1 + 3 files changed, 32 insertions(+) create mode 100644 packages/patrol/example/integration_test/macos_app_test.dart diff --git a/packages/patrol/example/integration_test/macos_app_test.dart b/packages/patrol/example/integration_test/macos_app_test.dart new file mode 100644 index 000000000..542197c60 --- /dev/null +++ b/packages/patrol/example/integration_test/macos_app_test.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +import 'common.dart'; + +void main() { + patrol('taps around', ($) async { + await createApp($); + await $.waitUntilVisible($(#counterText)); + + expect($(#counterText).text, '0'); + + await $(FloatingActionButton).tap(); + + expect($(#counterText).text, '1'); + + await $(#textField).enterText('Hello, Flutter!'); + expect($('Hello, Flutter!'), findsOneWidget); + + await $('Open scrolling screen').scrollTo().tap(); + await $.waitUntilVisible($(#topText)); + + await $.scrollUntilVisible(finder: $(#bottomText)); + + await $.tap($(#backButton)); + await $.scrollUntilVisible( + finder: $(#counterText), + scrollDirection: AxisDirection.up, + ); + }); +} diff --git a/packages/patrol/example/lib/keys.dart b/packages/patrol/example/lib/keys.dart index 4d8085bd3..7c002f793 100644 --- a/packages/patrol/example/lib/keys.dart +++ b/packages/patrol/example/lib/keys.dart @@ -7,4 +7,5 @@ class Keys { static const topText = Key('topText'); static const bottomText = Key('bottomText'); + static const backButton = Key('backButton'); } diff --git a/packages/patrol/example/lib/scrolling_screen.dart b/packages/patrol/example/lib/scrolling_screen.dart index 9989d206e..88d84bbdf 100644 --- a/packages/patrol/example/lib/scrolling_screen.dart +++ b/packages/patrol/example/lib/scrolling_screen.dart @@ -8,6 +8,7 @@ class ScrollingScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + leading: BackButton(key: K.backButton), title: const Text('Scrolling'), ), body: SingleChildScrollView(