Closed chonghorizons closed 2 years ago
@chonghorizons, thanks for reporting this.
I looked into it and the issue appears to be coming from the binding.watchPerformance()
method.
/cc @domesticmouse
Small Update:
I tried to run this on the flutter web, and I got all tests passed. In --no-headless
mode, I was able to see the two "fling" actions.
Therefore this may be a physical device error. I get the binding.watchPerformance()
error you get and we both tested on physical devices.
web
.See if the same error triggers when running in the Android Emulator or an iOS device.
It failed on iOS
too.
It fails on Android emulator too - Pixel 3 API 28
/cc @miquelbeltran
@domesticmouse I can confirm this issue when running on mobile devices, including emulators, but not as desktop app.
The thing I noticed is that IntegrationTestWidgetsFlutterBinding.watchPerformance
is trying to connect to a localhost service, which does not exist on the device but on the local desktop.
In https://github.com/flutter/flutter/issues/90410 the same issue is discussed, and the solution is to add --no-dds
to the command, so to run:
flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart --no-dds
I can confirm the codelab works fine when running with --no-dds
flag. Thanks @miquelbeltran.
I think this can be closed as a duplicate, then of flutter/flutter#90410. Thanks @miquelbeltran .
Expected Result
https://codelabs.developers.google.com/codelabs/flutter-app-testing/ The codelab integration test examples run and the tests pass.
Actual Result
The
Scrolling test
fails in https://github.com/flutter/codelabs/blob/master/testing_codelab/step_07/integration_test/app_test.dartThe other two tests pass.
This is the error log
``` shell$ flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart --profile Running "flutter pub get" in testing_app... 1,543ms Running Gradle task 'assembleProfile'... 56.9s ✓ Built build/app/outputs/flutter-apk/app-profile.apk (11.8MB). Installing build/app/outputs/flutter-apk/app.apk... 3.5s VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:62747/iRiezfewcsE=/ VMServiceFlutterDriver: Isolate found with number: 2816534710512779 VMServiceFlutterDriver: Isolate is paused at start. VMServiceFlutterDriver: Attempting to resume isolate I/flutter ( 5749): 00:00 +0: Testing App Performance Tests Favorites operations test VMServiceFlutterDriver: Connected to Flutter application. I/flutter ( 5749): 00:09 +1: Testing App Performance Tests (tearDownAll) W/ple.testing_ap( 5749): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed) W/ple.testing_ap( 5749): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed) I/flutter ( 5749): 00:09 +2: All tests passed! All tests passed. Macs-MacBook-Air:testing_app howardchong$ flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart --profile Running "flutter pub get" in testing_app... 1,470ms Running Gradle task 'assembleProfile'... 65.0s ✓ Built build/app/outputs/flutter-apk/app-profile.apk (14.6MB). Installing build/app/outputs/flutter-apk/app.apk... 3.8s VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:62934/OSWzRBQSSno=/ VMServiceFlutterDriver: Isolate found with number: 2692430830870515 VMServiceFlutterDriver: Isolate is paused at start. VMServiceFlutterDriver: Attempting to resume isolate I/flutter ( 6418): 00:00 +0: Testing App Performance Tests Scrolling test VMServiceFlutterDriver: Connected to Flutter application. I/flutter ( 6418): SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 40625 I/flutter ( 6418): #0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:677) I/flutter ( 6418): #1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1680) I/flutter ( 6418): #2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27) I/flutter ( 6418): #3 Socket._startConnect (dart:io-patch/socket_patch.dart:1891) I/flutter ( 6418): #4 Socket.startConnect (dart:io/socket.dart:738) I/flutter ( 6418): #5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2439) I/flutter ( 6418): #6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2805) I/flutter ( 6418): #7 _HttpClient._getConnection (dart:_http/http_impl.dart:2810) I/flutter ( 6418): #8 _HttpClient._openUrl (dart:_http/http_impl.dart:2694) I/flutter ( 6418): #9 _HttpClient.openUrl (dart:_http/http_impl.dart:2568) I/flutter ( 6418): #10 _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1027) I/flutter ( 6418): #11 WebSocket.connect (dart:_http/websocket.dart:379) I/flutter ( 6418): #12 vmServiceConnectUri (package:vm_service/vm_service_io.dart:32) I/flutter ( 6418): #13 IntegrationTestWidgetsFlutterBinding.enableTimeline (package:integration_test/integration_test.dart:244) I/flutter ( 6418):This is flutter doctor
``` flutter doctor -v [✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale en-US) • Flutter version 2.5.3 at /Users/howardchong/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/howardchong/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • 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 installed but not working. You appear to have CocoaPods installed but it is not working. This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it. This can usually be fixed by re-installing CocoaPods. To re-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 • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] Connected device (2 available) • PH 1 (mobile) • PM1LHMA7B1300032 • android-arm64 • Android 10 (API 29) • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55 ```Running on physical device (PH1).