@@ -177,20 +177,26 @@ def _test_candid_ui_handler(page):
177
177
_set_text (page , 'text' , text )
178
178
_click_button (page , 'Query' )
179
179
180
+ # Check if `#output-list` is populated correctly (after the first click)
181
+ output_list_id = '#output-list'
182
+ timeout_ms = 60000
183
+ _ = page .wait_for_selector (output_list_id , timeout = timeout_ms )
184
+
180
185
# Reset the text & Click the "Random" button
181
186
_set_text (page , 'text' , '' )
182
187
_click_button (page , 'Random' )
183
188
# ~
184
189
185
- # Check if `#output-list` is populated correctly
186
- output_list_id = '#output-list'
187
- timeout_ms = 60000
190
+ # Check if `#output-list` is populated correctly (after the second click)
188
191
output_list_obj = page .wait_for_selector (output_list_id , timeout = timeout_ms )
189
192
if output_list_obj :
190
193
output_list_lines = output_list_obj .inner_text ().split ('\n ' )
191
194
actual_num_lines , expected_num_lines = len (output_list_lines ), 4
192
195
if actual_num_lines != expected_num_lines :
193
- raise RuntimeError (f'Expected { expected_num_lines } lines of text but found { actual_num_lines } ' )
196
+ err = [f'Expected { expected_num_lines } lines of text but found { actual_num_lines } ' ]
197
+ err .append ('Lines:' )
198
+ err .extend (output_list_lines )
199
+ raise RuntimeError ('\n ' .join (err ))
194
200
195
201
# Extract random text from third line
196
202
random_text = re .search (r'"([^"]*)"' , output_list_lines [2 ])
0 commit comments