-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Description
Bug report
Describe the bug
await Firebase.initializeApp() doesn't return at all when running as WidgetTest.
Steps to reproduce
Steps to reproduce the behavior:
- write a test
- run the test
The test should look like that
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Test recieve message', (WidgetTester tester) async {
await tester.pumpWidget(MyApp());
// Build our app and trigger a frame.
WidgetsFlutterBinding.ensureInitialized();
var fireApp = await Firebase.initializeApp(
options: FirebaseOptions(
projectId: "REDACTED",
appId: 'REDACTED',
messagingSenderId: 'REDACTED',
apiKey: 'REDACTED',
));
do_somefurther_test();
});
}We initially just tried with Firebase.initializeApp() but same behaviour.
We traced the call
#0 TestDefaultBinaryMessenger.Eval ()
#1 TestDefaultBinaryMessenger.send (package:flutter_test/src/binding.dart:104:45)
#2 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148:52)
#3 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331:12)
#4 MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:344:41)
#5 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:30:37)
#6 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:77:13)
#7 Firebase.initializeApp (package:firebase_core/src/firebase.dart:42:47)
#8 main.<anonymous closure> (file:///Users/user/Documents/Developer/rbyte-app/test/page_chat_test.dart:16:34)
<asynchronous suspension>
#9 StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart)
<asynchronous suspension>
Expected behavior
I expect that the call to Firebase.initializeApp() returns and ´do_somefurther_test()` gets executed. It should behave just like when running as app.
Sample project
see above code.
Additional context
The call with the same argument returns when run as an app via flutter run
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-DE)
• Flutter version 2.2.3 at /usr/local/Caskroom/flutter/2.2.3/flutter
• Framework revision f4abaa0735 (3 months ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/user/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 60.1.4
• Dart plugin version 212.4746.57
[✓] VS Code (version 1.60.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
! Doctor found issues in 2 categories.
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
PASTE OUTPUT INSIDE HERE
Reactions are currently unavailable