Sha256: 0ddf41bd6507c1b823a08b1bbdba94a69cb8fbc9dba1558b5afbad11403c76e2

Contents?: true

Size: 969 Bytes

Versions: 644

Compression:

Stored size: 969 Bytes

Contents

require_relative '../module'

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/fastlane/issues/2578
    # Radar: https://openradar.appspot.com/radar?id=6127019184095232

    class SimulatorZoomFix
      def self.patch
        UI.message("Patching simulators '#{config_path}' to scale 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: FastlaneCore::Globals.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

644 entries across 644 versions & 5 rubygems

Version Path
fastlane-2.226.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.225.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.224.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.223.1 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.223.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.222.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.221.1 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.221.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.220.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.219.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.218.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-security-patched-2.216.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.217.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.216.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.215.1 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.215.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-mercafacil-2.214.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.214.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.213.0 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb
fastlane-2.212.2 snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb