-
Notifications
You must be signed in to change notification settings - Fork 220
Fix/wait for at #3062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+348
−41
Merged
Fix/wait for at #3062
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e7914ac
Fix at() to wait for widget to be visible
f646cbd
Create regression test
fef4b58
Update changelog
a294113
Fix handling negative numbers
4cb15e4
Delete comments from closed issues
2d57bba
Refactor at() and fix first and last
a4b48f8
Add regression tests
943123f
Create test for e2e_app
5302b58
Update changelog
29af681
Edit pubspec.yaml in e2e_app to use local version of patrol_finders
599c080
Update patrol test for at()
c962ad3
dart format
9d61c23
Restore pubspec.yaml to use official packages
598dacd
Refactor the e2e test for at()
9fa5e70
Merge branch 'master' into fix/wait-for-at
dworik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import 'dart:async'; | ||
|
|
||
| import 'package:e2e_app/keys.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class AtFinderScreen extends StatefulWidget { | ||
| const AtFinderScreen({super.key}); | ||
|
|
||
| @override | ||
| State<AtFinderScreen> createState() => _AtFinderScreenState(); | ||
| } | ||
|
|
||
| class _AtFinderScreenState extends State<AtFinderScreen> { | ||
| var _isFirstItemVisible = false; | ||
| var _isSecondItemVisible = false; | ||
| var _firstItemTapped = 0; | ||
| var _secondItemTapped = 0; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
|
|
||
| unawaited( | ||
| Future<void>.delayed(const Duration(seconds: 1)).then((_) { | ||
| if (!mounted) { | ||
| return; | ||
| } | ||
|
|
||
| setState(() { | ||
| _isFirstItemVisible = true; | ||
| }); | ||
| }), | ||
| ); | ||
|
|
||
| unawaited( | ||
| Future<void>.delayed(const Duration(seconds: 3)).then((_) { | ||
| if (!mounted) { | ||
| return; | ||
| } | ||
|
|
||
| setState(() { | ||
| _isSecondItemVisible = true; | ||
| }); | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
| appBar: AppBar(title: const Text('at() finder')), | ||
| body: ListView( | ||
| children: [ | ||
| if (_isFirstItemVisible) | ||
| AtFinderItem( | ||
| onTap: () { | ||
| setState(() { | ||
| _firstItemTapped++; | ||
| }); | ||
| }, | ||
| ), | ||
| if (_isSecondItemVisible) | ||
| AtFinderItem( | ||
| onTap: () { | ||
| setState(() { | ||
| _secondItemTapped++; | ||
| }); | ||
| }, | ||
| ), | ||
| if (_secondItemTapped > 0) | ||
| Text( | ||
| 'Second item tapped $_secondItemTapped', | ||
| key: K.atFinderSecondItemTapped, | ||
| ), | ||
| if (_firstItemTapped > 0) | ||
| Text( | ||
| 'First item tapped $_firstItemTapped', | ||
| key: K.atFinderFirstItemTapped, | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| class AtFinderItem extends StatelessWidget { | ||
| const AtFinderItem({super.key, required this.onTap}); | ||
|
|
||
| final VoidCallback onTap; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return ListTile(key: K.atFinderItem, title: Text('Item'), onTap: onTap); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import 'package:e2e_app/keys.dart'; | ||
|
|
||
| import 'common.dart'; | ||
|
|
||
| void main() { | ||
| patrol( | ||
| 'at() waits until widget at index exists', | ||
| ($) async { | ||
| await createApp($); | ||
| await $(K.atFinderScreenButton).scrollTo().tap(); | ||
|
|
||
| await $(K.atFinderItem).at(1).tap(); | ||
| await $(K.atFinderItem).first.tap(); | ||
| await $(K.atFinderItem).last.tap(); | ||
|
|
||
| await $(K.atFinderFirstItemTapped).waitUntilVisible(); | ||
| await $(K.atFinderSecondItemTapped).waitUntilVisible(); | ||
| expect($(K.atFinderSecondItemTapped).text, 'Second item tapped 2'); | ||
| }, | ||
| tags: ['android', 'emulator', 'ios', 'simulator'], | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.