This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[firebase_messaging] add integration tests #1816
Merged
collinjackson
merged 10 commits into
flutter:master
from
collinjackson:messaging_integration_test
Jul 8, 2019
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3eea500
Initial firebase_messaging integration tests
collinjackson d9b4430
More integration tests for firebase_messaging
collinjackson 518a82b
Bump changelog and pubspec for release
collinjackson 387cce4
fix analyzer issues
collinjackson 8123e4c
Merge remote-tracking branch 'origin/master' into messaging_integrati…
collinjackson d65ab41
merge damage
collinjackson 1256f79
fix merge issue
collinjackson 2d9c96e
Update version
collinjackson ddb94c3
Remove token test
collinjackson 1d1784f
Merge remote-tracking branch 'origin/master' into messaging_integrati…
collinjackson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
34 changes: 34 additions & 0 deletions
34
packages/firebase_messaging/example/test_driver/firebase_messaging.dart
This file contains hidden or 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,34 @@ | ||
| import 'dart:async'; | ||
| import 'package:flutter_driver/driver_extension.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:firebase_messaging/firebase_messaging.dart'; | ||
|
|
||
| void main() { | ||
| final Completer<String> completer = Completer<String>(); | ||
| enableFlutterDriverExtension(handler: (_) => completer.future); | ||
| tearDownAll(() => completer.complete(null)); | ||
|
|
||
| group('$FirebaseMessaging', () { | ||
| final FirebaseMessaging firebaseMessaging = FirebaseMessaging(); | ||
|
|
||
| test('autoInitEnabled', () async { | ||
| await firebaseMessaging.setAutoInitEnabled(false); | ||
| expect(await firebaseMessaging.autoInitEnabled(), false); | ||
| await firebaseMessaging.setAutoInitEnabled(true); | ||
| expect(await firebaseMessaging.autoInitEnabled(), true); | ||
| }); | ||
|
|
||
| test('subscribeToTopic', () async { | ||
| firebaseMessaging.subscribeToTopic('foo'); | ||
| }); | ||
|
|
||
| test('unsubscribeFromTopic', () async { | ||
| firebaseMessaging.unsubscribeFromTopic('foo'); | ||
| }); | ||
|
|
||
| test('deleteInstanceID', () async { | ||
| final bool result = await firebaseMessaging.deleteInstanceID(); | ||
| expect(result, isTrue); | ||
| }); | ||
| }); | ||
| } | ||
7 changes: 7 additions & 0 deletions
7
packages/firebase_messaging/example/test_driver/firebase_messaging_test.dart
This file contains hidden or 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,7 @@ | ||
| import 'package:flutter_driver/flutter_driver.dart'; | ||
|
|
||
| Future<void> main() async { | ||
| final FlutterDriver driver = await FlutterDriver.connect(); | ||
| await driver.requestData(null, timeout: const Duration(minutes: 1)); | ||
| driver.close(); | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some idea, doesn't need to be in this PR. Maybe we can make
subscribeToTopicandunsubscribeFromTopicto return a Future to indicate the invocation to the platform is happened correctly. That'd make the integration test easier.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and will update in a subsequent PR