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

Add integration test checking functionality of Push #300

Merged
merged 9 commits into from
Sep 29, 2020

Conversation

jraska
Copy link
Owner

@jraska jraska commented Sep 28, 2020

Motivation

  • End to end Testing push integration with Firebase Cloud messaging is difficult as it requires interaction with Firebase. servers. and waiting for the push to appear on client.
  • Android device which runs test can serve both as push message producer and. consumer. The process can be automated like this.

The test scenario

  1. The device uses FCM API to send a push message to itself.
  2. The device waits until it receives push with deep link. The deep link push implementation triggers certain screen change.
  3. Test verifies the certain UI change did happen on the screen.

Implementation details

  • The main class of interest is PushIntegrationTest. It implements the test scenario.
  • We pass instrumentation runner argument FCM_API_KEY and use FCM HTTP API to trigger the push to itself using PushServerClient
  • PushHandleModel became interface to be able to hook into push in tests.
  • To idle Espresso properly, we hook into ServiceModel.Factory and we provide decorated version of PushHandleModel - TestPushHandleModel - this one makes the push idling resource Idle to allow Espresso screen verification.
  • PushAwaitRule holds the logic for idling resource waiting for push.
  • Tests are ignored if the FCM_API_KEY argument isn't provided. For example for local runs when we don't want to do this always.

Resolves #294

@jraska jraska merged commit 8b429f8 into master Sep 29, 2020
@jraska jraska deleted the add-push-integration-test branch September 29, 2020 18:18
@jraska
Copy link
Owner Author

jraska commented Mar 19, 2021

This PR was released with 0.22.1

@jraska jraska added this to the 0.22.1 milestone Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration Push Test
1 participant