Sha256: 6692ae86b0e061c565a96fbb4f5fbebefe28417b6242f8190c7b15165a053b2a

Contents?: true

Size: 903 Bytes

Versions: 4

Compression:

Stored size: 903 Bytes

Contents

module Snapshot
  module Fixes
    # 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: https://github.com/fastlane/snapshot/issues/249
    # Radar: https://openradar.appspot.com/radar?id=6127019184095232

    class SimulatorZoomFix
      def self.patch
        UI.message "Patching '#{config_path}' to scale simulator to 100%"

        FastlaneCore::Simulator.all.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

      def self.config_path
        File.join(File.expand_path("~"), "Library", "Preferences", "com.apple.iphonesimulator.plist")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snapshot-1.13.1 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.13.0 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.12.3 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.12.2 lib/snapshot/fixes/simulator_zoom_fix.rb