class Snapshot::Fixes::SimulatorZoomFix

This fix is needed due to a bug in UI Tests that creates invalid screenshots when the simulator is not scaled to a 100% Issue: github.com/fastlane/snapshot/issues/249 Radar: openradar.appspot.com/radar?id=6127019184095232

Public Class Methods

config_path() click to toggle source
# File lib/snapshot/fixes/simulator_zoom_fix.rb, line 20
def self.config_path
  File.join(File.expand_path("~"), "Library", "Preferences", "com.apple.iphonesimulator.plist")
end
patch() click to toggle source
# File lib/snapshot/fixes/simulator_zoom_fix.rb, line 9
def self.patch
  UI.message "Patching '#{config_path}' to scale simulator to 100%"

  FastlaneCore::DeviceManager.simulators.each do |simulator|
    simulator_name = simulator.name.tr("\s", "-")
    key = "SimulatorWindowLastScale-com.apple.CoreSimulator.SimDeviceType.#{simulator_name}"

    Helper.backticks("defaults write '#{config_path}' '#{key}' '1.0'", print: $verbose)
  end
end