33
44from time import sleep
55
6+
7+ def extractText (driver ):
8+ return driver .find_elements_by_xpath ('//android.widget.EditText' )[0 ].text
9+
610def test_send_message (driver ):
711 driver .find_element_by_accessibility_id ('send message' ).click ()
812
913 sleep (3 )
1014
11- value = driver . find_elements_by_xpath ( '//android.widget.EditText' )[ 0 ]. text
15+ value = extractText ( driver )
1216
1317 assert value != None
1418 event = json .loads (value )
1519
1620 assert event ['event_id' ] != None
1721 assert event ['level' ] == 'warning'
22+ assert event ['message' ] == 'TEST message'
23+ assert event ['extra' ]['react' ]
24+ assert event ['tags' ]['react' ]
1825
1926def test_throw_error (driver ):
2027 driver .find_element_by_accessibility_id ('throw error' ).click ()
2128 driver .relaunch_app ()
22- value = driver . find_elements_by_xpath ( '//android.widget.EditText' )[ 0 ]. text
29+ value = extractText ( driver )
2330 # the crash should have been already sent
2431 assert value is None
2532
@@ -28,10 +35,39 @@ def test_native_crash(driver):
2835 driver .find_element_by_accessibility_id ('native crash' ).click ()
2936 driver .relaunch_app ()
3037 sleep (3 )
31- value = driver . find_elements_by_xpath ( '//android.widget.EditText' )[ 0 ]. text
38+ value = extractText ( driver )
3239
3340 assert value != None
3441 event = json .loads (value )
3542
3643 assert event ['event_id' ] != None
3744 assert event ['level' ] == 'fatal'
45+
46+ def test_version (driver ):
47+ driver .find_element_by_accessibility_id ('set version' ).click ()
48+ driver .find_element_by_accessibility_id ('send message' ).click ()
49+ sleep (3 )
50+ value = extractText (driver )
51+ assert value != None
52+ event = json .loads (value )
53+ assert event ['release' ] == 'com.awesomeproject.full-1337'
54+
55+
56+ def test_release (driver ):
57+ driver .find_element_by_accessibility_id ('set release' ).click ()
58+ driver .find_element_by_accessibility_id ('send message' ).click ()
59+ sleep (3 )
60+ value = extractText (driver )
61+ assert value != None
62+ event = json .loads (value )
63+ assert event ['release' ] == 'myversion'
64+
65+
66+ def test_dist (driver ):
67+ driver .find_element_by_accessibility_id ('set dist' ).click ()
68+ driver .find_element_by_accessibility_id ('send message' ).click ()
69+ sleep (3 )
70+ value = extractText (driver )
71+ assert value != None
72+ event = json .loads (value )
73+ assert event ['dist' ] == '500'
0 commit comments