-
Notifications
You must be signed in to change notification settings - Fork 4.1k
test(firebase_core): migrate to integration_test package
#8928
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
Changes from all commits
860f070
c83060b
eea1a80
278f186
1e19ba7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| // Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:integration_test/integration_test.dart'; | ||
|
|
||
| import 'firebase_core/firebase_core_e2e_test.dart' as firebase_core; | ||
|
|
||
| void main() { | ||
| IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| // ignore: unnecessary_lambdas | ||
| group('FlutterFire', () { | ||
| test('dummy test', () { | ||
| expect(true, true); | ||
| }); | ||
| firebase_core.main(); | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'package:firebase_core/firebase_core.dart'; | ||
| import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:integration_test/integration_test.dart'; | ||
| import 'package:tests/firebase_options.dart'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another difference to the Flutter Drivers tests is that I'm using the |
||
|
|
||
| void main() { | ||
| IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| group('firebase_core', () { | ||
| String testAppName = '[DEFAULT]'; | ||
|
|
||
| setUpAll(() async { | ||
| await Firebase.initializeApp( | ||
| options: DefaultFirebaseOptions.currentPlatform, | ||
| ); | ||
| }); | ||
|
|
||
| test('Firebase.apps', () async { | ||
| List<FirebaseApp> apps = Firebase.apps; | ||
| expect(apps.length, 1); | ||
| expect(apps[0].name, testAppName); | ||
| expect(apps[0].options, DefaultFirebaseOptions.currentPlatform); | ||
| }); | ||
|
|
||
| test('Firebase.app()', () async { | ||
| FirebaseApp app = Firebase.app(testAppName); | ||
|
|
||
| expect(app.name, testAppName); | ||
| expect(app.options, DefaultFirebaseOptions.currentPlatform); | ||
| }); | ||
|
|
||
| test('Firebase.app() Exception', () async { | ||
| expect( | ||
| () => Firebase.app('NoApp'), | ||
| throwsA(noAppExists('NoApp')), | ||
| ); | ||
| }); | ||
|
|
||
| test( | ||
| 'FirebaseApp.delete()', | ||
| () async { | ||
| await Firebase.initializeApp( | ||
| name: 'SecondaryApp', | ||
| options: DefaultFirebaseOptions.currentPlatform, | ||
| ); | ||
|
|
||
| expect(Firebase.apps.length, 2); | ||
|
|
||
| FirebaseApp app = Firebase.app('SecondaryApp'); | ||
|
|
||
| await app.delete(); | ||
|
|
||
| expect(Firebase.apps.length, 1); | ||
| // TODO(russellwheatley): test randomly causes an auth sign-in failure due to duplicate accounts. | ||
| }, | ||
| skip: TargetPlatform.android == defaultTargetPlatform, | ||
| ); | ||
|
|
||
| test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async { | ||
| FirebaseApp app = Firebase.app(testAppName); | ||
| bool enabled = app.isAutomaticDataCollectionEnabled; | ||
|
|
||
| await app.setAutomaticDataCollectionEnabled(!enabled); | ||
|
|
||
| expect(app.isAutomaticDataCollectionEnabled, !enabled); | ||
| }); | ||
|
|
||
| test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { | ||
| FirebaseApp app = Firebase.app(testAppName); | ||
|
|
||
| await app.setAutomaticResourceManagementEnabled(true); | ||
| }); | ||
| }); | ||
| } | ||

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.
This line will be remove when I migrated a second package.