[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[android_alarm_manager] Added Espresso test for background execution #2482

Merged
merged 45 commits into from
Mar 6, 2020

Conversation

bkonyi
Copy link
Contributor
@bkonyi bkonyi commented Jan 23, 2020

Added an Espresso test for package:android_alarm_manager which mainly tests background execution.

Basic test flow:

  1. Launch example application.
  2. Press "Schedule OneShot Alarm" button, scheduling a 5 second alarm.
  3. Assert alarm count in SharedPreferences shows no alarms have gone off.
  4. Close application.
  5. Poll SharedPreferences for up to 20s to ensure a background isolate can be spawned and a Dart callback can be run.
  6. Assert the alarm count in SharedPreferences is equal to 1.

To run the test without conflicting with the E2E tests, run the following command from $PACKAGE_ROOT/example/android/:

./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/alarm_manager_test.dart -Pandroid.testInstrumentationRunnerArguments.class='io.flutter.plugins.androidalarmmanagerexample.BackgroundExecutionTest'

Fixes flutter/flutter#48439

@collinjackson
Copy link
Contributor
collinjackson commented Mar 2, 2020

Per discussion in flutter/flutter#48439, I've split the example app into two apps until the Espresso and E2E plugins can play nicely with each other. Filed flutter/flutter#51781 for the long-term fix.

@collinjackson collinjackson requested a review from amirh March 2, 2020 21:39
Copy link
Contributor
@nturgut nturgut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bkonyi bkonyi requested a review from digiter as a code owner March 6, 2020 04:13
@collinjackson collinjackson merged commit 6ccebda into flutter:master Mar 6, 2020
emerssso pushed a commit to emerssso/plugins that referenced this pull request Mar 11, 2020
…lutter#2482)

* Added test for android_alarm_manager background execution

Co-authored-by: Collin Jackson <jackson@google.com>
EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
…lutter#2482)

* Added test for android_alarm_manager background execution

Co-authored-by: Collin Jackson <jackson@google.com>
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
…lutter#2482)

* Added test for android_alarm_manager background execution

Co-authored-by: Collin Jackson <jackson@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants