spec: fix some brittle specs
:38 in particular has been failing a lot since the thin -> puma switch, due to an existing StaleElementError race condition ... check this stuff in a more reliable way. Change-Id: I8c3acd820b4642f32e3d76ffacd0b1585c0ef6ae Reviewed-on: https://gerrit.instructure.com/109415 Tested-by: Jenkins Reviewed-by: Landon Wilkins <lwilkins@instructure.com> Product-Review: Landon Wilkins <lwilkins@instructure.com> QA-Review: Landon Wilkins <lwilkins@instructure.com>
This commit is contained in:
parent
b384bdc98c
commit
83166e3000
|
@ -19,30 +19,29 @@ describe "scheduler" do
|
|||
before :each do
|
||||
user_session(@student1)
|
||||
make_full_screen
|
||||
get "/calendar2"
|
||||
end
|
||||
|
||||
it 'shows the find appointment button with feature flag turned on', priority: "1", test_id: 2908326 do
|
||||
get "/calendar2"
|
||||
expect(f('#select-course-component')).to contain_css("#FindAppointmentButton")
|
||||
end
|
||||
|
||||
it 'changes the Find Appointment button to a close button once the modal to select courses is closed', priority: "1", test_id: 2916527 do
|
||||
get "/calendar2"
|
||||
f('#FindAppointmentButton').click
|
||||
expect(f('.ReactModalPortal')).to contain_css('.ReactModal__Layout')
|
||||
expect(f('.ReactModal__Header').text).to include('Select Course')
|
||||
expect(f('.ReactModal__Header')).to include_text('Select Course')
|
||||
f('.ReactModal__Footer-Actions .btn').click
|
||||
expect(f('#FindAppointmentButton')).to include_text('Close')
|
||||
end
|
||||
|
||||
it 'shows appointment slots on calendar in Find Appointment mode', priority: "1", test_id: 2925320 do
|
||||
skip_if_chrome('Needs research: passes locally, but fails on Jenkins with stale element reference error ')
|
||||
get "/calendar2"
|
||||
open_select_courses_modal(@course1.name)
|
||||
# the order they come back could vary depending on whether they split
|
||||
# days, but we expect them all to be rendered
|
||||
titles = [@app1.title, @app1.title, @app3.title]
|
||||
ff('.fc-content .fc-title').sort_by(&:text).zip(titles).each do |node, title|
|
||||
expect(node).to include_text(title)
|
||||
end
|
||||
expect(ffj(".fc-content .fc-title:contains(#{@app1.title})")).to have_size(2)
|
||||
expect(ffj(".fc-content .fc-title:contains(#{@app3.title})")).to have_size(1)
|
||||
close_select_courses_modal
|
||||
|
||||
# open again to see if appointment group spanning two content appears on selecting the other course also
|
||||
|
@ -51,22 +50,13 @@ describe "scheduler" do
|
|||
end
|
||||
|
||||
it 'hides the already reserved appointment slot for the student', priority: "1", test_id: 2925694 do
|
||||
open_select_courses_modal(@course1.name)
|
||||
num_slots = ff('.fc-time').size
|
||||
@app1.appointments.first.reserve_for(@student2, @student2)
|
||||
# close and open again to reload the page
|
||||
close_select_courses_modal
|
||||
refresh_page
|
||||
get "/calendar2"
|
||||
open_select_courses_modal(@course1.name)
|
||||
expected_time = format_time_for_view(@app1.new_appointments.last.start_at)
|
||||
expect(ff('.fc-time').size).to eq(num_slots-1)
|
||||
expect(ff('.fc-content .fc-title')[0]).to include_text(@app1.title)
|
||||
actual_time = ff('.fc-time')[0].text
|
||||
expect(expected_time).to include actual_time
|
||||
expected_time = calendar_time_string(@app1.new_appointments.last.start_at)
|
||||
expect(ff('.fc-time')).to have_size(2)
|
||||
expect(f('.fc-content .fc-title')).to include_text(@app1.title)
|
||||
expect(f('.fc-time')).to include_text expected_time
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,4 +19,8 @@ module CustomDateHelpers
|
|||
datetime_string(time, :no_words)
|
||||
end.gsub(/ +/, ' ')
|
||||
end
|
||||
|
||||
def calendar_time_string(time)
|
||||
time_string(time).sub(/m\z/, "").strip
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue