Skip to content
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

Fix workflows for running patrol tests on Android #2270

Merged
merged 11 commits into from
Jul 23, 2024
7 changes: 5 additions & 2 deletions .github/workflows/test-android-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: test android device
on:
workflow_dispatch:
schedule:
- cron: '30 21 * * *'
- cron: '0 */12 * * *'

jobs:
run_tests:
Expand Down Expand Up @@ -93,7 +93,10 @@ jobs:
echo "EXCLUDED_TESTS=$target_paths" >> "$GITHUB_ENV"

- name: patrol build android
run: patrol build android --exclude ${{ env.EXCLUDED_TESTS }} --verbose
run: |
patrol build android --exclude ${{ env.EXCLUDED_TESTS }} \
--dart-define-from-file=defines_1.json --dart-define-from-file=defines_2.json --dart-define-from-file=defines_3.env \
--verbose

- name: Upload APKs to Firebase Test Lab and wait for tests to finish
id: tests_step
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-android-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ jobs:
echo "EXCLUDED_TESTS=$target_paths" >> "$GITHUB_ENV"

- name: patrol build android
run: patrol build android --exclude ${{ env.EXCLUDED_TESTS }} --verbose
run: |
patrol build android --exclude ${{ env.EXCLUDED_TESTS }} \
--dart-define-from-file=defines_1.json --dart-define-from-file=defines_2.json --dart-define-from-file=defines_3.env \
--verbose

- name: Upload APKs to emulator.wtf and wait for tests to finish
id: tests_step
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ios-simulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
jobs:
run_tests:
name: Flutter ${{ matrix.flutter-version }} on ${{ matrix.device_model }} (${{ matrix.os_version }}) simulator
runs-on: macos-14
runs-on: macos-latest
timeout-minutes: 40
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }} simulator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const _timeout = Duration(seconds: 5); // to avoid timeouts on CI

// Firebase Test Lab pops out another dialog we need to handle
Future<void> tapOkIfGoogleDialogAppears(PatrolIntegrationTester $) async {
await $.pump(Duration(seconds: 10));

var listWithOkText = <NativeView>[];
final inactivityTimer = Timer(Duration(seconds: 10), () {});

Expand Down Expand Up @@ -63,7 +65,6 @@ void main() {
await $.native.selectFineLocation();
await $.native.grantPermissionOnlyThisTime();
}
await $.pump();

await tapOkIfGoogleDialogAppears($);
}
Expand All @@ -87,8 +88,6 @@ void main() {
await $.native2.selectFineLocation();
await $.native2.grantPermissionOnlyThisTime();
}
await $.pump();

await tapOkIfGoogleDialogAppearsV2($);
}

Expand Down
4 changes: 4 additions & 0 deletions dev/e2e_app/integration_test/webview_hackernews_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ void main() {

await $('Open webview (Hacker News)').scrollTo().tap();

await Future<void>.delayed(const Duration(seconds: 3));

await $.native.tap(Selector(text: 'login'));
await $.native.enterTextByIndex(
'[email protected]',
Expand All @@ -24,6 +26,8 @@ void main() {

await $('Open webview (Hacker News)').scrollTo().tap();

await Future<void>.delayed(const Duration(seconds: 3));

await $.native2.tap(
NativeSelector(
android: AndroidSelector(text: 'login'),
Expand Down
5 changes: 5 additions & 0 deletions dev/e2e_app/integration_test/webview_leancode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ void main() {
await createApp($);

await $('Open webview (LeanCode)').scrollTo().tap();
await $.pump(Duration(seconds: 8));

try {
await $.native.tap(Selector(text: 'Accept cookies'));
} on PatrolActionException catch (_) {
// ignore
}
await $.pumpAndSettle();

await $.native.enterTextByIndex(
'[email protected]',
Expand All @@ -24,6 +26,8 @@ void main() {
await createApp($);

await $('Open webview (LeanCode)').scrollTo().tap();
await $.pump(Duration(seconds: 8));
await $.pumpAndSettle();

try {
await $.native2.tap(
Expand All @@ -35,6 +39,7 @@ void main() {
} on PatrolActionException catch (_) {
// ignore
}
await $.pumpAndSettle();

await $.native2.enterTextByIndex(
'[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
);

patrol(
'interacts with the StackOverflow website in a webview',
'interacts with the StackOverflow website in a webview native2',
($) async {
await createApp($);

Expand Down
Loading