diff --git a/.github/recipe.yaml b/.github/recipe.yaml index f1d1272..c68867f 100644 --- a/.github/recipe.yaml +++ b/.github/recipe.yaml @@ -1,5 +1,2 @@ plugins: - firebase_core: ["tv-7.0"] - firebase_database: ["tv-7.0"] - firebase_storage: ["tv-7.0"] - cloud_functions: ["tv-7.0"] + tests: ["tv-7.0"] diff --git a/packages/firebase_database/example/test_driver/integration_test.dart b/packages/firebase_database/example/test_driver/integration_test.dart deleted file mode 100644 index f1ac26f..0000000 --- a/packages/firebase_database/example/test_driver/integration_test.dart +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2022, 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:integration_test/integration_test_driver.dart'; - -Future main() => integrationDriver(); diff --git a/packages/tests/example/.gitignore b/packages/tests/example/.gitignore new file mode 100644 index 0000000..ad3c2ca --- /dev/null +++ b/packages/tests/example/.gitignore @@ -0,0 +1,42 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# VS Code related +.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/tests/example/.metadata b/packages/tests/example/.metadata new file mode 100644 index 0000000..08bb62e --- /dev/null +++ b/packages/tests/example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77" + channel: "[user-branch]" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: android + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: ios + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: linux + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: macos + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: web + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + - platform: windows + create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/tests/example/README.md b/packages/tests/example/README.md new file mode 100644 index 0000000..8eb3290 --- /dev/null +++ b/packages/tests/example/README.md @@ -0,0 +1,3 @@ +# Flutterfire test + +All package e2e tests belong in this application. diff --git a/packages/tests/example/analysis_options.yaml b/packages/tests/example/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/packages/tests/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/cloud_functions/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart b/packages/tests/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart similarity index 99% rename from packages/cloud_functions/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart rename to packages/tests/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart index 8b4b60c..766c84b 100644 --- a/packages/cloud_functions/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart +++ b/packages/tests/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart @@ -7,7 +7,7 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:cloud_functions_example/firebase_options.dart'; +import 'package:tests/firebase_options.dart'; import 'sample_data.dart' as data; diff --git a/packages/cloud_functions/example/integration_test/cloud_functions/sample_data.dart b/packages/tests/example/integration_test/cloud_functions/sample_data.dart similarity index 100% rename from packages/cloud_functions/example/integration_test/cloud_functions/sample_data.dart rename to packages/tests/example/integration_test/cloud_functions/sample_data.dart diff --git a/packages/tests/example/integration_test/e2e_test.dart b/packages/tests/example/integration_test/e2e_test.dart new file mode 100644 index 0000000..d9bced3 --- /dev/null +++ b/packages/tests/example/integration_test/e2e_test.dart @@ -0,0 +1,48 @@ +// Copyright 2022, 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 'cloud_functions/cloud_functions_e2e_test.dart' as cloud_functions; +// import 'firebase_analytics/firebase_analytics_e2e_test.dart' +// as firebase_analytics; +// import 'firebase_app_check/firebase_app_check_e2e_test.dart' +// as firebase_app_check; +// import 'firebase_app_installations/firebase_app_installations_e2e_test.dart' +// as firebase_app_installations; +// import 'firebase_auth/firebase_auth_e2e_test.dart' as firebase_auth; +import 'firebase_core/firebase_core_e2e_test.dart' as firebase_core; +// import 'firebase_crashlytics/firebase_crashlytics_e2e_test.dart' +// as firebase_crashlytics; +import 'firebase_database/firebase_database_e2e_test.dart' as firebase_database; +// import 'firebase_dynamic_links/firebase_dynamic_links_e2e_test.dart' +// as firebase_dynamic_links; +// import 'firebase_messaging/firebase_messaging_e2e_test.dart' +// as firebase_messaging; +// import 'firebase_ml_model_downloader/firebase_ml_model_downloader_e2e_test.dart' +// as firebase_ml_model_downloader; +// import 'firebase_remote_config/firebase_remote_config_e2e_test.dart' +// as firebase_remote_config; +import 'firebase_storage/firebase_storage_e2e_test.dart' as firebase_storage; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('FlutterFire', () { + // firebase_core.main(); + // firebase_database.main(); + // firebase_crashlytics.main(); + // firebase_auth.main(); + // firebase_analytics.main(); + cloud_functions.main(); + // firebase_app_check.main(); + // firebase_app_installations.main(); + // firebase_dynamic_links.main(); + // firebase_messaging.main(); + // firebase_ml_model_downloader.main(); + // firebase_remote_config.main(); + // firebase_storage.main(); + }); +} diff --git a/packages/firebase_core/example/integration_test/firebase_core_test.dart b/packages/tests/example/integration_test/firebase_core/firebase_core_e2e_test.dart similarity index 98% rename from packages/firebase_core/example/integration_test/firebase_core_test.dart rename to packages/tests/example/integration_test/firebase_core/firebase_core_e2e_test.dart index 627dd55..96f8245 100644 --- a/packages/firebase_core/example/integration_test/firebase_core_test.dart +++ b/packages/tests/example/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -8,7 +8,7 @@ import 'package:firebase_core_platform_interface/firebase_core_platform_interfac import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import '../lib/firebase_options.dart'; +import 'package:tests/firebase_options.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/firebase_database/example/integration_test/firebase_database/data_snapshot_e2e.dart b/packages/tests/example/integration_test/firebase_database/data_snapshot_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/data_snapshot_e2e.dart rename to packages/tests/example/integration_test/firebase_database/data_snapshot_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/database_e2e.dart b/packages/tests/example/integration_test/firebase_database/database_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/database_e2e.dart rename to packages/tests/example/integration_test/firebase_database/database_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/database_reference_e2e.dart b/packages/tests/example/integration_test/firebase_database/database_reference_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/database_reference_e2e.dart rename to packages/tests/example/integration_test/firebase_database/database_reference_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/extra_e2e.dart b/packages/tests/example/integration_test/firebase_database/extra_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/extra_e2e.dart rename to packages/tests/example/integration_test/firebase_database/extra_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/firebase_database_configuration_e2e.dart b/packages/tests/example/integration_test/firebase_database/firebase_database_configuration_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/firebase_database_configuration_e2e.dart rename to packages/tests/example/integration_test/firebase_database/firebase_database_configuration_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/firebase_database_e2e_test.dart b/packages/tests/example/integration_test/firebase_database/firebase_database_e2e_test.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/firebase_database_e2e_test.dart rename to packages/tests/example/integration_test/firebase_database/firebase_database_e2e_test.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/on_disconnect_e2e.dart b/packages/tests/example/integration_test/firebase_database/on_disconnect_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/on_disconnect_e2e.dart rename to packages/tests/example/integration_test/firebase_database/on_disconnect_e2e.dart diff --git a/packages/firebase_database/example/integration_test/firebase_database/query_e2e.dart b/packages/tests/example/integration_test/firebase_database/query_e2e.dart similarity index 100% rename from packages/firebase_database/example/integration_test/firebase_database/query_e2e.dart rename to packages/tests/example/integration_test/firebase_database/query_e2e.dart diff --git a/packages/firebase_storage/example/integration_test/extratest_e2e.dart b/packages/tests/example/integration_test/firebase_storage/extratest_e2e.dart similarity index 100% rename from packages/firebase_storage/example/integration_test/extratest_e2e.dart rename to packages/tests/example/integration_test/firebase_storage/extratest_e2e.dart diff --git a/packages/firebase_storage/example/integration_test/firebase_storage_e2e_test.dart b/packages/tests/example/integration_test/firebase_storage/firebase_storage_e2e_test.dart similarity index 88% rename from packages/firebase_storage/example/integration_test/firebase_storage_e2e_test.dart rename to packages/tests/example/integration_test/firebase_storage/firebase_storage_e2e_test.dart index 7cb9095..b6b5ab2 100644 --- a/packages/firebase_storage/example/integration_test/firebase_storage_e2e_test.dart +++ b/packages/tests/example/integration_test/firebase_storage/firebase_storage_e2e_test.dart @@ -6,8 +6,8 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; +import 'package:tests/firebase_options.dart'; -import '../lib/firebase_options.dart'; import 'instance_e2e.dart'; import 'list_result_e2e.dart'; import 'reference_e2e.dart'; @@ -20,9 +20,9 @@ void main() { group('firebase_storage', () { setUpAll(() async { await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, + options: DefaultFirebaseOptions.baseOptions, ); - + print("start storage test"); // Add a write only file await FirebaseStorage.instance .ref('writeOnly.txt') @@ -56,9 +56,9 @@ void main() { }); setupInstanceTests(); - setupListResultTests(); - setupReferenceTests(); - setupTaskTests(); - setupExtraTests(); + // setupListResultTests(); + // setupReferenceTests(); + // setupTaskTests(); + // setupExtraTests(); }); } diff --git a/packages/firebase_storage/example/integration_test/instance_e2e.dart b/packages/tests/example/integration_test/firebase_storage/instance_e2e.dart similarity index 98% rename from packages/firebase_storage/example/integration_test/instance_e2e.dart rename to packages/tests/example/integration_test/firebase_storage/instance_e2e.dart index a3071e5..c425e49 100644 --- a/packages/firebase_storage/example/integration_test/instance_e2e.dart +++ b/packages/tests/example/integration_test/firebase_storage/instance_e2e.dart @@ -5,8 +5,8 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:tests/firebase_options.dart'; -import '../lib/firebase_options.dart'; import 'test_utils.dart'; void setupInstanceTests() { @@ -17,7 +17,7 @@ void setupInstanceTests() { setUpAll(() async { await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, + options: DefaultFirebaseOptions.baseOptions, ); storage = FirebaseStorage.instance; secondaryApp = await testInitializeSecondaryApp(); diff --git a/packages/firebase_storage/example/integration_test/list_result_e2e.dart b/packages/tests/example/integration_test/firebase_storage/list_result_e2e.dart similarity index 100% rename from packages/firebase_storage/example/integration_test/list_result_e2e.dart rename to packages/tests/example/integration_test/firebase_storage/list_result_e2e.dart diff --git a/packages/firebase_storage/example/integration_test/reference_e2e.dart b/packages/tests/example/integration_test/firebase_storage/reference_e2e.dart similarity index 100% rename from packages/firebase_storage/example/integration_test/reference_e2e.dart rename to packages/tests/example/integration_test/firebase_storage/reference_e2e.dart diff --git a/packages/firebase_storage/example/integration_test/task_e2e.dart b/packages/tests/example/integration_test/firebase_storage/task_e2e.dart similarity index 100% rename from packages/firebase_storage/example/integration_test/task_e2e.dart rename to packages/tests/example/integration_test/firebase_storage/task_e2e.dart diff --git a/packages/firebase_storage/example/integration_test/test_utils.dart b/packages/tests/example/integration_test/firebase_storage/test_utils.dart similarity index 89% rename from packages/firebase_storage/example/integration_test/test_utils.dart rename to packages/tests/example/integration_test/firebase_storage/test_utils.dart index f1d6a06..a4f5b10 100644 --- a/packages/firebase_storage/example/integration_test/test_utils.dart +++ b/packages/tests/example/integration_test/firebase_storage/test_utils.dart @@ -7,8 +7,7 @@ import 'dart:math'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/foundation.dart'; - -import '../lib/firebase_options.dart'; +import 'package:tests/firebase_options.dart'; final String kTestString = ([]..length = int.parse('${pow(2, 12)}')).join(_getRandomString(8)) * 100; @@ -62,11 +61,11 @@ Future testInitializeSecondaryApp({ ); } else { testAppOptions = FirebaseOptions( - appId: DefaultFirebaseOptions.currentPlatform.appId, - apiKey: DefaultFirebaseOptions.currentPlatform.apiKey, - projectId: DefaultFirebaseOptions.currentPlatform.projectId, + appId: DefaultFirebaseOptions.baseOptions.appId, + apiKey: DefaultFirebaseOptions.baseOptions.apiKey, + projectId: DefaultFirebaseOptions.baseOptions.projectId, messagingSenderId: - DefaultFirebaseOptions.currentPlatform.messagingSenderId, + DefaultFirebaseOptions.baseOptions.messagingSenderId, storageBucket: withDefaultBucket ? kTestStorageBucket : null, ); } diff --git a/packages/tests/example/lib/firebase_options.dart b/packages/tests/example/lib/firebase_options.dart new file mode 100644 index 0000000..233893a --- /dev/null +++ b/packages/tests/example/lib/firebase_options.dart @@ -0,0 +1,58 @@ +// Copyright 2022, 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. + +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + switch (defaultTargetPlatform) { + case TargetPlatform.linux: + // Note: To find out if you are using the Tizen platform, refer to the link below. + // https://github.com/flutter-tizen/flutter-tizen/issues/482#issuecomment-1441139704 + return tizen; + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static FirebaseOptions get baseOptions { + return FirebaseOptions( + apiKey: 'PLACEHOLDER', + appId: 'PLACEHOLDER', + messagingSenderId: 'PLACEHOLDER', + projectId: 'PLACEHOLDER', + databaseURL: 'PLACEHOLDER', + storageBucket: 'PLACEHOLDER', + ); + } + + static const FirebaseOptions tizen = FirebaseOptions( + apiKey: 'PLACEHOLDER', + appId: 'PLACEHOLDER', + messagingSenderId: 'PLACEHOLDER', + projectId: 'PLACEHOLDER', + databaseURL: 'PLACEHOLDER', + storageBucket: 'PLACEHOLDER', + ); + + static String get emulatorHost { + return 'PLACEHOLDER'; + } +} diff --git a/packages/tests/example/lib/main.dart b/packages/tests/example/lib/main.dart new file mode 100644 index 0000000..b84447b --- /dev/null +++ b/packages/tests/example/lib/main.dart @@ -0,0 +1,162 @@ +// Copyright 2022, 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 'dart:io'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:firebase_remote_config/firebase_remote_config.dart'; +import 'package:firebase_app_installations/firebase_app_installations.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'firebase_options.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({Key? key, required this.title}) : super(key: key); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () async { + // Running these APIs manually as they're failing on CI due to required keychain sharing entitlements + // See this issue https://github.com/firebase/flutterfire/issues/9538 + // You will also need to add the keychain sharing entitlements to this test app and sign code with development team for app & tests to successfully run + if (Platform.isMacOS && kDebugMode) { + // ignore_for_file: avoid_print + await FirebaseRemoteConfig.instance.fetchAndActivate(); + print('Fetched and activated remote config'); + + final id = await FirebaseInstallations.instance.getId(); + print('Received Firebase App Installations id: $id'); + + // Wait a little so we don't get a delete-pending exception + await Future.delayed(const Duration(seconds: 8)); + + await FirebaseInstallations.instance.delete(); + print('Deleted Firebase App Installations id'); + + final token = await FirebaseInstallations.instance.getToken(); + print('Received Firebase App Installations token: $token'); + + const topic = 'test-topic'; + await FirebaseMessaging.instance.subscribeToTopic(topic); + print('Firebase Messaging subscribed to topic: $topic'); + + await FirebaseMessaging.instance.unsubscribeFromTopic(topic); + print('Firebase Messaging unsubscribed to topic: $topic'); + } + }, + child: const Text('Test macOS tests manually'), + ), + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/packages/tests/example/pubspec.lock b/packages/tests/example/pubspec.lock new file mode 100644 index 0000000..eeefbc1 --- /dev/null +++ b/packages/tests/example/pubspec.lock @@ -0,0 +1,413 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "3ff770dfff04a67b0863dff205a0936784de1b87a5e99b11c693fc10e66a9ce3" + url: "https://pub.dev" + source: hosted + version: "1.0.12" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + cloud_functions: + dependency: transitive + description: + name: cloud_functions + sha256: "4d1ab399ac89ac59fe80616e6b3322f76cede621e32d33cdc90560097be76fee" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + cloud_functions_platform_interface: + dependency: transitive + description: + name: cloud_functions_platform_interface + sha256: "28765c049a8945046f799279864ca8feffaa41a9e5d3c03654affbb2f282075c" + url: "https://pub.dev" + source: hosted + version: "5.1.26" + cloud_functions_tizen: + dependency: "direct main" + description: + path: "../../cloud_functions" + relative: true + source: path + version: "0.1.0" + cloud_functions_web: + dependency: transitive + description: + name: cloud_functions_web + sha256: "1de54c7df9091f66084a18a406f68871e7e1febe5178f36524d058a7a66adc13" + url: "https://pub.dev" + source: hosted + version: "4.3.15" + collection: + dependency: "direct main" + description: + name: collection + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" + source: hosted + version: "1.17.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + firebase_core: + dependency: transitive + description: + name: firebase_core + sha256: c129209ba55f3d4272c89fb4a4994c15bea77fb6de63a82d45fb6bc5c94e4355 + url: "https://pub.dev" + source: hosted + version: "2.4.1" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: "5fab93f5b354648efa62e7cc829c90efb68c8796eecf87e0888cae2d5f3accd4" + url: "https://pub.dev" + source: hosted + version: "4.5.2" + firebase_core_tizen: + dependency: "direct main" + description: + path: "../../firebase_core" + relative: true + source: path + version: "1.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "18b35ce111b0a4266abf723c825bcf9d4e2519d13638cc7f06f2a8dd960c75bc" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + firebase_database: + dependency: transitive + description: + name: firebase_database + sha256: d2ee0e52955cfd55ab716a48a71b85b727cde8542c4deb3a9013b2812dd1891e + url: "https://pub.dev" + source: hosted + version: "10.0.9" + firebase_database_platform_interface: + dependency: transitive + description: + name: firebase_database_platform_interface + sha256: "1329ade83b77b7b3158f1e9b3d332541ec398481b5d4ad213d94de7a575c07b6" + url: "https://pub.dev" + source: hosted + version: "0.2.2+17" + firebase_database_tizen: + dependency: "direct main" + description: + path: "../../firebase_database" + relative: true + source: path + version: "0.1.0" + firebase_database_web: + dependency: transitive + description: + name: firebase_database_web + sha256: "8414131490173e20b165ccbc03f2ff141d7b0f2999edb9ea48d8d77249f93e9f" + url: "https://pub.dev" + source: hosted + version: "0.2.1+19" + firebase_storage: + dependency: transitive + description: + name: firebase_storage + sha256: "1801785c8bce9b0b262f5daf36e1a48907620147b8065a25e3ad7ae2e890fc11" + url: "https://pub.dev" + source: hosted + version: "11.0.10" + firebase_storage_platform_interface: + dependency: transitive + description: + name: firebase_storage_platform_interface + sha256: "3abc5b687731b7e221ea2b867ddc40ed2f6bdb510dcc3d6cd5d73b25ad750485" + url: "https://pub.dev" + source: hosted + version: "4.1.26" + firebase_storage_tizen: + dependency: "direct main" + description: + path: "../../firebase_storage" + relative: true + source: path + version: "0.1.0" + firebase_storage_web: + dependency: transitive + description: + name: firebase_storage_web + sha256: "6ac00cd227fb863fcf3ab67991cbaafcd0993da88f63be552e4e636bb0928a3c" + url: "https://pub.dev" + source: hosted + version: "3.3.19" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_driver: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + integration_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + integration_test_tizen: + dependency: "direct dev" + description: + name: integration_test_tizen + sha256: e2a6141bf7d4884b5526381733f88f5ebc7013f1f22460d868ecf28619ff467c + url: "https://pub.dev" + source: hosted + version: "2.0.1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" + source: hosted + version: "2.1.6" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + sync_http: + dependency: transitive + description: + name: sync_http + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f + url: "https://pub.dev" + source: hosted + version: "11.7.1" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" + webdriver: + dependency: transitive + description: + name: webdriver + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + url: "https://pub.dev" + source: hosted + version: "3.0.2" +sdks: + dart: ">=3.1.0-185.0.dev <4.0.0" + flutter: ">=2.0.0" diff --git a/packages/tests/example/pubspec.yaml b/packages/tests/example/pubspec.yaml new file mode 100644 index 0000000..9a7c13d --- /dev/null +++ b/packages/tests/example/pubspec.yaml @@ -0,0 +1,42 @@ +# ignore_for_file sort_pub_dependencies +name: tests +description: A an app for FlutterFire testing (e2e). +publish_to: "none" +version: 1.0.0+1 + +environment: + sdk: ">=2.16.0 <3.0.0" + +dependencies: + cloud_functions_tizen: + path: ../../cloud_functions + collection: ^1.15.0 + firebase_core_tizen: + path: ../../firebase_core + firebase_database_tizen: + path: ../../firebase_database + firebase_storage_tizen: + path: ../../firebase_storage + flutter: + sdk: flutter + http: ^0.13.4 + +dependency_overrides: + cloud_functions_tizen: + path: ../../cloud_functions + firebase_core_tizen: + path: ../../firebase_core + firebase_database_tizen: + path: ../../firebase_database + firebase_storage_tizen: + path: ../../firebase_storage + +dev_dependencies: + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + integration_test_tizen: ^2.0.1 + +flutter: + uses-material-design: true diff --git a/packages/tests/example/test/widget_test.dart b/packages/tests/example/test/widget_test.dart new file mode 100644 index 0000000..092d222 --- /dev/null +++ b/packages/tests/example/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:example/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/packages/cloud_functions/example/test_driver/integration_test.dart b/packages/tests/example/test_driver/integration_test.dart similarity index 100% rename from packages/cloud_functions/example/test_driver/integration_test.dart rename to packages/tests/example/test_driver/integration_test.dart diff --git a/packages/tests/example/tizen/.gitignore b/packages/tests/example/tizen/.gitignore new file mode 100644 index 0000000..750f3af --- /dev/null +++ b/packages/tests/example/tizen/.gitignore @@ -0,0 +1,5 @@ +flutter/ +.vs/ +*.user +bin/ +obj/ diff --git a/packages/tests/example/tizen/App.cs b/packages/tests/example/tizen/App.cs new file mode 100644 index 0000000..6dd4a63 --- /dev/null +++ b/packages/tests/example/tizen/App.cs @@ -0,0 +1,20 @@ +using Tizen.Flutter.Embedding; + +namespace Runner +{ + public class App : FlutterApplication + { + protected override void OnCreate() + { + base.OnCreate(); + + GeneratedPluginRegistrant.RegisterPlugins(this); + } + + static void Main(string[] args) + { + var app = new App(); + app.Run(args); + } + } +} diff --git a/packages/tests/example/tizen/Runner.csproj b/packages/tests/example/tizen/Runner.csproj new file mode 100644 index 0000000..f4e369d --- /dev/null +++ b/packages/tests/example/tizen/Runner.csproj @@ -0,0 +1,19 @@ + + + + Exe + tizen40 + + + + + + + + + + %(RecursiveDir) + + + + diff --git a/packages/tests/example/tizen/shared/res/ic_launcher.png b/packages/tests/example/tizen/shared/res/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/packages/tests/example/tizen/shared/res/ic_launcher.png differ diff --git a/packages/tests/example/tizen/tizen-manifest.xml b/packages/tests/example/tizen/tizen-manifest.xml new file mode 100644 index 0000000..cafaeb7 --- /dev/null +++ b/packages/tests/example/tizen/tizen-manifest.xml @@ -0,0 +1,13 @@ + + + + + + ic_launcher.png + + + + + http://tizen.org/privilege/internet + +