Repository: flutter
Issue: Web Integration Test hangs till default timeout of 20 minutes on macOS GitHub Actions Runner
Labels: a: tests,tool,platform-mac,t: flutter driver,platform-web,f: integration_test,P2,team-web,triaged-web

### Steps to reproduce

This bug is only reproducible on the macOS GitHub Actions Runner Image.

1. Minimal code reproducible repo: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout
2. Workflow files: [reproduce-stock.yml], [reproduce-all.yml]
3. Bug reproduced runs: [reproduce-stock-run], [reproduce-all-run]


[reproduce-stock.yml]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/blob/main/.github/workflows/reproduce-stock.yml
[reproduce-all.yml]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/blob/main/.github/workflows/reproduce-all.yml
[reproduce-stock-run]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/runs/10811686290/job/29991616779
[reproduce-all-run]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/runs/10811686159/job/29991617797
[reproduce-stock-runs]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/workflows/reproduce-stock.yml
[reproduce-all-runs]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/workflows/reproduce-all.yml
[Expected result run]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10554873304/job/29237445146#step:11:552
[Actual result run]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10749373345/job/29814199834
[127]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10554873304/job/29237445146#step:11:525
[128]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10749373345/job/29814199834#step:11:540

### Expected results

[Expected result run in minimal repro]

Web Integration Test was working fine until recently on my portfolio project: https://github.com/hrishikesh-kadam/space_data_explorer

[Expected result run]

[Expected result run in minimal repro]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/runs/12346007897/job/34450951856#step:4:90
[Expected result run]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10554873304/job/29237445146#step:11:552

### Actual results

[Actual result run in minimal repro]

[Actual result run]

[Actual result run in minimal repro]: https://github.com/hrishikesh-kadam/repro_web_integration_test_timeout/actions/runs/12346007897/job/34450952037
[Actual result run]: https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10749373345/job/29814199834

The noticeable differences between the [Expected result run] and the [Actual result run] are:
- Google Chrome and Chromedriver versions [127], [128].

### Code sample

Explained in **`Steps to reproduce`**

### Screenshots or Video

NA

### Logs

<details open><summary>Logs</summary>

```console
Starting ChromeDriver 128.0.6613.119 (6e439cfca4deda5954b0c74cde9b521c03cb31ad-refs/branch-heads/6613@{#1464}) on port 4444
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 4444.
Downloading Web SDK...                                           2,025ms
Resolving dependencies...
Downloading packages...
  _fe_analyzer_shared 72.0.0 (74.0.0 available)
  _flutterfire_internals 1.3.40 (1.3.41 available)
  analyzer 6.7.0 (6.9.0 available)
  collection 1.18.0 (1.19.0 available)
  dio 5.6.0 (5.7.0 available)
  firebase_analytics 11.2.1 (11.3.0 available)
  firebase_analytics_platform_interface 4.2.1 (4.2.2 available)
  firebase_analytics_web 0.5.9+1 (0.5.9+2 available)
  firebase_core 3.3.0 (3.4.0 available)
  firebase_core_platform_interface 5.2.0 (5.2.1 available)
  firebase_core_web 2.17.4 (2.17.5 available)
  firebase_crashlytics 4.0.4 (4.1.0 available)
  firebase_crashlytics_platform_interface 3.6.40 (3.6.41 available)
  flex_seed_scheme 1.5.0 (3.2.0 available)
  http_parser 4.0.2 (4.1.0 available)
  injector 3.0.0 (4.0.0 available)
  leak_tracker 10.0.5 (10.0.7 available)
  leak_tracker_flutter_testing 3.0.5 (3.0.8 available)
  macros 0.1.2-main.4 (0.1.3-main.0 available)
  material_color_utilities 0.11.1 (0.12.0 available)
  mime 1.0.5 (1.0.6 available)
  sentry 8.7.0 (8.8.0 available)
  sentry_flutter 8.7.0 (8.8.0 available)
  shelf 1.4.1 (1.4.2 available)
  string_scanner 1.2.0 (1.3.0 available)
  test_api 0.7.2 (0.7.3 available)
  uuid 4.4.2 (4.5.0 available)
  web 0.5.1 (1.0.0 available)
Got dependencies!
28 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Launching integration_test/app_bar_back_button_test.dart on Web Server in debug mode...
Waiting for connection from debug service on Web Server...         29.1s
integration_test/app_bar_back_button_test.dart is being served at http://localhost:49699
The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
Unhandled exception:
DriverError: Error while reading FlutterDriver result for command: window.$flutterDriver('{"command":"request_data","timeout":"1200000"}')
Original error: Exception: Expected: not null
  Actual: <null>

Original stack trace:
#0      _matcherExpect (package:webdriver/support/async.dart:92:3)
#1      Clock.waitFor (package:webdriver/support/async.dart:60:11)
<asynchronous suspension>
#2      FlutterWebConnection.sendCommand (package:flutter_driver/src/driver/web_driver.dart:327:30)
<asynchronous suspension>
#3      WebFlutterDriver.sendCommand (package:flutter_driver/src/driver/web_driver.dart:123:14)
<asynchronous suspension>
#4      FlutterDriver.requestData (package:flutter_driver/src/driver/driver.dart:[540](https://github.com/hrishikesh-kadam/space_data_explorer/actions/runs/10749373345/job/29814199834#step:11:541):39)
<asynchronous suspension>
#5      integrationDriver (package:integration_test/integration_test_driver.dart:74:29)
<asynchronous suspension>


#0      FlutterWebConnection.sendCommand (package:flutter_driver/src/driver/web_driver.dart:338:7)
<asynchronous suspension>
#1      WebFlutterDriver.sendCommand (package:flutter_driver/src/driver/web_driver.dart:123:14)
<asynchronous suspension>
#2      FlutterDriver.requestData (package:flutter_driver/src/driver/driver.dart:540:39)
<asynchronous suspension>
#3      integrationDriver (package:integration_test/integration_test_driver.dart:74:29)
<asynchronous suspension>
Application finished.
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

Please note that this is only reproducible on the macOS GitHub Actions Runner Image,  
so pasting the `flutter --version` output

```console
Flutter 3.24.2 • channel stable • https://github.com/flutter/flutter
Framework • revision 4cf269e36d (3 days ago) • 2024-09-03 14:30:00 -0700
Engine • revision a6bd3f1de1
Tools • Dart 3.5.2 • DevTools 2.37.2
```

</details>

### Similar Issues
- https://github.com/flutter/flutter/issues/148982
- https://github.com/flutter/website/issues/11117
- https://stackoverflow.com/questions/78524233/flutter-drive-hanging-on-github-actions-with-no-output

### References

It would be great to know from the relevant maintainer of [firebase/flutterfire] what extra steps in [web.yaml][firebase/flutterfire web.yaml] are making them run the `flutter drive` command without timeout for `--device-id chrome`.

[firebase/flutterfire]: https://github.com/firebase/flutterfire
[firebase/flutterfire web.yaml]: https://github.com/firebase/flutterfire/blob/main/.github/workflows/web.yaml