Skip to content

Commit

Permalink
test(react-native): skip JS stack frame assertion on new architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
yousif-bugsnag committed Aug 21, 2024
1 parent 27229d6 commit 0a45b7d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
12 changes: 10 additions & 2 deletions test/react-native/features/native-stack.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ Scenario: Handled JS error with native stacktrace
| runScenario |

# the javascript part follows
And the stacktrace contains "file" equal to "index.android.bundle"
And the stacktrace contains "file" equal to the version-dependent string:
| arch | version | value |
| new | 0.74 | @skip |
| new | default | @skip |
| old | default | index.android.bundle |

# Skipped pending PLAT-12193
@android_only @skip_new_arch_below_074
Expand Down Expand Up @@ -66,7 +70,11 @@ Scenario: Unhandled JS error with native stacktrace
| runScenario |

# the javascript part follows
And the stacktrace contains "file" equal to "index.android.bundle"
And the stacktrace contains "file" equal to the version-dependent string:
| arch | version | value |
| new | 0.74 | @skip |
| new | default | @skip |
| old | default | index.android.bundle |

# # PLAT-5117 addresses float serialization
# And the error payload field "events.0.exceptions.1.stacktrace.0.lineNumber" equals 1
Expand Down
29 changes: 23 additions & 6 deletions test/react-native/features/steps/react-native-steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,30 @@ def get_app_state
Then('the event {string} equals the version-dependent string:') do |field_path, table|
payload = Maze::Server.errors.current[:body]
payload_value = Maze::Helper.read_key_path(payload, "events.0.#{field_path}")
expected_values = table.hashes

expected_value = get_value_for_arch_and_version(table)

unless expected_value.eql?('@skip')
assert_equal_with_nullability(expected_value, payload_value)
end
end

Then('the stacktrace contains {string} equal to the version-dependent string:') do |field_path, table|
expected_value = get_value_for_arch_and_version(table)

unless expected_value.eql?('@skip')
values = Maze::Helper.read_key_path(Maze::Server.errors.current[:body], "events.0.exceptions.0.stacktrace")
found = false
values.each do |frame|
found = true if Maze::Helper.read_key_path(frame, field_path) == expected_value
end
fail("No field_path #{field_path} found with value #{expected_value}") unless found
end
end

def get_value_for_arch_and_version(table)
expected_values = table.hashes

arch = ENV['RCT_NEW_ARCH_ENABLED'] == 'true' ? 'new' : 'old'
arch_values = expected_values.select do |hash|
hash['arch'] == arch
Expand All @@ -190,9 +211,5 @@ def get_app_state
raise("There is no expected value for the current version \"#{current_version}\"") if version_values.empty?
raise("Multiple expected values found for arch \"#{arch}\" and version \"#{current_version}\"") if version_values.length() > 1

expected_value = version_values[0]['value']

unless expected_value.eql?('@skip')
assert_equal_with_nullability(expected_value, payload_value)
end
return version_values[0]['value']
end

0 comments on commit 0a45b7d

Please sign in to comment.