-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add smoke integration test to verify that failed commands don't crash…
… the automation server
- Loading branch information
1 parent
0b9b20e
commit 9a01642
Showing
2 changed files
with
67 additions
and
4 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
61 changes: 61 additions & 0 deletions
61
packages/patrol/example/integration_test/smokes/graceful_fail_test.dart
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,61 @@ | ||
import '../common.dart'; | ||
|
||
final _nativeAutomatorConfig = globalNativeAutomatorConfig.copyWith( | ||
findTimeout: Duration(seconds: 5), // shorter timeout for this test | ||
); | ||
|
||
void main() { | ||
patrol( | ||
'native tap() fails gracefully', | ||
nativeAutomatorConfig: _nativeAutomatorConfig, | ||
($) async { | ||
await createApp($); | ||
|
||
await expectLater( | ||
() => $.native.tap(Selector(text: 'This does not exist, boom!')), | ||
throwsA( | ||
isA<PatrolActionException>().having( | ||
(err) => err.message, | ||
'message', | ||
contains('This does not exist, boom!'), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
|
||
patrol( | ||
'native enterText() fails gracefully', | ||
nativeAutomatorConfig: _nativeAutomatorConfig, | ||
($) async { | ||
await createApp($); | ||
|
||
await expectLater( | ||
() => $.native.enterText( | ||
Selector(text: 'This does not exist, boom!'), | ||
text: 'some text', | ||
), | ||
throwsA( | ||
isA<PatrolActionException>().having( | ||
(err) => err.message, | ||
'message', | ||
contains('This does not exist, boom!'), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
|
||
patrol( | ||
'native enterTextByIndex() fails gracefully', | ||
nativeAutomatorConfig: _nativeAutomatorConfig, | ||
($) async { | ||
await createApp($); | ||
|
||
await expectLater( | ||
() => $.native.enterTextByIndex('some text', index: 100), | ||
throwsA(isA<PatrolActionException>()), | ||
); | ||
}, | ||
); | ||
} |