Skip to content

Commit c48653a

Browse files
committed
Specs: Wait for JavaScript actions on /implement
The Score system specs are very tricky and error-prone with the current setup. Mostly, this is due to the headless Chrome browser used on CI, which has a weird race condition preventing a regular use. Until said issue is resolved, we add additional expectations (to wait for the page to finish loading). See SeleniumHQ/selenium#15273
1 parent 35932b1 commit c48653a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/system/score_system_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
allow_any_instance_of(LtiHelper).to receive(:lti_outcome_service?).and_return(lti_outcome_service?)
8585
allow(submission).to receive(:calculate_score).and_return(calculate_response)
8686
allow_any_instance_of(SubmissionsController).to receive(:send_scores).and_return(scoring_response)
87+
has_content?(exercise.files.visible.first.name_with_extension) # Wait for JsTree to finish loading
8788
click_on(I18n.t('exercises.editor.score'))
89+
has_content?(I18n.t('exercises.editor.collapse_output_sidebar')) # Wait for the output sidebar to appear
8890
wait_for_ajax
8991
wait_for_websocket
9092
end
@@ -293,7 +295,9 @@
293295
context 'when the desired runner is already in use' do
294296
before do
295297
allow(submission).to receive(:calculate_score).and_raise(Runner::Error::RunnerInUse)
298+
has_content?(exercise.files.visible.first.name_with_extension) # Wait for JsTree to finish loading
296299
click_on(I18n.t('exercises.editor.score'))
300+
has_content?(I18n.t('exercises.editor.collapse_output_sidebar')) # Wait for the output sidebar to appear
297301
wait_for_ajax
298302
wait_for_websocket
299303
end
@@ -308,7 +312,9 @@
308312
context 'when no runner is available' do
309313
before do
310314
allow(submission).to receive(:calculate_score).and_raise(Runner::Error::NotAvailable)
315+
has_content?(exercise.files.visible.first.name_with_extension) # Wait for JsTree to finish loading
311316
click_on(I18n.t('exercises.editor.score'))
317+
has_content?(I18n.t('exercises.editor.collapse_output_sidebar')) # Wait for the output sidebar to appear
312318
wait_for_ajax
313319
wait_for_websocket
314320
end

0 commit comments

Comments
 (0)