@@ -57,9 +57,31 @@ def test_dist(driver):
5757def test_throw_error (driver ):
5858 driver .find_element_by_accessibility_id ('throw error' ).click ()
5959 driver .relaunch_app ()
60+ sleep (3 )
6061 value = extractText (driver )
61- # the crash should have been already sent
62- assert value is None
62+ assert value != None
63+ event = json .loads (value )
64+
65+ assert len (event ['breadcrumbs' ]) > 0
66+ assert len (event ['contexts' ]) > 0
67+ for thread in event ['exception' ]['values' ]:
68+ assert len (thread ['stacktrace' ]['frames' ]) > 0
69+ cocoa_frames = 0
70+ js_frames = 0
71+ for frame in thread ['stacktrace' ]['frames' ]:
72+ if frame .get ('package' , None ):
73+ cocoa_frames += 1
74+ if frame .get ('platform' , None ) == 'javascript' :
75+ js_frames += 1
76+ assert js_frames > 0
77+ assert len (event ['exception' ]['values' ]) > 0
78+ assert event ['exception' ]['values' ][0 ]['value' ] == "Sentry: Test throw error"
79+ assert event ['exception' ]['values' ][0 ]['type' ] == "Error"
80+ assert event ['platform' ] == 'cocoa'
81+ assert event ['level' ] == 'fatal'
82+ assert event ['extra' ]['react' ]
83+ assert event ['tags' ]['react' ] == '1'
84+ assert len (event ['user' ]) > 0
6385
6486def test_native_crash (driver ):
6587 sleep (2 )
@@ -74,20 +96,19 @@ def test_native_crash(driver):
7496 assert len (event ['breadcrumbs' ]) > 0
7597 assert len (event ['contexts' ]) > 0
7698 assert len (event ['threads' ]['values' ]) > 0
77- for thread in event ['threads' ]['values' ]:
78- if thread ['crashed' ]:
79- assert len (thread ['stacktrace' ]['frames' ]) > 0
80- cocoa_frames = 0
81- js_frames = 0
82- for frame in thread ['stacktrace' ]['frames' ]:
83- if frame .get ('package' , None ):
84- cocoa_frames += 1
85- if frame .get ('platform' , None ) == 'javascript' :
86- js_frames += 1
87- assert cocoa_frames > 0
88- assert js_frames > 0 # does not work in release build
99+ for thread in event ['exception' ]['values' ]:
100+ assert len (thread ['stacktrace' ]['frames' ]) > 0
101+ cocoa_frames = 0
102+ js_frames = 0
103+ for frame in thread ['stacktrace' ]['frames' ]:
104+ if frame .get ('package' , None ):
105+ cocoa_frames += 1
106+ if frame .get ('platform' , None ) == 'javascript' :
107+ js_frames += 1
108+ assert cocoa_frames > 0
89109 assert len (event ['exception' ]['values' ]) > 0
90110 assert len (event ['debug_meta' ]['images' ]) > 0
111+ assert event ['exception' ]['values' ][0 ]['value' ] == 'crash'
91112 assert event ['platform' ] == 'cocoa'
92113 assert event ['level' ] == 'fatal'
93114 assert event ['extra' ]['react' ]
0 commit comments