Sha256: 17eccb228a82a1b7f205b10c66bf8fd50e48d419aa873654cff17669a9b37d7a

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

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
        # First we need to kill the simulator
        Snapshot.kill_simulator

        Helper.log.debug "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}"

          command = "defaults write '#{config_path}' '#{key}' '1.0'"
          puts command.yellow if $debug
          `#{command}`
        end
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
snapshot-1.6.0 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.5.0 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.4.4 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.4.3 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.4.2 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.4.1 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.4.0 lib/snapshot/fixes/simulator_zoom_fix.rb
snapshot-1.3.0 lib/snapshot/fixes/simulator_zoom_fix.rb