Quiz -VDD - Quiz index and show page for various roles
The commit tests the index page and show page for a quiz with multiple due dates for various roles. The roles include student in the main section, student in the additional section, ta, and observer associated to student in the additional section. Observer associated to both the students in the main section and additional section is currently not working as expected(I think a bug has been already raised for this). The rest is working fine. Change-Id: I7c5852b9692b29d4de5e36cb51cc0669e7d2b37a Reviewed-on: https://gerrit.instructure.com/55391 Tested-by: Jenkins Reviewed-by: Derek Hansen <dhansen@instructure.com> Product-Review: Derek Hansen <dhansen@instructure.com> QA-Review: Derek Hansen <dhansen@instructure.com>
This commit is contained in:
parent
63bf93a3f7
commit
f3921c3d1a
|
@ -111,5 +111,24 @@ module AssignmentOverridesSeleniumHelper
|
|||
@user = user
|
||||
end
|
||||
|
||||
def add_user_specific_due_date_override(assignment, opts = {})
|
||||
user = @user
|
||||
new_section = @course.course_sections.create!(:name => 'New Section')
|
||||
student_in_section(new_section)
|
||||
override = assignment.assignment_overrides.build
|
||||
override.set = new_section
|
||||
override.due_at = opts.fetch(:due_at, Time.zone.now.advance(days:3))
|
||||
override.due_at_overridden = true
|
||||
override.lock_at = opts.fetch(:lock_at, Time.zone.now.advance(days:3))
|
||||
override.lock_at_overridden = true
|
||||
override.unlock_at = opts.fetch(:unlock_at, Time.zone.now.advance(days:-1))
|
||||
override.unlock_at_overridden = true
|
||||
override.save!
|
||||
@user = user
|
||||
@override = override
|
||||
@new_section = new_section
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
|
||||
|
||||
describe "quizzes attempts" do
|
||||
include AssignmentOverridesSeleniumHelper
|
||||
include_examples "quizzes selenium tests"
|
||||
before :all do
|
||||
@student2 = user_with_pseudonym(:username => 'student2@example.com', :active_all => 1)
|
||||
@observer2 = user_with_pseudonym(:username => 'observer2@example.com', :active_all => 1)
|
||||
@course1 = course_model
|
||||
@course1.offer!
|
||||
@quiz = create_quiz_with_default_due_dates
|
||||
add_user_specific_due_date_override(@quiz, :due_at => Time.zone.now.advance(days: 3),
|
||||
:unlock_at => Time.zone.now.advance(days:1),
|
||||
:lock_at => Time.zone.now.advance(days:4))
|
||||
student_in_section(@new_section, :user => @student2)
|
||||
end
|
||||
|
||||
it "should show the correct VDD for observer in additional section", test_id: 114315, priority: 1 do
|
||||
# enroll observer in the course in additional section
|
||||
@course1.enroll_user(@observer2, 'ObserverEnrollment', :enrollment_state => 'active',
|
||||
:associated_user_id => @student2.id)
|
||||
course_with_observer_logged_in(:user => @observer2, :course => @course1)
|
||||
get "/courses/#{@course1.id}/quizzes"
|
||||
|
||||
# expect quiz show page to show the correct VDD
|
||||
expect_new_page_load { f("#summary_quiz_#{@quiz.id}").click }
|
||||
due_at_time = @override.due_at.strftime('%b %-d at %-l:%M') << @override.due_at.strftime('%p').downcase
|
||||
unlock_at_time = @override.unlock_at.strftime('%b %-d at %-l:%M') << @override.unlock_at.strftime('%p').downcase
|
||||
lock_at_time = @override.lock_at.strftime('%b %-d at %-l:%M') << @override.lock_at.strftime('%p').downcase
|
||||
expect(f("#quiz_student_details").text).to include("Due #{due_at_time}")
|
||||
expect(f("#quiz_student_details").text).to include("Available #{unlock_at_time} - #{lock_at_time}")
|
||||
expect(f("#quiz_show").text).to include("This quiz is locked until #{unlock_at_time}")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
|
||||
|
||||
describe "quizzes attempts" do
|
||||
include AssignmentOverridesSeleniumHelper
|
||||
include_examples "quizzes selenium tests"
|
||||
before :all do
|
||||
@student1 = user_with_pseudonym(:username => 'student1@example.com', :active_all => 1)
|
||||
@student2 = user_with_pseudonym(:username => 'student2@example.com', :active_all => 1)
|
||||
@observer1 = user_with_pseudonym(:username => 'observer1@example.com', :active_all => 1)
|
||||
@course1 = course_with_student_logged_in(:user => @student1, :active_all => 1, :course_name => 'course1').course
|
||||
@quiz = create_quiz_with_default_due_dates
|
||||
add_user_specific_due_date_override(@quiz, :due_at => Time.zone.now.advance(days: 3),
|
||||
:unlock_at => Time.zone.now.advance(days:1),
|
||||
:lock_at => Time.zone.now.advance(days:4))
|
||||
end
|
||||
|
||||
it "should show the due dates for observer linked to both students", test_id: 114315, priority: 1 do
|
||||
# enroll student in additional section
|
||||
# link observer to the student in main section and to the student in additional section
|
||||
student_in_section(@new_section, :user => @student2)
|
||||
@course1.enroll_user(@observer1, 'ObserverEnrollment', :enrollment_state => 'active',
|
||||
:associated_user_id => @student1.id)
|
||||
@course1.enroll_user(@observer1, 'ObserverEnrollment', :enrollment_state => 'active',
|
||||
:allow_multiple_enrollments => true, :associated_user_id => @student2.id)
|
||||
user_session(@observer1)
|
||||
get "/courses/#{@course1.id}/quizzes"
|
||||
|
||||
# expect to find 'Multiple due dates' to show in quiz index page
|
||||
lock_at_time = @quiz.lock_at.strftime('%b %-d')
|
||||
unlock_at_time = @override.unlock_at.strftime('%b %-d')
|
||||
driver.mouse.move_to fln('Multiple Dates')
|
||||
keep_trying_until do
|
||||
expect(f("#ui-tooltip-0")).to
|
||||
include_text("Everyone else\nAvailable until #{lock_at_time}\nNew Section\nNot available until #{unlock_at_time}")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
|
||||
|
||||
describe "quizzes attempts" do
|
||||
include AssignmentOverridesSeleniumHelper
|
||||
include_examples "quizzes selenium tests"
|
||||
before :all do
|
||||
@student2 = user_with_pseudonym(:username => 'student2@example.com', :active_all => 1)
|
||||
@course1 = course_model
|
||||
@course1.offer!
|
||||
@quiz = create_quiz_with_default_due_dates
|
||||
add_user_specific_due_date_override(@quiz, :due_at => Time.zone.now.advance(days: 3),
|
||||
:unlock_at => Time.zone.now.advance(days:1),
|
||||
:lock_at => Time.zone.now.advance(days:4))
|
||||
student_in_section(@new_section, :user => @student2)
|
||||
end
|
||||
|
||||
it "should not be accesible for student in the additional section", test_id: 114315, priority: 1 do
|
||||
user_session(@student2)
|
||||
due_at_time = @override.due_at.strftime('%b %-d at %-l:%M') << @override.due_at.strftime('%p').downcase
|
||||
unlock_at_time = @override.unlock_at.strftime('%b %-d at %-l:%M') << @override.unlock_at.strftime('%p').downcase
|
||||
lock_at_time = @override.lock_at.strftime('%b %-d at %-l:%M') << @override.lock_at.strftime('%p').downcase
|
||||
get "/courses/#{@course1.id}/quizzes"
|
||||
expect_new_page_load { f("#summary_quiz_#{@quiz.id}").click }
|
||||
expect(f("#quiz_student_details").text).to include("Due #{due_at_time}")
|
||||
expect(f("#quiz_student_details").text).to include("Available #{unlock_at_time} - #{lock_at_time}")
|
||||
expect(f("#quiz_show").text).to include("This quiz is locked until #{unlock_at_time}")
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
|
||||
|
||||
describe "quizzes attempts" do
|
||||
include AssignmentOverridesSeleniumHelper
|
||||
include_examples "quizzes selenium tests"
|
||||
before :all do
|
||||
@student1 = user_with_pseudonym(:username => 'student1@example.com', :active_all => 1)
|
||||
@course1 = course_with_student_logged_in(:user => @student1, :active_all => 1, :course_name => 'course1').course
|
||||
@quiz = create_quiz_with_default_due_dates
|
||||
add_user_specific_due_date_override(@quiz, :due_at => Time.zone.now.advance(days: 3),
|
||||
:unlock_at => Time.zone.now.advance(days:1),
|
||||
:lock_at => Time.zone.now.advance(days:4))
|
||||
end
|
||||
|
||||
it "should be accesible for student in the main section", priority: "1", test_id: 114315, priority: 1 do
|
||||
get "/courses/#{@course1.id}/quizzes"
|
||||
expect_new_page_load { f("#summary_quiz_#{@quiz.id}").click }
|
||||
due_at_time = @quiz.due_at.strftime('%b %-d at %-l:%M') << @quiz.due_at.strftime('%p').downcase
|
||||
unlock_at_time = @quiz.unlock_at.strftime('%b %-d at %-l:%M') << @quiz.unlock_at.strftime('%p').downcase
|
||||
lock_at_time = @quiz.lock_at.strftime('%b %-d at %-l:%M') << @quiz.lock_at.strftime('%p').downcase
|
||||
expect(f("#quiz_student_details").text).to include("Due #{due_at_time}")
|
||||
expect(f("#quiz_student_details").text).to include("Available #{unlock_at_time} - #{lock_at_time}")
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/common')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
|
||||
|
||||
describe "quizzes attempts" do
|
||||
include AssignmentOverridesSeleniumHelper
|
||||
include_examples "quizzes selenium tests"
|
||||
before :all do
|
||||
@ta1 = user_with_pseudonym(:username => 'ta1@example.com', :active_all => 1)
|
||||
@course1 = course_model
|
||||
@course1.offer!
|
||||
@quiz = create_quiz_with_default_due_dates
|
||||
add_user_specific_due_date_override(@quiz, :due_at => Time.zone.now.advance(days: 3),
|
||||
:unlock_at => Time.zone.now.advance(days:1),
|
||||
:lock_at => Time.zone.now.advance(days:4))
|
||||
ta_in_section(@new_section, :user => @ta1)
|
||||
end
|
||||
|
||||
it "should show the due dates for TA in the additional section", test_id: 114315, priority: 1 do
|
||||
user_session(@ta1)
|
||||
get "/courses/#{@course1.id}"
|
||||
expect_new_page_load{ f("#section-tabs .quizzes").click }
|
||||
lock_at_time = @quiz.lock_at.strftime('%b %-d')
|
||||
unlock_at_time = @override.unlock_at.strftime('%b %-d')
|
||||
hover_text = "Everyone else\nAvailable until #{lock_at_time}\nNew Section\nNot available until #{unlock_at_time}"
|
||||
driver.mouse.move_to fln('Multiple Dates')
|
||||
keep_trying_until do
|
||||
expect(f("#ui-tooltip-0").text).to eq(hover_text)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -663,6 +663,15 @@ RSpec.configure do |config|
|
|||
student
|
||||
end
|
||||
|
||||
def ta_in_section(section, opts={})
|
||||
ta = opts.fetch(:user) { user }
|
||||
enrollment = section.course.enroll_user(ta, 'TaEnrollment', :section => section, :force_update => true)
|
||||
ta.save!
|
||||
enrollment.workflow_state = 'active'
|
||||
enrollment.save!
|
||||
ta
|
||||
end
|
||||
|
||||
def teacher_in_course(opts={})
|
||||
opts[:course] = @course if @course && !opts[:course]
|
||||
course_with_teacher(opts)
|
||||
|
|
Loading…
Reference in New Issue