leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
894 stars 134 forks source link

`patrol test` doesn't pipe logs #1523

Open ujwalbasnet1 opened 1 year ago

ujwalbasnet1 commented 1 year ago

Steps to reproduce

run patrol test for one of the file

 patrol test --target integration_test/link_brokerage_account_test.dart -d emulator-5554

Actual results

image

only logs i see are:

 patrol test --target integration_test/link_brokerage_account_test.dart -d emulator-5554
You're using Patrol CLI 2.0, which has breaking changes.
Read the migration guide at https://patrol.leancode.co/v2.
Disable this warning by setting the PATROL_MIGRATED environment variable.

• Building apk with entrypoint test_bundle.dart...
✓ Completed building apk with entrypoint test_bundle.dart (14.1s)
• Executing tests of apk with entrypoint test_bundle.dart on emulator-5554...
        See the report at: <project-path>/build/app/reports/androidTests/connected/index.html
✗ Failed to execute tests of apk with entrypoint test_bundle.dart on emulator-5554 (Gradle test execution failed with code 1) (71.8s)
Exception: Gradle test execution failed with code 1
See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.

Logs

No response

Patrol version

patrol: ^2.0.2

Patrol Doctor output

Patrol Doctor output ``` ➜ patrol doctor You're using Patrol CLI 2.0, which has breaking changes. Read the migration guide at https://patrol.leancode.co/v2. Disable this warning by setting the PATROL_MIGRATED environment variable. Patrol CLI version: 2.0.3 Program adb found in /Users/ujwalbasnet1/Library/Android/sdk/platform-tools/adb Env var $ANDROID_HOME set to /Users/ujwalbasnet1/Library/Android/sdk Program xcodebuild found in /usr/bin/xcodebuild Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller ```

Flutter Doctor output

Flutter Doctor output ``` ➜ flutter doctor --verbose [✓] Flutter (Channel stable, 3.7.12, on macOS 13.4 22F66 darwin-arm64, locale en-NP) • Flutter version 3.7.12 on channel stable at /Users/ujwalbasnet1/fvm/versions/3.7.12 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4d9e56e694 (3 months ago), 2023-04-17 21:47:46 -0400 • Engine revision 1a65d409c7 • Dart version 2.19.6 • DevTools version 2.20.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/ujwalbasnet1/Library/Android/sdk • Platform android-33, build-tools 34.0.0 • ANDROID_HOME = /Users/ujwalbasnet1/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/ujwalbasnet1/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser [✓] Android Studio (version 2022.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 11.0.15+0-b2043.56-8887301) [✓] VS Code (version 1.80.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.68.0 [✓] Connected device (3 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64 • Chrome (web) • chrome • web-javascript • Brave Browser 114.1.52.130 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
bartekpacia commented 1 year ago

Hi 👋🏻

Unfortunately this is how it works right now. We do want to fix it. For now, you can use flutter logs or adb logcat (throw in some grep in that and it works pretty nice tbh).

Of course, it's not perfect, but that's how it is right now.

bartekpacia commented 1 year ago

related: #1531

bartekpacia commented 11 months ago

This will require estabilishing communication between Patrol CLI and app under test.

Patrol could provide a patrolPrint(String msg) function that would cause the msg to be displayed in the terminal. Well-written Flutter apps don't use print directly but redirect logs to Logger from package:logging. So developers could hook patrolPrint into Logger.

But that's just an idea.

shovelmn commented 3 months ago

Why not just pipe stdout to the console :) ?