mmcc007 / screenshots

Screenshots: A command line utility and package for capturing screenshots for Flutter
Other
266 stars 145 forks source link

landscape not working #182

Open phil-homecu opened 4 years ago

phil-homecu commented 4 years ago

I have several screenshots.yaml files that specify Portrait for the orientation. The same file with LandscapeLeft, still runs successfully, however the orientation is still Portrait. This happens for both IOS and Android devices.

screenshots -v -c screens/ss_land_android.yaml

[  +59 ms] Starting flutter daemon...
[   +9 ms] executing: flutter daemon
[ +552 ms] <== Starting device daemon...
[   +2 ms] <== [{"event":"daemon.connected","params":{"version":"0.5.3","pid":18402}}]
[   +2 ms] ==> [{"method":"device.enable","id":0}]
[        ] waiting for response: {method: device.enable, id: 0}
[  +14 ms] <== [{"id":0}]
[+5022 ms] executing: [./] sh -c ios-deploy -c || echo "no attached devices"
[ +122 ms] Starting flutter daemon... (completed in 5.7s)
[   +1 ms] ==> [{"method":"device.getDevices","id":1}]
[        ] waiting for response: {method: device.getDevices, id: 1}
[   +2 ms] <== [{"id":1,"result":[]}]
[   +1 ms] ==> [{"method":"emulator.getEmulators","id":2}]
[        ] waiting for response: {method: emulator.getEmulators, id: 2}
[  +32 ms] <== [{"id":2,"result":[{"id":"Nexus_10_API_28","name":"Nexus 10 API
28","category":"mobile","platformType":"android"},{"id":"Nexus_7_2012_API_25","name":"Nexus 7 (2012) API
25","category":"mobile","platformType":"android"},{"id":"PixelCAPI27","name":"PixelCAPI27","category":"mobile","platformType":"android"},{"id":"Pi
xel_2_API_25","name":"Pixel 2 API 25","category":"mobile","platformType":"android"},{"id":"Pixel_3_API_25","name":"Pixel 3 API
25","category":"mobile","platformType":"android"},{"id":"Pixel_3_XL_API_25","name":"Pixel 3 XL API
25","category":"mobile","platformType":"android"},{"id":"apple_ios_simulator","name":"iOS Simulator","category":"mobile","platformType":"ios"}]}]
[   +6 ms] daemonEmulator=id: Nexus_10_API_28, name: Nexus 10 API 28, category: mobile, platformType: android
[        ] daemonEmulator=id: Nexus_7_2012_API_25, name: Nexus 7 (2012) API 25, category: mobile, platformType: android
[        ] daemonEmulator=id: PixelCAPI27, name: PixelCAPI27, category: mobile, platformType: android
[        ] daemonEmulator=id: Pixel_2_API_25, name: Pixel 2 API 25, category: mobile, platformType: android
[        ] daemonEmulator=id: Pixel_3_API_25, name: Pixel 3 API 25, category: mobile, platformType: android
[        ] daemonEmulator=id: Pixel_3_XL_API_25, name: Pixel 3 XL API 25, category: mobile, platformType: android
[        ] daemonEmulator=id: apple_ios_simulator, name: iOS Simulator, category: mobile, platformType: ios
[  +26 ms] executing: [./] chmod u+x /tmp/screenshots/resources/script/android-wait-for-emulator
[  +11 ms] executing: [./] chmod u+x /tmp/screenshots/resources/script/android-wait-for-emulator-to-stop
[  +12 ms] executing: [./] chmod u+x /tmp/screenshots/resources/script/simulator-controller
[  +11 ms] executing: [./] chmod u+x /tmp/screenshots/resources/script/sim_orientation.scpt
[   +5 ms] Warning: using default value 'phone' in fastlane directory.
[        ] Clearing images in android/fastlane/metadata/android/en-US/images/phoneScreenshots for 'Nexus_7_2012_API_25'...
[   +7 ms] Starting Nexus_7_2012_API_25...
[   +1 ms] ==> [{"method":"emulator.launch","params":{"emulatorId":"Nexus_7_2012_API_25"},"id":3}]
[+3040 ms] <== [{"id":3}]
[+3783 ms] <== [{"event":"device.added","params":{"id":"emulator-5554","name":"Android SDK built for
x86","platform":"android-x86","emulator":true,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":"Nexus_7_2012_API_25"}}]
[  +23 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop persist.sys.locale
[  +17 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop ro.product.locale
[  +21 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop persist.sys.locale
[  +20 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop ro.product.locale
[        ] 'Nexus_7_2012_API_25' locale: en-US, test locale: en-US
[   +1 ms] ==> [{"method":"device.getDevices","id":4}]
[        ] waiting for response: {method: device.getDevices, id: 4}
[   +4 ms] <== [{"id":4,"result":[{"id":"emulator-5554","name":"Android SDK built for
x86","platform":"android-x86","emulator":true,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":"Nexus_7_2012_API_25"}]}]
[   +2 ms] daemonDevice=id: emulator-5554, name: Android SDK built for x86, category: mobile, platformType: android platform: android-x86,
emulator: true, ephemeral: true, emulatorId: Nexus_7_2012_API_25, iosModel: null
[   +1 ms] Setting orientation to LandscapeLeft
[ +338 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell settings put system user_rotation 3
[   +5 ms] Running test_driver/main.dart on 'Nexus_7_2012_API_25' in locale en-US...
[   +1 ms] executing: [./] flutter -d emulator-5554 drive test_driver/main.dart
[+1197 ms] Starting application: test_driver/main.dart
[+6949 ms] Installing build/app/outputs/apk/app.apk...                         5.5s
[+3515 ms] Running Gradle task 'assembleDebug'...                              3.4s
[+2214 ms] ✓ Built build/app/outputs/apk/debug/app-debug.apk.
[ +791 ms] D/FlutterActivity( 3698): Using the launch theme as normal theme.
[   +1 ms] D/FlutterActivityAndFragmentDelegate( 3698): Setting up FlutterEngine.
[        ] D/FlutterActivityAndFragmentDelegate( 3698): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this
FlutterFragment.
[ +916 ms] D/FlutterActivityAndFragmentDelegate( 3698): Attaching FlutterEngine to the Activity that owns this Fragment.
[   +7 ms] D/FlutterView( 3698): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@24bad79
[  +26 ms] D/FlutterActivityAndFragmentDelegate( 3698): Executing Dart entrypoint: main, and sending initial route: /
[ +111 ms] I/flutter ( 3698): Observatory listening on http://127.0.0.1:45387/IJj9BVhUDDg=/
[+2647 ms] 00:00 +0: (setUpAll)
[  +20 ms] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:57786/IJj9BVhUDDg=/
[ +175 ms] FlutterDriver: Isolate found with number: 2740393537168711
[  +62 ms] FlutterDriver: Isolate is paused at start.
[   +7 ms] FlutterDriver: Attempting to resume isolate...
[   +5 ms] FlutterDriver: Waiting for service extension...
[ +350 ms] I/flutter ( 3698): TestAssetBundleAssetManifest.json
[ +139 ms] FlutterDriver: Connected to Flutter application.
[   +3 ms] 00:00 +0: end-to-end test check flutter driver health
[  +40 ms] HealthStatus.ok
[        ] 00:00 +1: end-to-end test verify main screen
[+2710 ms] Screenshot 1_main created
[        ] 00:03 +2: end-to-end test Pose Library
[  +86 ms] I/flutter ( 3698): Library Page screen width 600.9389348488247
[+2998 ms] Screenshot 2_library created
[        ] 00:06 +3: end-to-end test Sun Salutation
[ +354 ms] I/flutter ( 3698): Library Page screen width 600.9389348488247
[+2658 ms] Screenshot 3_sun created
[        ] 00:09 +4: (tearDownAll)
[  +17 ms] 00:09 +4: All tests passed!
[  +40 ms] Stopping application instance.
[ +285 ms] Warning: 'Nexus_7_2012_API_25' images will not be processed
[        ] Warning: using default value 'phone' in fastlane directory.
[  +11 ms] Moving screenshots to android/fastlane/metadata/android/en-US/images/phoneScreenshots
[  +19 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop persist.sys.locale
[  +17 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop ro.product.locale
[        ] 'Nexus_7_2012_API_25' locale: en-US, test locale: en-US
[  +11 ms] executing: [./] /Users/phil/Library/Android/sdk/platform-tools/adb -s emulator-5554 emu kill
[+3232 ms] <== [{"event":"daemon.logMessage","params":{"level":"error","message":"Error 1 retrieving device properties for ro.product.cpu.abi:"}}]
[        ] Warning: ignoring log message: [{"event":"daemon.logMessage","params":{"level":"error","message":"Error 1 retrieving device properties
for ro.product.cpu.abi:"}}]
[        ] <== [{"event":"daemon.logMessage","params":{"level":"error","message":"error: device 'emulator-5554' not found\n"}}]
[        ] Warning: ignoring log message: [{"event":"daemon.logMessage","params":{"level":"error","message":"error: device 'emulator-5554' not
found\n"}}]
[        ] <== [{"event":"device.removed","params":{"id":"emulator-5554","name":"Android SDK built for
x86","platform":"android-arm","emulator":false,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":null}}]
[   +2 ms] ==> [{"method":"daemon.shutdown","id":5}]
[        ] waiting for response: {method: daemon.shutdown, id: 5}
[        ] <== [{"id":5}]
[ +140 ms] 

                    Screen images are available in:
[   +1 ms]   android/fastlane/metadata/android
[        ] for upload to Google console.
[        ] 
           For uploading and other automation options see:
[        ]   https://pub.dartlang.org/packages/fledge
[        ] 
           screenshots completed successfully.
mkdir -p android/fastlane/metadata/android/en-US/images/phoneScreenshots/landscape/
mv android/fastlane/metadata/android/en-US/images/phoneScreenshots/*.png android/fastlane/metadata/android/en-US/images/phoneScreenshots/landscape/

ss_land_android.yaml

# Screen capture tests
# Note: flutter driver expects a pair of files eg, main.dart and main_test.dart
tests:
  - test_driver/main.dart

# Interim location of screenshots from tests before processing
staging: /tmp/screenshots

# A list of locales supported in app
locales:
  - en-US
  # - fr-CA

# A list of devices to run tests on
devices:
  # ios:
    # iPhone 8:
    #   orientation: LandscapeLeft
    # iPhone 8 Plus:
    #   orientation: LandscapeLeft
    # # iPhone 11:
    # #   orientation: LandscapeLeft
    # iPhone Xs Max:
    #   orientation: LandscapeLeft
    # iPad Pro (11-inch):
    #   orientation: LandscapeLeft
    # iPad Pro (12.9-inch) (2nd generation):
    #   orientation: LandscapeLeft
    # iPad Pro (12.9-inch) (3rd generation):
    #   orientation: LandscapeLeft
  android:
    Nexus_7_2012_API_25:
      orientation: LandscapeLeft
    # Pixel_2_API_25:
    #   orientation: LandscapeLeft
    # Pixel_3_API_25:
    #   orientation: LandscapeLeft
    # Pixel_3_XL_API_25:
    #   orientation: LandscapeLeft
    # Nexus_10_API_28:
    #   orientation: LandscapeLeft

# Frame screenshots
frame: false

# Run mode can be one of 'normal' (default), 'recording', 'comparison' or 'archive'.

# If run mode is 'recording' or 'comparison', a directory is required for recorded images.
recording: /tmp/screenshots_record

# If not intending to upload screenshots, images can be stored in an archive dir.
# This over-rides output to fastlane dirs.
# If run mode is 'archive', a directory is required for archived images.
archive: /tmp/screenshots_archive

Any advice appreciated.

mmcc007 commented 4 years ago

Might want to try it without recording: and archive:. Also it seems to be having a problem with an older emulator Nexus_7_2012_API_25:

[+3232 ms] <== [{"event":"daemon.logMessage","params":{"level":"error","message":"Error 1 retrieving device properties for ro.product.cpu.abi:"}}]
.
.
[        ] <== [{"event":"daemon.logMessage","params":{"level":"error","message":"error: device 'emulator-5554' not found\n"}}]

Looks like emulator is crashing. So you're probably finding portrait images from another config on a previous run.

BTW: should be able to config portrait and landscape in same run:

    iPhone XS Max:
      orientation:
        - Portrait
        - LandscapeRight