diff --git a/test/react-native/features/native-stack.feature b/test/react-native/features/native-stack.feature index 5afe74ff3..ad96f0084 100644 --- a/test/react-native/features/native-stack.feature +++ b/test/react-native/features/native-stack.feature @@ -1,7 +1,7 @@ Feature: Native stacktrace is parsed for promise rejections # Skipped pending PLAT-12193 -@android_only @skip_new_arch +@android_only @skip_new_arch_below_074 Scenario: Handled JS error with native stacktrace When I run "NativeStackHandledScenario" Then I wait to receive an error @@ -29,10 +29,14 @@ 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 +@android_only @skip_new_arch_below_074 Scenario: Unhandled JS error with native stacktrace When I run "NativeStackUnhandledScenario" Then I wait to receive an error @@ -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 diff --git a/test/react-native/features/steps/react-native-steps.rb b/test/react-native/features/steps/react-native-steps.rb index 58aa3bc78..b33ced826 100644 --- a/test/react-native/features/steps/react-native-steps.rb +++ b/test/react-native/features/steps/react-native-steps.rb @@ -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 @@ -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