bugsnag-maze-runner 6.27.0 → 7.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/bin/download-logs +14 -16
  3. data/bin/maze-runner +53 -15
  4. data/bin/upload-app +6 -6
  5. data/lib/features/steps/breadcrumb_steps.rb +44 -14
  6. data/lib/features/steps/error_reporting_steps.rb +16 -0
  7. data/lib/features/steps/network_steps.rb +66 -6
  8. data/lib/features/steps/payload_steps.rb +23 -0
  9. data/lib/features/steps/request_assertion_steps.rb +87 -8
  10. data/lib/features/steps/runner_steps.rb +22 -0
  11. data/lib/features/steps/session_tracking_steps.rb +1 -1
  12. data/lib/features/steps/trace_steps.rb +254 -0
  13. data/lib/features/support/internal_hooks.rb +31 -84
  14. data/lib/maze/api/appium/file_manager.rb +29 -0
  15. data/lib/maze/aws_public_ip.rb +53 -0
  16. data/lib/maze/checks/assert_check.rb +9 -31
  17. data/lib/maze/client/appium/base_client.rb +131 -0
  18. data/lib/maze/client/appium/bb_client.rb +102 -0
  19. data/lib/maze/client/appium/bb_devices.rb +127 -0
  20. data/lib/maze/client/appium/bs_client.rb +91 -0
  21. data/lib/maze/client/appium/bs_devices.rb +141 -0
  22. data/lib/maze/client/appium/bs_legacy_client.rb +31 -0
  23. data/lib/maze/client/appium/local_client.rb +67 -0
  24. data/lib/maze/client/appium.rb +23 -0
  25. data/lib/maze/client/bb_api_client.rb +102 -0
  26. data/lib/maze/client/bb_client_utils.rb +181 -0
  27. data/lib/maze/client/bs_client_utils.rb +168 -0
  28. data/lib/maze/client/selenium/base_client.rb +15 -0
  29. data/lib/maze/client/selenium/bb_browsers.yml +188 -0
  30. data/lib/maze/client/selenium/bb_client.rb +38 -0
  31. data/lib/maze/client/selenium/bs_browsers.yml +257 -0
  32. data/lib/maze/client/selenium/bs_client.rb +89 -0
  33. data/lib/maze/client/selenium/local_client.rb +16 -0
  34. data/lib/maze/client/selenium.rb +16 -0
  35. data/lib/maze/configuration.rb +18 -10
  36. data/lib/maze/docker.rb +40 -1
  37. data/lib/maze/driver/appium.rb +5 -24
  38. data/lib/maze/driver/browser.rb +12 -26
  39. data/lib/maze/errors.rb +32 -0
  40. data/lib/maze/generator.rb +55 -0
  41. data/lib/maze/helper.rb +7 -3
  42. data/lib/maze/hooks/appium_hooks.rb +29 -190
  43. data/lib/maze/hooks/browser_hooks.rb +2 -55
  44. data/lib/maze/hooks/error_code_hook.rb +49 -0
  45. data/lib/maze/hooks/hooks.rb +2 -2
  46. data/lib/maze/http_request.rb +21 -0
  47. data/lib/maze/logger.rb +16 -3
  48. data/lib/maze/maze_output.rb +88 -0
  49. data/lib/maze/option/parser.rb +17 -22
  50. data/lib/maze/option/processor.rb +21 -34
  51. data/lib/maze/option/validator.rb +38 -67
  52. data/lib/maze/option.rb +16 -18
  53. data/lib/maze/plugins/cucumber_report_plugin.rb +1 -1
  54. data/lib/maze/plugins/error_code_plugin.rb +21 -0
  55. data/lib/maze/request_list.rb +10 -5
  56. data/lib/maze/request_repeater.rb +49 -0
  57. data/lib/maze/retry_handler.rb +4 -13
  58. data/lib/maze/schemas/OtelTraceSchema.json +390 -0
  59. data/lib/maze/schemas/trace_schema.rb +7 -0
  60. data/lib/maze/schemas/trace_validator.rb +98 -0
  61. data/lib/maze/server.rb +74 -30
  62. data/lib/maze/servlets/base_servlet.rb +10 -5
  63. data/lib/maze/servlets/command_servlet.rb +10 -7
  64. data/lib/maze/servlets/log_servlet.rb +2 -2
  65. data/lib/maze/servlets/reflective_servlet.rb +12 -11
  66. data/lib/maze/servlets/servlet.rb +47 -8
  67. data/lib/maze/servlets/temp.rb +0 -0
  68. data/lib/maze/servlets/trace_servlet.rb +13 -0
  69. data/lib/maze.rb +2 -2
  70. data/lib/utils/deep_merge.rb +17 -0
  71. data/lib/utils/selenium_money_patch.rb +17 -0
  72. metadata +97 -17
  73. data/lib/maze/bitbar_devices.rb +0 -84
  74. data/lib/maze/bitbar_utils.rb +0 -112
  75. data/lib/maze/browser_stack_devices.rb +0 -160
  76. data/lib/maze/browser_stack_utils.rb +0 -164
  77. data/lib/maze/browsers_bs.yml +0 -220
  78. data/lib/maze/browsers_cbt.yml +0 -100
  79. data/lib/maze/capabilities.rb +0 -126
  80. data/lib/maze/driver/resilient_appium.rb +0 -51
  81. data/lib/maze/sauce_labs_utils.rb +0 -96
  82. data/lib/maze/smart_bear_utils.rb +0 -71
@@ -1,96 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Maze
4
- # Utils supporting the SauceLabs device farm integration
5
- class SauceLabsUtils
6
- PID_FILE = 'sc.pid'
7
- READY_FILE = 'sc.ready'
8
-
9
- class << self
10
- attr_accessor :connect_shell
11
-
12
- # Uploads an app to Sauce Labs for later consumption
13
- # @param username [String] the Sauce Labs username
14
- # @param access_key [String] the Sauce Labs access key
15
- def upload_app(username, access_key, app)
16
- uuid_regex = /\A[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\z/
17
-
18
- if uuid_regex.match? app
19
- $logger.info "Using pre-uploaded app with UUID #{app}"
20
- app_uuid = app
21
- else
22
- expanded_app = Maze::Helper.expand_path(app)
23
- $logger.info "Uploading app: #{expanded_app}"
24
-
25
- # Upload the app tp Sauce Labs
26
- uri = URI('https://api.us-west-1.saucelabs.com/v1/storage/upload')
27
- request = Net::HTTP::Post.new(uri)
28
- request.basic_auth(username, access_key)
29
- request.set_form({ 'payload' => File.new(expanded_app, 'rb') }, 'multipart/form-data')
30
-
31
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
32
- http.request(request)
33
- end
34
-
35
- # Pull the UUID from the response
36
- begin
37
- response = JSON.parse res.body
38
-
39
- if response.key?('item') && response['item'].key?('id')
40
- app_uuid = response['item']['id']
41
- $logger.info "Uploaded app UUID: #{app_uuid}"
42
- $logger.info 'You can use this UUID to avoid uploading the same app more than once.'
43
- else
44
- $logger.error "Unexpected response body: #{}"
45
- raise 'App upload failed'
46
- end
47
- rescue JSON::ParserError
48
- $logger.error "Expected JSON response, received: #{body}"
49
- raise
50
- end
51
- end
52
- app_uuid
53
- end
54
-
55
- # Sauce Connect
56
- # @param sc_local [String] path to the Sauce Connect binary
57
- # @param tunnel_id [String] unique key for the tunnel instance
58
- # @param username [String] Sauce Labs username
59
- # @param access_key [String] Sauce Labs access key
60
- def start_sauce_connect(sc_local, tunnel_id, username, access_key)
61
- $logger.info 'Starting Sauce Connect tunnel'
62
- endpoint = 'https://saucelabs.com/rest/v1'
63
- wait = Maze::Wait.new(interval: 0.3, timeout: 3)
64
- connect_shell = Maze::InteractiveCLI.new
65
- success = wait.until { connect_shell.running? }
66
- raise 'Shell session did not start in time!' unless success
67
-
68
- command = "#{sc_local} -u #{username} -k #{access_key} -x #{endpoint} " \
69
- "-i #{tunnel_id} -d #{PID_FILE} -l sc.log -f #{READY_FILE}"
70
-
71
- # TODO Handle the case where the command fails, providing suitable diagnostics
72
- File.delete(READY_FILE) if File.exist?(READY_FILE)
73
- File.delete(PID_FILE) if File.exist?(PID_FILE)
74
- connect_shell.run_command command
75
- success = Maze::Wait.new(timeout: 30).until do
76
- File.exist? READY_FILE
77
- end
78
- unless success
79
- $logger.info "Failed: #{connect_shell.stdout_lines}"
80
- end
81
- end
82
-
83
- def stop_sauce_connect
84
- pid = nil
85
- File.open(PID_FILE, 'r') do |file|
86
- pid = file.read.to_i
87
- end
88
- Process.kill('INT', pid)
89
- Maze::Wait.new(timeout: 30).until do
90
- `ps aux | awk '{print $2 }' | grep #{pid}`.empty?
91
- end
92
- File.delete(PID_FILE) if File.exist?(PID_FILE)
93
- end
94
- end
95
- end
96
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Maze
4
- # Utils supporting the BrowserStack device farm integration
5
- class SmartBearUtils
6
- class << self
7
- SB_READY_FILE = 'sb.ready'
8
- SB_KILL_FILE = 'sb.kill'
9
-
10
- # Starts the SmartBear local tunnel
11
- #
12
- # @param sb_local [String] path to the SBSecureTunnel binary
13
- # @param username [String] Username to start the tunnel with
14
- # @param access_key [String] CBT access key
15
- # @param tunnel_name [String] Tunnel name
16
- def start_local_tunnel(sb_local, username, access_key, tunnel_name=nil)
17
- # Make sure the ready/kill files are already deleted
18
- File.delete(SB_READY_FILE) if File.exist?(SB_READY_FILE)
19
- File.delete(SB_KILL_FILE) if File.exist?(SB_KILL_FILE)
20
-
21
- $logger.info 'Starting CBT SBSecureTunnel'
22
- command = "#{sb_local} --username #{username} --authkey #{access_key} --acceptAllCerts " \
23
- "--ready #{SB_READY_FILE} --kill #{SB_KILL_FILE}"
24
- command << " --tunnelname #{tunnel_name}" unless tunnel_name.nil?
25
-
26
- output = start_tunnel_thread(command)
27
-
28
- success = Maze::Wait.new(timeout: 30).until do
29
- File.exist?(SB_READY_FILE)
30
- end
31
- unless success
32
- $logger.error "Failed: #{output}"
33
- end
34
- end
35
-
36
- # Stops the local tunnel
37
- def stop_local_tunnel
38
- FileUtils.touch(SB_KILL_FILE)
39
- Maze::Wait.new(timeout: 30).until do
40
- !File.exist?(SB_READY_FILE)
41
- end
42
- File.delete(SB_READY_FILE) if File.exist?(SB_READY_FILE)
43
- File.delete(SB_KILL_FILE) if File.exist?(SB_KILL_FILE)
44
- end
45
-
46
- private
47
-
48
- def start_tunnel_thread(cmd)
49
- executor = lambda do
50
- Open3.popen2e(Maze::Runner.environment, cmd) do |_stdin, stdout_and_stderr, wait_thr|
51
-
52
- output = []
53
- stdout_and_stderr.each do |line|
54
- output << line
55
- $logger.debug('SBSecureTunnel') {line.chomp}
56
- end
57
-
58
- exit_status = wait_thr.value.to_i
59
- $logger.debug "Exit status: #{exit_status}"
60
-
61
- output.each { |line| $logger.warn('SBSecureTunnel') {line.chomp} } unless exit_status == 0
62
-
63
- return [output, exit_status]
64
- end
65
- end
66
-
67
- Thread.new(&executor)
68
- end
69
- end
70
- end
71
- end