-
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 support for
Selector.instance
on iOS (#952)
- Loading branch information
1 parent
59eeb0b
commit 9db9e4d
Showing
9 changed files
with
216 additions
and
60 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 |
---|---|---|
|
@@ -124,7 +124,6 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
include: | ||
- version: '3.3.0' | ||
- channel: stable | ||
|
||
defaults: | ||
|
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
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: 3), // 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>()), | ||
); | ||
}, | ||
); | ||
} |
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 |
---|---|---|
|
@@ -4,10 +4,11 @@ void main() { | |
patrol('interacts with the orange website in a webview', ($) async { | ||
await createApp($); | ||
|
||
await $('Open webview (Hacker News').scrollTo().tap(); | ||
await $('Open webview (Hacker News)').scrollTo().tap(); | ||
|
||
await $.native.tap(Selector(text: 'login')); | ||
await $.native.enterTextByIndex('[email protected]', index: 0); | ||
await $.native.enterTextByIndex('[email protected]', index: 0); | ||
await $.native.enterTextByIndex('ny4ncat', index: 1); | ||
await $.native.tap(Selector(text: 'login')); | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -3,13 +3,18 @@ import 'common.dart'; | |
void main() async { | ||
patrol('interacts with the LeanCode website in a webview', ($) async { | ||
await createApp($); | ||
|
||
await $('Open webview (LeanCode)').scrollTo().tap(); | ||
|
||
await $.native.tap(Selector(text: 'Accept cookies')); | ||
|
||
// open dropdown | ||
await $.native.tap(Selector(text: 'What do you do in IT?', instance: 1)); | ||
|
||
// select option in dropdown | ||
await $.native.tap(Selector(text: 'Developer')); | ||
await $.native.tap(Selector(text: '1 item selected')); | ||
|
||
// close dropdown | ||
await $.native.tap(Selector(text: 'What do you do in IT?', instance: 1)); | ||
|
||
await $.native.enterTextByIndex('[email protected]', index: 0); | ||
}); | ||
} |
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
Oops, something went wrong.