flutter / flutter/flutter-intellij

IntelliJ Flutter test runner hangs when running "flutter test --platform chrome"

Open
#7,628 1 comment 0 reactions 0 assignees View on GitHub
good-first-issue P2
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

The IntelliJ Flutter test runner succeeds when not specifying a platform (i.e. VM). Change the Flutter test runner configuration to specify additional args of `--platform chrome` and the test runner hangs. The terminal command `flutter test --platform chrome` succeeds.

We expect the IntelliJ test runner to succeed and display the results. This has worked in the past (last time I did this was at least a few years ago).

To test platform specific functionality (e.g. web storage) we need to run some tests on a given platform.

## Steps to Reproduce

- In a Flutter web project with tests (i.e. create the default Flutter project with web target), create a run configuration for "Flutter Test" (the default project has `test/widget_test.dart`).
- Run the test in the IntelliJ test runner and confirm that the test results/errors are displayed.
- Change the Flutter test run configuration `Additional args:` to include `--platform chrome` and save.
- Run the test again, the IntelliJ test runner starts with `Instantiating tests...`, a chrome browser window opens with a tab `Flutter Test Browser Host`, and then hang...

You can verify that the tests can run by opening a terminal on the project and running the command `flutter test --platform chrome`.

## Version info

`flutter doctor -v` output

```
flutter doctor -v
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.6.1 23G93 darwin-arm64, locale en-US)
• Flutter version 3.24.1 on channel stable at /Users/x/Library/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5874a72aa4 (3 days ago), 2024-08-20 16:46:00 -0500
• Engine revision c9b9d5780d
• Dart version 3.5.1
• DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/x/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.13.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
• 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
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.0.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 81.1.3
• Dart plugin version 242.20629

[✓] Connected device (4 available)
• iPhone 15 (mobile) • 26XXXX2D-XXXX-XXXX-XXXX-ED00XXXXXXXX • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.6.1 23G93 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6.1 23G93 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.120

[✓] Network resources
• All expected network resources are available.

• No issues found!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.