bugsnag-maze-runner 7.27.0 → 7.29.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2158a5376e4ff1d6c63a70eb138c33a2021aa7baff47f28882821e62a09fd0f
4
- data.tar.gz: cd74c9cc69173584b6bf4c28a7fbaffdc3e115db09b38bfc507242f14726689e
3
+ metadata.gz: a557d4bf1f5d2518fef4116fe4bceecc5b28f78d585ab0926296105e5284ff49
4
+ data.tar.gz: 6e2c3eed0f98e66d586c64186a77917bb93aa4dbb7f2e0704ab42fa4abb05eb6
5
5
  SHA512:
6
- metadata.gz: 541182a68461d87cb7e2dd118cb6418fec9c4f3f2624622673ea12d16e695b81fd10ad6398e6a04c1446096a4c67e0b067f003687d326053258c20c77fc3e0cb
7
- data.tar.gz: f033d06ba478c06163397026626b180cabdcbf7f2b246878d7415905c0af8a3ca46c26a044dbbf111599cc0860445ace5c8eb89b74d3a0f1d94cb9be907e2573
6
+ metadata.gz: 194edc4175cb7e7d9c2816d749e2b97a56b97885511762345d2ecdce4c07be4bf2a9de82415f26c127f20b8a1fc5fa0256e84ffcedff74eaf5ad4d017c006f19
7
+ data.tar.gz: c2a7a1998c8c2fa628165f1961483e0986942be71ad599e72aad19351984a27c6284007037f7779834fd16e43f3905f8b316d2a1742546c90234f999bd734f1e
@@ -44,12 +44,6 @@ BeforeAll do
44
44
  Maze.run_uuid = SecureRandom.uuid
45
45
  $logger.info "UUID for this run: #{Maze.run_uuid}"
46
46
 
47
- # Determine public IP if enabled
48
- if Maze.config.aws_public_ip
49
- Maze.public_address = Maze::AwsPublicIp.new.address
50
- $logger.info "Public address: #{Maze.public_address}"
51
- end
52
-
53
47
  # Start mock server
54
48
  Maze::Server.start
55
49
  Maze::Server.set_response_delay_generator(Maze::Generator.new [Maze::Server::DEFAULT_RESPONSE_DELAY].cycle)
@@ -66,6 +60,18 @@ BeforeAll do
66
60
  # This must happen after any client hooks have run, so that they can set the server root
67
61
  Maze::DocumentServer.start unless Maze.config.document_server_root.nil?
68
62
 
63
+ # Determine public IP if enabled
64
+ if Maze.config.aws_public_ip
65
+ public_ip = Maze::AwsPublicIp.new
66
+ Maze.public_address = public_ip.address
67
+ $logger.info "Public address: #{Maze.public_address}"
68
+
69
+ unless Maze.config.document_server_root.nil?
70
+ Maze.public_document_server_address = public_ip.document_server_address
71
+ $logger.info "Public document server address: #{Maze.public_document_server_address}"
72
+ end
73
+ end
74
+
69
75
  # An initial setup for total success status
70
76
  $success = true
71
77
  end
@@ -1,16 +1,31 @@
1
1
  module Maze
2
2
  # Determines the public IP address and port when running on Buildkite with the Elastic CI Stack for AWS
3
3
  class AwsPublicIp
4
- attr_reader :address
4
+ attr_reader :host
5
+ attr_reader :port
6
+ attr_reader :document_server_port
7
+
8
+ def address
9
+ "#{@ip}:#{@port}"
10
+ end
11
+
12
+ def document_server_address
13
+ return nil if @document_server_port.nil?
14
+
15
+ "#{@ip}:#{@document_server_port}"
16
+ end
5
17
 
6
18
  def initialize
7
19
  # This class is only relevant on Buildkite
8
20
  return unless ENV['BUILDKITE']
9
21
 
10
- ip = determine_public_ip
11
- port = determine_public_port
22
+ @ip = determine_public_ip
23
+ @port = determine_public_port Maze.config.port
24
+
25
+ unless Maze.config.document_server_root.nil?
26
+ @document_server_port = determine_public_port Maze.config.document_server_port
27
+ end
12
28
 
13
- @address = "#{ip}:#{port}"
14
29
  end
15
30
 
16
31
  # Determines the public IP address of the running AWS instance
@@ -20,8 +35,9 @@ module Maze
20
35
  `curl --silent -XGET http://169.254.169.254/latest/meta-data/public-ipv4`
21
36
  end
22
37
 
23
- # Determines the external port of the running Docker container that's associated with the port of the mock server
24
- def determine_public_port
38
+ # Determines the external port of the running Docker container that's associated with the port given
39
+ # @param local_port Local port to find the external port for
40
+ def determine_public_port(local_port)
25
41
  port = 0
26
42
  count = 0
27
43
  max_attempts = 30
@@ -35,7 +51,7 @@ module Maze
35
51
  begin
36
52
  json_string = result[0][0].strip
37
53
  json_result = JSON.parse(json_string)
38
- port = json_result['NetworkSettings']['Ports']["#{Maze.config.port}/tcp"][0]['HostPort']
54
+ port = json_result['NetworkSettings']['Ports']["#{local_port}/tcp"][0]['HostPort']
39
55
  rescue StandardError
40
56
  $logger.error "Unable to parse public port from: #{json_string}"
41
57
  return 0
@@ -6,7 +6,7 @@ module Maze
6
6
  config = Maze.config
7
7
  config.app = Maze::Client::BitBarClientUtils.upload_app config.access_key,
8
8
  config.app
9
- if Maze.config.start_tunnel
9
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
10
10
  Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
11
11
  config.username,
12
12
  config.access_key
@@ -26,19 +26,19 @@ module Maze
26
26
 
27
27
  def device_capabilities
28
28
  config = Maze.config
29
+ prefix = BitBarDevices.caps_prefix(config.appium_version)
29
30
  capabilities = {
30
- 'noReset' => true,
31
+ "#{prefix}noReset" => true,
32
+ "#{prefix}newCommandTimeout" => 0,
31
33
  'bitbar:options' => {
32
34
  # Some capabilities probably belong in the top level
33
35
  # of the hash, but BitBar picks them up from here.
34
36
  'apiKey' => config.access_key,
35
37
  'app' => config.app,
36
38
  'findDevice' => false,
37
- 'testTimeout' => 7200,
38
- 'newCommandTimeout' => 0
39
+ 'testTimeout' => 7200
39
40
  }
40
41
  }
41
- capabilities['appiumVersion'] = config.appium_version unless config.appium_version.nil?
42
42
  capabilities.deep_merge! dashboard_capabilities
43
43
  capabilities.deep_merge! BitBarDevices.get_available_device(config.device)
44
44
  capabilities.deep_merge! JSON.parse(config.capabilities_option)
@@ -61,7 +61,7 @@ module Maze
61
61
 
62
62
  def stop_session
63
63
  super
64
- if Maze.config.start_tunnel
64
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
65
65
  Maze::Client::BitBarClientUtils.stop_local_tunnel
66
66
  end
67
67
  end
@@ -40,6 +40,8 @@ module Maze
40
40
  Maze.config.os = platform
41
41
  Maze.config.os_version = platform_version.to_f.floor
42
42
 
43
+ prefix = caps_prefix(Maze.config.appium_version)
44
+
43
45
  case platform
44
46
  when 'android'
45
47
  automation_name = if platform_version.start_with?('5')
@@ -49,7 +51,7 @@ module Maze
49
51
  end
50
52
  make_android_hash(device_name, automation_name)
51
53
  when 'ios'
52
- make_ios_hash(device_name)
54
+ make_ios_hash(device_name, prefix)
53
55
  else
54
56
  throw "Invalid device platform specified #{platform}"
55
57
  end
@@ -108,18 +110,21 @@ module Maze
108
110
  hash.freeze
109
111
  end
110
112
 
111
- def make_ios_hash(device)
113
+ def make_ios_hash(device, prefix='')
112
114
  {
113
115
  'automationName' => 'XCUITest',
114
116
  'deviceName' => 'iPhone device',
115
117
  'platformName' => 'iOS',
118
+ "#{prefix}shouldTerminateApp" => 'true',
116
119
  'bitbar:options' => {
117
- 'noReset' => 'true',
118
- 'shouldTerminateApp' => 'true',
119
120
  'device' => device
120
121
  }
121
122
  }.freeze
122
123
  end
124
+
125
+ def caps_prefix(appium_version)
126
+ appium_version.nil? || (appium_version.to_i < 2) ? '' : 'appium:'
127
+ end
123
128
  end
124
129
  end
125
130
  end
@@ -123,6 +123,10 @@ module Maze
123
123
  end
124
124
  end
125
125
 
126
+ def use_local_tunnel?
127
+ Maze.config.start_tunnel && !Maze.config.aws_public_ip
128
+ end
129
+
126
130
  # Starts the BitBar local tunnel
127
131
  #
128
132
  # @param sb_local [String] path to the SBSecureTunnel binary
@@ -4,11 +4,6 @@ module Maze
4
4
  class BitBarClient < BaseClient
5
5
  def start_session
6
6
  config = Maze.config
7
- if ENV['BUILDKITE']
8
- credentials = Maze::Client::BitBarClientUtils.account_credentials config.tms_uri
9
- config.username = credentials[:username]
10
- config.access_key = credentials[:access_key]
11
- end
12
7
  capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
13
8
  capabilities['bitbar_apiKey'] = config.access_key
14
9
  browsers = YAML.safe_load(File.read("#{__dir__}/bb_browsers.yml"))
@@ -16,9 +11,16 @@ module Maze
16
11
  capabilities.merge! JSON.parse(config.capabilities_option)
17
12
  config.capabilities = capabilities
18
13
 
19
- Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
20
- config.username,
21
- config.access_key
14
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
15
+ if ENV['BUILDKITE']
16
+ credentials = Maze::Client::BitBarClientUtils.account_credentials config.tms_uri
17
+ capabilities['bitbar_apiKey'] = credentials[:access_key]
18
+ end
19
+
20
+ Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
21
+ config.username,
22
+ config.access_key
23
+ end
22
24
 
23
25
  selenium_url = Maze.config.selenium_server_url
24
26
  Maze.driver = Maze::Driver::Browser.new :remote, selenium_url, config.capabilities
@@ -36,8 +38,10 @@ module Maze
36
38
 
37
39
  def stop_session
38
40
  super
39
- Maze::Client::BitBarClientUtils.stop_local_tunnel
40
- Maze::Client::BitBarClientUtils.release_account(Maze.config.tms_uri) if ENV['BUILDKITE']
41
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
42
+ Maze::Client::BitBarClientUtils.stop_local_tunnel
43
+ Maze::Client::BitBarClientUtils.release_account(Maze.config.tms_uri) if ENV['BUILDKITE']
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -48,6 +48,12 @@ edge_80:
48
48
  os: "windows"
49
49
  os_version: "11"
50
50
 
51
+ edge_latest:
52
+ browser: "edge"
53
+ browser_version: "latest"
54
+ os: "windows"
55
+ os_version: "11"
56
+
51
57
  safari_6:
52
58
  browserName: "safari"
53
59
  browserVersion: "6"
@@ -80,6 +80,7 @@ module Maze
80
80
  config.username = options[Maze::Option::USERNAME]
81
81
  config.access_key = options[Maze::Option::ACCESS_KEY]
82
82
  config.tms_uri = options[Maze::Option::TMS_URI]
83
+ config.appium_version = options[Maze::Option::APPIUM_VERSION]
83
84
  device_option = options[Maze::Option::DEVICE]
84
85
  if device_option.nil? || device_option.empty?
85
86
  # BitBar Web
data/lib/maze.rb CHANGED
@@ -7,10 +7,11 @@ require_relative 'maze/timers'
7
7
  # Glues the various parts of MazeRunner together that need to be accessed globally,
8
8
  # providing an alternative to the proliferation of global variables or singletons.
9
9
  module Maze
10
- VERSION = '7.27.0'
10
+ VERSION = '7.29.0'
11
11
 
12
12
  class << self
13
- attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, :run_uuid
13
+ attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
14
+ :public_document_server_address, :run_uuid
14
15
 
15
16
  def config
16
17
  @config ||= Maze::Configuration.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag-maze-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.27.0
4
+ version: 7.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber