From f229eff91d046ec2e6de11c15b0102f8ab4ffcd2 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Mon, 15 Mar 2021 15:50:39 -0700 Subject: [PATCH] Set automatic simulator rotation in scenario test (flutter/engine#24985) --- engine/src/flutter/testing/scenario_app/README.md | 7 +++++++ engine/src/flutter/testing/scenario_app/run_ios_tests.sh | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/engine/src/flutter/testing/scenario_app/README.md b/engine/src/flutter/testing/scenario_app/README.md index 23685c4dee8..d3b06198ca8 100644 --- a/engine/src/flutter/testing/scenario_app/README.md +++ b/engine/src/flutter/testing/scenario_app/README.md @@ -30,6 +30,13 @@ platform channel. For PlatformView tests on iOS, you'll also have to edit the dictionaries in [AppDelegate.m](https://github.com/flutter/engine/blob/5d9509ae056b04c30295df27f201f31af9777842/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m#L29) and [PlatformViewGoldenTestManager.m](https://github.com/flutter/engine/blob/5d9509ae056b04c30295df27f201f31af9777842/testing/scenario_app/ios/Scenarios/ScenariosUITests/PlatformViewGoldenTestManager.m#L24) so that the correct golden image can be found. Also, you'll have to add a [GoldenPlatformViewTests](https://github.com/flutter/engine/blob/5d9509ae056b04c30295df27f201f31af9777842/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenPlatformViewTests.h#L18) in [PlatformViewUITests.m](https://github.com/flutter/engine/blob/af2ffc02b72af2a89242ca3c89e18269b1584ce5/testing/scenario_app/ios/Scenarios/ScenariosUITests/PlatformViewUITests.m). +If `PlatformViewRotation` is failing, make sure Simulator app Device > Rotate Device Automatically +is selected, or run: + +```bash +defaults write com.apple.iphonesimulator RotateWindowWhenSignaledByGuest -int 1 +``` + ### Generating Golden Images on iOS Screenshots are saved as diff --git a/engine/src/flutter/testing/scenario_app/run_ios_tests.sh b/engine/src/flutter/testing/scenario_app/run_ios_tests.sh index 13a8e3cd60a..e6357ce3c19 100755 --- a/engine/src/flutter/testing/scenario_app/run_ios_tests.sh +++ b/engine/src/flutter/testing/scenario_app/run_ios_tests.sh @@ -33,6 +33,10 @@ if [[ $# -eq 1 ]]; then FLUTTER_ENGINE="$1" fi +# Make sure simulators rotate automatically for "PlatformViewRotation" test. +# Can also be set via Simulator app Device > Rotate Device Automatically +defaults write com.apple.iphonesimulator RotateWindowWhenSignaledByGuest -int 1 + cd ios/Scenarios set -o pipefail && xcodebuild -sdk iphonesimulator \ -scheme Scenarios \