Class: Maze::Client::Appium::LocalClient

Inherits:
BaseClient
  • Object
show all
Defined in:
lib/maze/client/appium/local_client.rb

Constant Summary

Constants inherited from BaseClient

BaseClient::FIXTURE_CONFIG

Instance Method Summary collapse

Methods inherited from BaseClient

#attempt_start_driver, #handle_error, #initialize, #maze_address, #start_driver, #start_scenario, #start_session

Constructor Details

This class inherits a constructor from Maze::Client::Appium::BaseClient

Instance Method Details

#device_capabilitiesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/maze/client/appium/local_client.rb', line 11

def device_capabilities
  config = Maze.config
  platform = Maze::Helper.get_current_platform
  capabilities = case platform
                 when 'android'
                   {
                     'platformName' => 'Android',
                     'automationName' => 'UiAutomator2',
                     'autoGrantPermissions' => 'true',
                     'noReset' => 'true'
                   }
                 when 'ios'
                   {
                     'platformName' => 'iOS',
                     'automationName' => 'XCUITest',
                     'deviceName' => config.device_id,
                     'xcodeOrgId' => config.apple_team_id,
                     'xcodeSigningId' => 'iPhone Developer',
                     'udid' => config.device_id,
                     'noReset' => 'true',
                     'waitForQuiescence' => false,
                     'newCommandTimeout' => 0
                   }
                 when 'macos'
                   {
                     'platformName' => 'Mac'
                   }
                 else
                   raise "Unsupported platform: #{config.os}"
                 end
  common = {
    'app' => config.app,
    'os' => platform,
    'autoAcceptAlerts': 'true'
  }
  capabilities.merge! common
  capabilities.merge! JSON.parse(config.capabilities_option)
  capabilities
end

#log_run_introObject



55
56
57
# File 'lib/maze/client/appium/local_client.rb', line 55

def log_run_intro
  # Nothing to do
end

#log_run_outroObject



59
60
61
# File 'lib/maze/client/appium/local_client.rb', line 59

def log_run_outro
  # Nothing to do
end

#prepare_sessionObject



5
6
7
8
9
# File 'lib/maze/client/appium/local_client.rb', line 5

def prepare_session
  # Attempt to start the local appium server
  appium_uri = URI(Maze.config.appium_server_url)
  Maze::AppiumServer.start(address: appium_uri.host, port: appium_uri.port.to_s) if Maze.config.start_appium
end

#retry_start_driver?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/maze/client/appium/local_client.rb', line 51

def retry_start_driver?
  false
end

#stop_sessionObject



63
64
65
66
67
# File 'lib/maze/client/appium/local_client.rb', line 63

def stop_session
  super
  # Acquire and output the logs for the current session
  Maze::Runner.run_command("log show --predicate '(process == \"#{Maze.config.app}\")' --style syslog --start '#{Maze.start_time}' > #{Maze.config.app}.log")
end