Skip to content

Commit 68f2246

Browse files
committed
Avoid race condition in system specs
1 parent 470e925 commit 68f2246

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

spec/system/messages_system_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828

2929
it 'adds the user to the collection when saving the collection' do
3030
view_inbox
31-
expect { find("[href='#{save_shared_link}'").click }.to change { collection.users.reload.include? user }.from(false).to(true)
31+
expect do
32+
find("[href='#{save_shared_link}'").click
33+
wait_for_ajax
34+
end.to change { collection.users.reload.include? user }.from(false).to(true)
3235
end
3336

3437
context 'when the collection has been deleted' do

spec/system/tasks_system_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,15 @@ def select_option(param_name, idx)
152152
find_by_id('advanced', wait: true).click
153153

154154
select_option('q_created_before_days', all_time)
155+
wait_for_ajax
155156
expect(all('.card-task-title').map(&:text)).to contain_exactly(today_task.title, last_week_task.title, all_time_task.title)
156157

157158
select_option('q_created_before_days', last_week)
159+
wait_for_ajax
158160
expect(all('.card-task-title').map(&:text)).to contain_exactly(today_task.title, last_week_task.title)
159161

160162
select_option('q_created_before_days', today)
163+
wait_for_ajax
161164
expect(all('.card-task-title').map(&:text)).to contain_exactly(today_task.title)
162165
end
163166
end

0 commit comments

Comments
 (0)