Skip to content

Commit

Permalink
Use Maze namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
twometresteve authored and fractalwrench committed Jan 20, 2021
1 parent 9f2c3ad commit b70df7b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions features/steps/android_steps.rb
Expand Up @@ -58,27 +58,27 @@
end

Then("the exception reflects a signal was raised") do
value = read_key_path(Server.current_request[:body], "events.0.exceptions.0")
value = read_key_path(Maze::Server.current_request[:body], "events.0.exceptions.0")
error_class = value["errorClass"]
assert_block("The errorClass was not from a signal: #{error_class}") do
%w[SIGFPE SIGILL SIGSEGV SIGABRT SIGTRAP SIGBUS].include? error_class
end
end
Then("the event {string} string is empty") do |keypath|
value = read_key_path(Server.current_request[:body], keypath)
value = read_key_path(Maze::Server.current_request[:body], keypath)
assert_block("The #{keypath} is not empty: '#{value}'") do
value.nil? or value.length == 0
end
end

Then("the event {string} is greater than {int}") do |keypath, int|
value = read_key_path(Server.current_request[:body], "events.0.#{keypath}")
value = read_key_path(Maze::Server.current_request[:body], "events.0.#{keypath}")
assert_false(value.nil?, "The event #{keypath} is nil")
assert_true(value > int)
end

Then("the exception {string} equals one of:") do |keypath, possible_values|
value = read_key_path(Server.current_request[:body], "events.0.exceptions.0.#{keypath}")
value = read_key_path(Maze::Server.current_request[:body], "events.0.exceptions.0.#{keypath}")
assert_includes(possible_values.raw.flatten, value)
end

Expand All @@ -87,7 +87,7 @@
# @param expected_values [Array] A table dictating the expected files and methods of the frames
# The first two entries are methods (enabling flexibility across SDKs), the third is the file name
Then("the first significant stack frame methods and files should match:") do |expected_values|
stacktrace = read_key_path(Server.current_request[:body], "events.0.exceptions.0.stacktrace")
stacktrace = read_key_path(Maze::Server.current_request[:body], "events.0.exceptions.0.stacktrace")
expected_frame_values = expected_values.raw
significant_frames = stacktrace.each_with_index.map do |frame, index|
method = `c++filt -_ _#{frame["method"]}`.chomp
Expand Down Expand Up @@ -158,7 +158,7 @@
And the report contains the required fields
And the stacktrace contains native frame information
}
stack = read_key_path(Server.current_request[:body], "events.0.exceptions.0.stacktrace")
stack = read_key_path(Maze::Server.current_request[:body], "events.0.exceptions.0.stacktrace")
stack.each_with_index do |frame, index|
assert_not_nil(frame['symbolAddress'], "The symbolAddress of frame #{index} is nil")
assert_not_nil(frame['frameAddress'], "The frameAddress of frame #{index} is nil")
Expand All @@ -177,7 +177,7 @@

Then("the stacktrace contains native frame information") do
step("the payload field \"events.0.exceptions.0.stacktrace\" is a non-empty array")
stack = read_key_path(Server.current_request[:body], "events.0.exceptions.0.stacktrace")
stack = read_key_path(Maze::Server.current_request[:body], "events.0.exceptions.0.stacktrace")
stack.each_with_index do |frame, index|
assert_not_nil(frame['method'], "The method of frame #{index} is nil")
assert_not_nil(frame['lineNumber'], "The lineNumber of frame #{index} is nil")
Expand Down Expand Up @@ -207,12 +207,12 @@
end

Then("the event has {int} breadcrumbs") do |expected_count|
value = Server.current_request[:body]["events"].first["breadcrumbs"]
value = Maze::Server.current_request[:body]["events"].first["breadcrumbs"]
fail("Incorrect number of breadcrumbs found: #{value.length()}, expected: #{expected_count}") if value.length() != expected_count.to_i
end

Then("the event has a {string} breadcrumb with the message {string}") do |type, message|
value = read_key_path(Server.current_request[:body], "events.0.breadcrumbs")
value = read_key_path(Maze::Server.current_request[:body], "events.0.breadcrumbs")
found = false
value.each do |crumb|
if crumb["type"] == type and crumb["name"] == message
Expand All @@ -233,7 +233,7 @@ def click_if_present(element)

# Temporary workaround until PLAT-4845 is implemented
Then("I sort the requests by {string}") do |comparator|
Server.stored_requests.sort_by! { |request|
Maze::Server.stored_requests.sort_by! { |request|
read_key_path(request[:body], comparator)
}
end

0 comments on commit b70df7b

Please sign in to comment.