Skip to content

Commit 33dbb58

Browse files
author
Jake Sorce
committed
spec: add selenium spec to calendar2 file refs #6986
Change-Id: Ie4f1c3622dbb0750c52dac49c65dd1ebcfb80c66 Reviewed-on: https://gerrit.instructure.com/9150 Reviewed-by: Bryan Madsen <bryan@instructure.com> Tested-by: Hudson <hudson@instructure.com>
1 parent 2dbfa74 commit 33dbb58

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

spec/selenium/calendar2_spec.rb

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
describe "calendar2" do
44
it_should_behave_like "in-process server selenium tests"
55

6+
def create_appointment_group
7+
current_date = Date.today.to_s
8+
ag = @course.appointment_groups.create(:title => "new appointment group", :context => @course, :new_appointments => [[current_date + ' 12:00:00', current_date + ' 13:00:00']])
9+
ag.publish!
10+
ag
11+
end
12+
613
before (:each) do
714
Account.default.tap { |a| a.settings[:enable_scheduler] = true; a.save }
815
end
@@ -288,13 +295,6 @@ def get_header_text
288295
EDIT_NAME = 'edited appointment'
289296
EDIT_LOCATION = 'edited location'
290297

291-
def create_appointment_group_api
292-
current_date = Date.today.to_s
293-
ag = @course.appointment_groups.create(:title => "new appointment group", :context => @course, :new_appointments => [[current_date + ' 12:00:00', current_date + ' 13:00:00']])
294-
ag.publish!
295-
ag.title
296-
end
297-
298298
def create_appointment_group_manual
299299
new_appointment_text = 'new appointment group'
300300
expect {
@@ -357,7 +357,7 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
357357
end
358358

359359
it "should delete an appointment group" do
360-
create_appointment_group_api
360+
create_appointment_group
361361
get "/calendar2"
362362
click_scheduler_link
363363

@@ -369,7 +369,7 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
369369
end
370370

371371
it "should edit an appointment group" do
372-
create_appointment_group_api
372+
create_appointment_group
373373
get "/calendar2"
374374
click_scheduler_link
375375

@@ -380,7 +380,7 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
380380
end
381381

382382
it "should edit an appointment group after clicking appointment group link" do
383-
create_appointment_group_api
383+
create_appointment_group
384384
get "/calendar2"
385385
click_scheduler_link
386386
click_appointment_link
@@ -389,7 +389,7 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
389389
end
390390

391391
it "should delete an appointment group after clicking appointment group link" do
392-
create_appointment_group_api
392+
create_appointment_group
393393
get "/calendar2"
394394
click_scheduler_link
395395
click_appointment_link
@@ -449,15 +449,15 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
449449
end
450450

451451
it "should validate the appointment group shows up on the calendar" do
452-
create_appointment_group_api
452+
create_appointment_group
453453
get "/calendar2"
454454
click_scheduler_link
455455
click_appointment_link
456456
element_exists('.fc-event-bg').should be_true
457457
end
458458

459459
it "should delete the appointment group from the calendar" do
460-
create_appointment_group_api
460+
create_appointment_group
461461
get "/calendar2"
462462
click_scheduler_link
463463
click_appointment_link
@@ -474,7 +474,7 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
474474
context "calendar2 as a student" do
475475

476476
before (:each) do
477-
course_with_student_logged_in
477+
@student = course_with_student_logged_in(:active_all => true).user
478478
end
479479

480480
describe "contexts list" do
@@ -508,6 +508,24 @@ def edit_appointment_group(appointment_name = EDIT_NAME, location_name = EDIT_LO
508508
element_exists('.edit_event_link').should be_false
509509
element_exists('.delete_event_link').should be_false
510510
end
511+
512+
it "should validate appointment group popup link functionality" do
513+
pending("bug 6986 - clicking on the name of an appointment group in a popup should take user to scheduler") do
514+
ag = create_appointment_group
515+
ag.appointments.first.reserve_for @student, @me
516+
@user = @me
517+
get "/calendar2"
518+
wait_for_ajaximations
519+
520+
driver.find_element(:css, '.fc-event-title').click
521+
popover = driver.find_element(:id, "popover-0")
522+
popover.should be_displayed
523+
expect_new_page_load { popover.find_element(:css, '.view_event_link').click }
524+
wait_for_ajaximations
525+
is_checked('#scheduler').should be_true
526+
driver.find_element(:id, 'appointment-group-list').should include_text(ag.title)
527+
end
528+
end
511529
end
512530
end
513531
end

0 commit comments

Comments
 (0)