Sha256: f437d0d226fb5a6123f4a72dae3b6990ce34fa274c84e525867272d06c92a21f

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

module Appium
  module Core
    module Ios
      module Xcuitest
        module Device
          module Performance
            def self.add_methods
              ::Appium::Core::Device.add_endpoint_method(:start_performance_record) do
                def start_performance_record(timeout: 300_000, profile_name: 'Activity Monitor', pid: nil)
                  option = {}
                  option[:timeout] = timeout
                  option[:profileName] = profile_name
                  option[:pid] = pid if pid

                  execute_script 'mobile: startPerfRecord', option
                end
              end

              ::Appium::Core::Device.add_endpoint_method(:get_performance_record) do
                # rubocop:disable Metrics/ParameterLists
                def get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor',
                                           remote_path: nil, user: nil, pass: nil, method: 'PUT')
                  option = ::Appium::Core::Device::ScreenRecord.new(
                    remote_path: remote_path, user: user, pass: pass, method: method
                  ).upload_option

                  option[:profileName] = profile_name
                  result = execute_script 'mobile: stopPerfRecord', option

                  File.open("#{save_file_path}.zip", 'wb') { |f| f << result.unpack('m')[0] }
                end
                # rubocop:enable Metrics/ParameterLists
              end
            end
          end # module Performance
        end # module Device
      end # module Xcuitest
    end # module Ios
  end # module Core
end # module Appium

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appium_lib_core-1.7.2 lib/appium_lib_core/ios/xcuitest/device/performance.rb
appium_lib_core-1.7.1 lib/appium_lib_core/ios/xcuitest/device/performance.rb
appium_lib_core-1.7.0 lib/appium_lib_core/ios/xcuitest/device/performance.rb