[firebase_remote_config] Initial integration tests (#1514)
diff --git a/packages/firebase_remote_config/CHANGELOG.md b/packages/firebase_remote_config/CHANGELOG.md
index d7b7966..280bf9a 100644
--- a/packages/firebase_remote_config/CHANGELOG.md
+++ b/packages/firebase_remote_config/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.1.0+3
+
+* Initial integration tests.
+
## 0.1.0+2
* Log messages about automatic configuration of the default app are now less confusing.
diff --git a/packages/firebase_remote_config/example/pubspec.yaml b/packages/firebase_remote_config/example/pubspec.yaml
index 4c4a4e0..99c4879 100644
--- a/packages/firebase_remote_config/example/pubspec.yaml
+++ b/packages/firebase_remote_config/example/pubspec.yaml
@@ -15,45 +15,6 @@
dev_dependencies:
flutter_test:
sdk: flutter
-
-# For information on the generic Dart part of this file, see the
-# following page: https://www.dartlang.org/tools/pub/pubspec
-
-# The following section is specific to Flutter.
-flutter:
-
- # The following line ensures that the Material Icons font is
- # included with your application, so that you can use the icons in
- # the material Icons class.
- uses-material-design: true
-
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
-
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.io/assets-and-images/#resolution-aware.
-
- # For details regarding adding assets from package dependencies, see
- # https://flutter.io/assets-and-images/#from-packages
-
- # To add custom fonts to your application, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts from package dependencies,
- # see https://flutter.io/custom-fonts/#from-packages
+ flutter_driver:
+ sdk: flutter
+ test: any
diff --git a/packages/firebase_remote_config/example/test_driver/firebase_remote_config.dart b/packages/firebase_remote_config/example/test_driver/firebase_remote_config.dart
new file mode 100644
index 0000000..ee01bcb
--- /dev/null
+++ b/packages/firebase_remote_config/example/test_driver/firebase_remote_config.dart
@@ -0,0 +1,34 @@
+import 'dart:async';
+import 'package:flutter_driver/driver_extension.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
+
+void main() {
+ final Completer<String> completer = Completer<String>();
+ enableFlutterDriverExtension(handler: (_) => completer.future);
+ tearDownAll(() => completer.complete(null));
+
+ group('$RemoteConfig', () {
+ RemoteConfig remoteConfig;
+
+ setUp(() async {
+ remoteConfig = await RemoteConfig.instance;
+ remoteConfig.setConfigSettings(RemoteConfigSettings(debugMode: true));
+ remoteConfig.setDefaults(<String, dynamic>{
+ 'welcome': 'default welcome',
+ 'hello': 'default hello',
+ });
+ });
+
+ test('fetch', () async {
+ final DateTime lastFetchTime = remoteConfig.lastFetchTime;
+ expect(lastFetchTime.isBefore(DateTime.now()), true);
+ await remoteConfig.fetch(expiration: const Duration(seconds: 0));
+ expect(remoteConfig.lastFetchTime.isAfter(lastFetchTime), true);
+ expect(remoteConfig.lastFetchStatus, LastFetchStatus.success);
+ await remoteConfig.activateFetched();
+ expect(remoteConfig.getString('welcome'), 'Earth, welcome! Hello!');
+ expect(remoteConfig.getString('hello'), 'default hello');
+ });
+ });
+}
diff --git a/packages/firebase_remote_config/example/test_driver/firebase_remote_config_test.dart b/packages/firebase_remote_config/example/test_driver/firebase_remote_config_test.dart
new file mode 100644
index 0000000..38fe6c4
--- /dev/null
+++ b/packages/firebase_remote_config/example/test_driver/firebase_remote_config_test.dart
@@ -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();
+}
diff --git a/packages/firebase_remote_config/pubspec.yaml b/packages/firebase_remote_config/pubspec.yaml
index e9dd607..e0b6bcb 100644
--- a/packages/firebase_remote_config/pubspec.yaml
+++ b/packages/firebase_remote_config/pubspec.yaml
@@ -3,7 +3,7 @@
re-releasing.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_remote_config
-version: 0.1.0+2
+version: 0.1.0+3
dependencies:
flutter:
@@ -13,6 +13,9 @@
flutter_test:
sdk: flutter
firebase_core: ^0.3.0
+ flutter_driver:
+ sdk: flutter
+ test: any
flutter:
plugin: