-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test and widget test flow to playground example
- Loading branch information
1 parent
1e78e80
commit bfe5f4c
Showing
11 changed files
with
787 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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,143 @@ | ||
import 'package:demo_ui_components/demo_ui_components.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:patrol/patrol.dart'; | ||
import 'package:playground/main.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
patrolTest( | ||
'Page with forced max height and background color flow', | ||
($) async { | ||
await $.pumpWidgetAndSettle( | ||
const MaterialApp( | ||
home: DemoApp( | ||
androidSdkVersion: 30, | ||
), | ||
), | ||
); | ||
//Page with forced max height and background color flow | ||
expect($('Wolt Modal Sheet Playground'), findsOneWidget); | ||
await $('Show Modal Sheet').tap(); | ||
expect($('Choose a use case'), findsOneWidget); | ||
await $('Page with forced max height').tap(); | ||
await $('Let\'s start!').tap(); | ||
expect($('Page with forced max height and background color'), | ||
findsAtLeast(1)); | ||
await $('Close').tap(); | ||
expect( | ||
$('Page with forced max height and background color'), findsNothing); | ||
|
||
// Page with a hero image flow | ||
await $('Show Modal Sheet').tap(); | ||
expect($('Choose a use case'), findsOneWidget); | ||
await $('Page with hero image').tap(); | ||
await $('Let\'s start!').tap(); | ||
expect($(Image), findsOneWidget); | ||
await $('Close').tap(); | ||
|
||
// Page with lazy loading list flow | ||
await $('Show Modal Sheet').tap(); | ||
expect($('Choose a use case'), findsOneWidget); | ||
await $('Page with lazy loading list').tap(); | ||
await $('Let\'s start!').tap(); | ||
expect($(SliverList), findsAtLeast(1)); | ||
await $(WoltCircularElevatedButton).tap(); | ||
|
||
//Page with auto-focus text field | ||
//TODO: Ask to manager Shouldn't textformfiel appear on the screen when the page is opened? If so, fix the bug first | ||
await $('Page with auto-focus text field').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
expect( | ||
FocusScope.of($.tester.element($(TextFormField))).hasFocus, isTrue); | ||
// await $('Fill the text field to enable').tap(); | ||
await $(TextFormField).scrollTo().enterText('Hello'); | ||
await $('Submit').tap(); | ||
expect($('Page with text field'), findsNothing); | ||
|
||
//Page with custom top bar | ||
expect($('Wolt Modal Sheet Playground'), findsOneWidget); | ||
await $('Show Modal Sheet').tap(); | ||
await $('Page with custom top bar').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
//?: I couldn't find how to test custom top bar. I couldn't take opacity value of Flow. | ||
await $.scrollUntilExists(finder: $(Placeholder)); | ||
expect( | ||
find.byWidgetPredicate((widget) => | ||
widget.runtimeType.toString() == 'TopBarAnimatedBuilder'), | ||
findsOneWidget); | ||
await $('Close').tap(); | ||
|
||
//Page with no title and no top bar | ||
await $('Show Modal Sheet').tap(); | ||
await $('Page with no title and no top bar').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
expect( | ||
find.byWidgetPredicate((widget) => | ||
widget.runtimeType.toString() == 'TopBarAnimatedBuilder'), | ||
findsNothing); | ||
await $('Close').tap(); | ||
|
||
//Page with dynamic properties | ||
await $('Show Modal Sheet').tap(); | ||
await $('Page with dynamic properties').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
expect($('Dynamic page properties'), findsOneWidget); | ||
await $(Switch).tap(); // disable Drag for WoLt Modal Sheet | ||
await $.tester.drag($('Dynamic page properties'), | ||
Offset(0, $.tester.view.physicalSize.height / 2)); | ||
await $.tester.pumpAndSettle(); | ||
expect($('Dynamic page properties'), findsOneWidget); | ||
|
||
await $(Switch).tap(); // enable Drag for Wolt Modal Sheet | ||
await $.tester.drag($('Dynamic page properties'), | ||
Offset(0, $.tester.view.physicalSize.height / 2)); | ||
await $.tester.pumpAndSettle(); | ||
expect($('Dynamic page properties'), findsNothing); | ||
//NonScrollingWoltModalSheetPage example | ||
await $('Show Modal Sheet').tap(); | ||
await $('NonScrollingWoltModalSheetPage example').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
|
||
expect($(SliverList), findsNothing); | ||
await $(WoltCircularElevatedButton).tap(); | ||
|
||
// All the pages in one flow | ||
await $('All the pages in one flow').scrollTo().tap(); | ||
await $('Let\'s start!').tap(); | ||
// hero | ||
expect($(Image), findsOneWidget); | ||
await $('Next').tap(); | ||
// lazy list | ||
expect($(SliverList), findsAtLeast(1)); | ||
await $('Next').tap(); | ||
// text field | ||
expect($(TextFormField), findsOneWidget); | ||
await $(TextFormField).scrollTo().enterText('Hello'); | ||
await $('Submit').tap(); | ||
// noTitleNoTopBar | ||
expect( | ||
find.byWidgetPredicate((widget) => | ||
widget.runtimeType.toString() == 'TopBarAnimatedBuilder'), | ||
findsNothing); | ||
await $('Next').tap(); | ||
// custom top bar | ||
expect( | ||
find.byWidgetPredicate((widget) => | ||
widget.runtimeType.toString() == 'TopBarAnimatedBuilder'), | ||
findsOneWidget); | ||
await $('Next').tap(); | ||
// dynamic page properties | ||
expect($('Dynamic page properties'), findsOneWidget); | ||
await $('Next').tap(); | ||
// NonScrollingWoltModalSheetPage example | ||
expect($(SliverList), findsNothing); | ||
await $('Flex: 1\n Tap here to go to the next page').tap(); | ||
// forcedMaxHeight | ||
expect($('Page with forced max height and background color'), | ||
findsAtLeast(1)); | ||
await $('Close').tap(); | ||
expect( | ||
$('Page with forced max height and background color'), findsNothing); | ||
}, | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,42 @@ | ||
PODS: | ||
- CocoaAsyncSocket (7.6.5) | ||
- device_info_plus (0.0.1): | ||
- Flutter | ||
- Flutter (1.0.0) | ||
- flutter_keyboard_visibility (0.0.1): | ||
- Flutter | ||
- patrol (0.0.1): | ||
- CocoaAsyncSocket (~> 7.6) | ||
- Flutter | ||
- FlutterMacOS | ||
|
||
DEPENDENCIES: | ||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) | ||
- Flutter (from `Flutter`) | ||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) | ||
- patrol (from `.symlinks/plugins/patrol/darwin`) | ||
|
||
SPEC REPOS: | ||
trunk: | ||
- CocoaAsyncSocket | ||
|
||
EXTERNAL SOURCES: | ||
device_info_plus: | ||
:path: ".symlinks/plugins/device_info_plus/ios" | ||
Flutter: | ||
:path: Flutter | ||
flutter_keyboard_visibility: | ||
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios" | ||
patrol: | ||
:path: ".symlinks/plugins/patrol/darwin" | ||
|
||
SPEC CHECKSUMS: | ||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 | ||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 | ||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 | ||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 | ||
patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac | ||
|
||
PODFILE CHECKSUM: c06bbe494565b5f0cfb799af75dc36785e60532a | ||
|
||
COCOAPODS: 1.14.3 |
Oops, something went wrong.