-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[snapshot] When setting override_status_bar
to true
, the time in screenshot is 10:41 instead of 9:41
#22026
Comments
override_status_bar
to true, the time in screenshot is 10:41 instead of 9:41override_status_bar
to true
, the time in screenshot is 10:41 instead of 9:41
Sorry, this is a duplicate of #21464 However, I figured it out and have a work-around. AnalysisWhen using
When adding
The reason why the latter worked, was because my Simulator was already started with Simulator Status Magic enabled. So the root cause is in the ISO time stamp for parameter Work-aroundWhen manually changing the timezone in the arguments in the Snapfile the correct time is displayed in the screenshots:
However, when running Snapshot in winter, it will display the wrong time. Hence made the time zone offset dynamically in the Snapfile with some Ruby code: require 'active_support/all' # For `Time.now.formatted_offset()`
devices([
"iPhone 12 Pro",
])
# Get current timezone offset:
timezone_offset = Time.now.formatted_offset(true)
puts("timezone_offset = #{timezone_offset}") # Optional, to write to Console output
# Override status bar and override arguments incl. timezone offset, as by default it goes wrong with Daylight Saving Time (e.g. shows "10:41" instead of "9:41", see: https://github.com/fastlane/fastlane/issues/22026 )
override_status_bar true
override_status_bar_arguments "--time 2007-01-09T09:41:00#{timezone_offset} --dataNetwork wifi --wifiMode active --wifiBars 3 --cellularMode active --operatorName '' --cellularBars 4 --batteryState charged --batteryLevel 100" # For a list of commands, type the following in Terminal: xcrun simctl status_bar --help SolutionTo resolve this in code, the fastlane/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb Lines 136 to 141 in 806c80c
|
New Issue Checklist
Issue Description
I have added
override_status_bar true
to the Snapfile. When running snapshot, all screenshots have time stamp "10:41" in the Status Bar. According to the docu (fastlane action capture_screenshots
) it should be "9:41":I expect this is related to Summer Time / Day Light Saving. I'm currently in time zone CEST: Central European Summer Time.
Now comes the crazy part; I wanted to manually set the time to 9:41 via
override_status_bar_arguments
. However, I wasn't aware of the syntax, so I started simple with the--wifiBars
, by adding the following to the Snapfile:All of a sudden, not only 1 WiFi bar was shown, but also the screenshot showed "9:41" 🤔
Also tested with
"--wifiBars 3"
to get the default WiFi bar, and still the time was correct at "9:41" ✅Removing this line with
override_status_bar_arguments
, showed the wrong time ❌💡 So adding
override_status_bar_arguments "--wifiBars 3"
seems to be a work-around for this issue.Command executed
Adding property
override_status_bar true
to the Snapfile results in the wrong time on the screenshot.Complete output when running fastlane, including the stack trace and command used
Environment
The text was updated successfully, but these errors were encountered: