Skip to content

Commit

Permalink
Create macos_app_test for flutter interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotruela committed Nov 21, 2023
1 parent b943413 commit b5cb975
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/patrol/example/integration_test/macos_app_test.dart
Original file line number Diff line number Diff line change
@@ -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,
);
});
}
1 change: 1 addition & 0 deletions packages/patrol/example/lib/keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ class Keys {

static const topText = Key('topText');
static const bottomText = Key('bottomText');
static const backButton = Key('backButton');
}
1 change: 1 addition & 0 deletions packages/patrol/example/lib/scrolling_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit b5cb975

Please sign in to comment.