-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
piotruela
committed
Oct 2, 2024
1 parent
24e26f7
commit 3d6d6f9
Showing
8 changed files
with
99 additions
and
70 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 |
---|---|---|
@@ -1,44 +1,53 @@ | ||
import 'dart:io'; | ||
|
||
import 'common.dart'; | ||
|
||
void main() { | ||
patrol('Open external url', ($) async { | ||
await createApp($); | ||
|
||
await $.native.openUrl('https://leancode.co'); | ||
await $.native2.openUrl('https://leancode.co'); | ||
|
||
try { | ||
await $.native.tap(Selector(text: 'Use without an account')); | ||
} on PatrolActionException catch (_) { | ||
// ignore | ||
} | ||
await $.pump(Duration(seconds: 5)); | ||
|
||
try { | ||
await $.native.tap(Selector(text: 'Contact us')); | ||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'Use without an account'), | ||
), | ||
); | ||
} on PatrolActionException catch (_) { | ||
// ignore | ||
} | ||
|
||
try { | ||
await $.native.tap(Selector(text: 'No thanks')); | ||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'No thanks'), | ||
ios: IOSSelector(label: 'No thanks'), | ||
), | ||
appId: 'com.apple.mobilesafari', | ||
); | ||
} on PatrolActionException catch (_) { | ||
// ignore | ||
} | ||
|
||
try { | ||
await $.native.tap(Selector(text: 'ACCEPT ALL COOKIES')); | ||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'ACCEPT ALL COOKIES'), | ||
ios: IOSSelector(label: 'ACCEPT ALL COOKIES'), | ||
), | ||
appId: 'com.apple.mobilesafari', | ||
); | ||
} on PatrolActionException catch (_) { | ||
// ignore | ||
} | ||
|
||
if (Platform.isIOS) { | ||
await $.native.waitUntilVisible( | ||
Selector(text: 'Subscribe'), | ||
appId: 'com.apple.mobilesafari', | ||
); | ||
} else { | ||
await $.native.waitUntilVisible(Selector(text: 'Subscribe')); | ||
} | ||
await $.native2.waitUntilVisible( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'Contact us'), | ||
ios: IOSSelector(label: 'Contact us'), | ||
), | ||
appId: 'com.apple.mobilesafari', | ||
); | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ void main() { | |
|
||
await $('Open webview (Hacker News)').scrollTo().tap(); | ||
|
||
await Future<void>.delayed(const Duration(seconds: 3)); | ||
await $.pump(Duration(seconds: 3)); | ||
|
||
await $.native.tap(Selector(text: 'login')); | ||
await $.native.enterTextByIndex( | ||
|
@@ -26,22 +26,31 @@ void main() { | |
|
||
await $('Open webview (Hacker News)').scrollTo().tap(); | ||
|
||
await Future<void>.delayed(const Duration(seconds: 3)); | ||
await $.pump(Duration(seconds: 3)); | ||
|
||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'login'), | ||
ios: IOSSelector(label: 'login'), | ||
), | ||
); | ||
await $.native2.enterTextByIndex( | ||
'[email protected]', | ||
index: 0, | ||
await $.native2.enterText( | ||
NativeSelector( | ||
android: AndroidSelector( | ||
className: 'android.widget.EditText', | ||
instance: 0, | ||
), | ||
ios: IOSSelector(elementType: IOSElementType.textField), | ||
), | ||
text: '[email protected]', | ||
keyboardBehavior: KeyboardBehavior.showAndDismiss, | ||
); | ||
await $.native2.enterText( | ||
NativeSelector( | ||
android: AndroidSelector(className: 'android.widget.EditText'), | ||
android: AndroidSelector( | ||
className: 'android.widget.EditText', | ||
instance: 1, | ||
), | ||
ios: IOSSelector(elementType: IOSElementType.secureTextField), | ||
), | ||
text: 'ny4ncat', | ||
|
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import 'dart:io' as io; | ||
|
||
import 'common.dart'; | ||
|
||
void main() { | ||
|
@@ -22,32 +20,28 @@ void main() { | |
} | ||
await $.pumpAndSettle(); | ||
|
||
if (io.Platform.isIOS) { | ||
await $.native2.scrollTo( | ||
NativeSelector( | ||
ios: IOSSelector(placeholderValue: 'Type your email'), | ||
), | ||
maxScrolls: 20, | ||
); | ||
} | ||
final emailInputSelector = NativeSelector( | ||
android: AndroidSelector(className: 'android.widget.EditText'), | ||
ios: IOSSelector(placeholderValue: 'Type your email'), | ||
); | ||
|
||
await $.pump(Duration(seconds: 5)); | ||
await $.native2.scrollTo(emailInputSelector, maxScrolls: 20); | ||
|
||
await $.pump(Duration(seconds: 2)); | ||
|
||
await $.native2.enterText( | ||
NativeSelector( | ||
android: AndroidSelector(className: 'android.widget.EditText'), | ||
ios: IOSSelector(placeholderValue: 'Type your email'), | ||
), | ||
emailInputSelector, | ||
text: '[email protected]', | ||
keyboardBehavior: KeyboardBehavior.showAndDismiss, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
tapLocation: Offset(0.5, 0.5), | ||
); | ||
|
||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'Subscribe'), | ||
ios: IOSSelector(label: 'Subscribe'), | ||
), | ||
final subscribeButtonSelector = NativeSelector( | ||
android: AndroidSelector(text: 'Subscribe'), | ||
ios: IOSSelector(label: 'Subscribe'), | ||
); | ||
|
||
await $.native2.scrollTo(subscribeButtonSelector); | ||
await $.native2.tap(subscribeButtonSelector); | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -8,6 +8,8 @@ void main() { | |
|
||
await $('Open webview (StackOverflow)').scrollTo().tap(); | ||
|
||
await $.pump(Duration(seconds: 2)); | ||
|
||
try { | ||
await $.native.tap(Selector(text: 'Accept all cookies')); | ||
} on PatrolActionException catch (_) { | ||
|
@@ -18,14 +20,22 @@ void main() { | |
await $.pump(Duration(seconds: 2)); | ||
|
||
// bug: using `Email` and `Password` selectors doesn't work (#1554) | ||
await $.native.enterTextByIndex('[email protected]', index: 0); | ||
await $.native.enterTextByIndex( | ||
'[email protected]', | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.swipe( | ||
from: Offset(0.5, 0.5), | ||
to: Offset(0.5, 0.1), | ||
); | ||
|
||
await $.native.enterTextByIndex('ny4ncat', index: 1); | ||
await $.native.enterTextByIndex( | ||
'ny4ncat', | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.tap(Selector(text: 'Log in')); | ||
}, | ||
); | ||
|
@@ -37,6 +47,8 @@ void main() { | |
|
||
await $('Open webview (StackOverflow)').scrollTo().tap(); | ||
|
||
await $.pump(Duration(seconds: 2)); | ||
|
||
try { | ||
await $.native2.tap( | ||
NativeSelector( | ||
|
@@ -57,14 +69,22 @@ void main() { | |
await $.pump(Duration(seconds: 2)); | ||
|
||
// bug: using `Email` and `Password` selectors doesn't work (#1554) | ||
await $.native2.enterTextByIndex('[email protected]', index: 0); | ||
await $.native2.enterTextByIndex( | ||
'[email protected]', | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.swipe( | ||
from: Offset(0.5, 0.5), | ||
to: Offset(0.5, 0.1), | ||
); | ||
|
||
await $.native2.enterTextByIndex('ny4ncat', index: 1); | ||
await $.native2.enterTextByIndex( | ||
'ny4ncat', | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native2.tap( | ||
NativeSelector( | ||
android: AndroidSelector(text: 'Log in'), | ||
|
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
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