canvas-lms/spec/selenium/gradebooks_spec.rb

198 lines
7.0 KiB
Ruby
Raw Normal View History

require File.expand_path(File.dirname(__FILE__) + "/common")
describe "gradebook1" do
include_examples "in-process server selenium tests"
before(:each) do
course_with_teacher_logged_in(:active_all => true)
@course.update_attribute(:group_weighting_scheme, 'percent')
@section1 = @course.default_section
@section2 = @course.course_sections.create!(:name => "Other Section")
student_in_course(:active_all => true, :name => "Alice Ackers");
@student1 = @student
e = student_in_course(:active_all => true, :name => "Zeno Zopp");
e.course_section = @section2
e.save!
@student2 = @student
@assignments_group = @course.assignment_groups.create!(
:name => 'Assignments',
:group_weight => 25
)
@projects_group = @course.assignment_groups.create!(
:name => 'Projects',
:group_weight => 75
)
@project = assignment_model(
:course => @course,
:name => 'project',
:due_at => nil,
:points_possible => 20,
:submission_types => 'online_text_entry,online_upload',
:assignment_group => @projects_group
)
@assignment = assignment_model(
:course => @course,
:name => 'first assignment',
:due_at => nil,
:points_possible => 10,
:submission_types => 'online_text_entry,online_upload',
:assignment_group => @assignments_group
)
end
it "hides/shows assignments based on their draft state" do
@course.root_account.enable_feature!(:draft_state)
@assignment.unpublish
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
f('body').text.should_not match @assignment.title
@assignment.publish
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
f('body').text.should match @assignment.title
end
def switch_to_section(section_name="All")
f("#gradebook_options").click
Fully adopt Bootstrap & update css to work with it, closes: #CNVS-1344 this commit does the following: * upgrade bootstrap-sass gem to most recent version * switches to using bootstrap's normalize.css and forms.css which fixes a whole bunch of misformatting of how bootstrap stuff is supposed to look, but changing those 2 affects a lot of our old stylesheets. * gets rid of unified_buttons.sass and just uses bootstraps buttons. .ui-button @extends these because we still have to support .ui-button for modals & buttonsets. but .button is no longer supported. * a lot of css file reorganization (there's no more 'blue' and 'normal canvas', there's just canvas) * a bunch of files had to be tweaked to look good with these changes. test plan: This change touches every page in canvas so, no kidding, we need to make sure every page looks OK. In order to do that: 1. each sprint team needs to give a +1 after they make sure all the pages in the features they are over look good. 2. the QA person on each team needs to look at the pages for their teams features for a QA +1 things to look for specifically when testing: * buttons: this gets rid of all those red 'cancel' links that are actually buttons, make sure all the buttons you see look right. if you see 2 plain gray buttons next to each other like [Save] [Cancel], we should make the primary one blue (by adding the .btn-primary class) * Forms: a lot of this change has to do with how form elements look, especially <select>s, <input>s and <label>s. look at the diffs for the ones that have the most changes and make sure those look good, but also check for the ones I missed and make sure those look good too. * and just random style changes, if something looks ugly or broken (and it didn't before), we should fix that. Also: just use a link instead of a drop-menu for adding event from sidebar we used to have a drop down menu for adding events to cal2 from the sidebar where you'd hit a cog and it'd ask you if you wanted to add an event or an assignment. this just simplifies it to an add icon. this: http://cl.ly/image/133a2A3q3q1M instead of: http://cl.ly/image/46463o2s3W0g Change-Id: I384fe273934bca96bf28423afb1402c7792d8766 Reviewed-on: https://gerrit.instructure.com/15422 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com> QA-Review: Ryan Florence <ryanf@instructure.com>
2012-12-21 14:46:28 +08:00
wait_for_ajaximations
driver.execute_script("$('#instructure_dropdown_list .option:last').click()")
Fully adopt Bootstrap & update css to work with it, closes: #CNVS-1344 this commit does the following: * upgrade bootstrap-sass gem to most recent version * switches to using bootstrap's normalize.css and forms.css which fixes a whole bunch of misformatting of how bootstrap stuff is supposed to look, but changing those 2 affects a lot of our old stylesheets. * gets rid of unified_buttons.sass and just uses bootstraps buttons. .ui-button @extends these because we still have to support .ui-button for modals & buttonsets. but .button is no longer supported. * a lot of css file reorganization (there's no more 'blue' and 'normal canvas', there's just canvas) * a bunch of files had to be tweaked to look good with these changes. test plan: This change touches every page in canvas so, no kidding, we need to make sure every page looks OK. In order to do that: 1. each sprint team needs to give a +1 after they make sure all the pages in the features they are over look good. 2. the QA person on each team needs to look at the pages for their teams features for a QA +1 things to look for specifically when testing: * buttons: this gets rid of all those red 'cancel' links that are actually buttons, make sure all the buttons you see look right. if you see 2 plain gray buttons next to each other like [Save] [Cancel], we should make the primary one blue (by adding the .btn-primary class) * Forms: a lot of this change has to do with how form elements look, especially <select>s, <input>s and <label>s. look at the diffs for the ones that have the most changes and make sure those look good, but also check for the ones I missed and make sure those look good too. * and just random style changes, if something looks ugly or broken (and it didn't before), we should fix that. Also: just use a link instead of a drop-menu for adding event from sidebar we used to have a drop down menu for adding events to cal2 from the sidebar where you'd hit a cog and it'd ask you if you wanted to add an event or an assignment. this just simplifies it to an add icon. this: http://cl.ly/image/133a2A3q3q1M instead of: http://cl.ly/image/46463o2s3W0g Change-Id: I384fe273934bca96bf28423afb1402c7792d8766 Reviewed-on: https://gerrit.instructure.com/15422 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com> QA-Review: Ryan Florence <ryanf@instructure.com>
2012-12-21 14:46:28 +08:00
wait_for_ajaximations
click_option("#section-to-show", section_name)
driver.execute_script("$('#section-to-show').parent().parent().find('button').click()")
Fully adopt Bootstrap & update css to work with it, closes: #CNVS-1344 this commit does the following: * upgrade bootstrap-sass gem to most recent version * switches to using bootstrap's normalize.css and forms.css which fixes a whole bunch of misformatting of how bootstrap stuff is supposed to look, but changing those 2 affects a lot of our old stylesheets. * gets rid of unified_buttons.sass and just uses bootstraps buttons. .ui-button @extends these because we still have to support .ui-button for modals & buttonsets. but .button is no longer supported. * a lot of css file reorganization (there's no more 'blue' and 'normal canvas', there's just canvas) * a bunch of files had to be tweaked to look good with these changes. test plan: This change touches every page in canvas so, no kidding, we need to make sure every page looks OK. In order to do that: 1. each sprint team needs to give a +1 after they make sure all the pages in the features they are over look good. 2. the QA person on each team needs to look at the pages for their teams features for a QA +1 things to look for specifically when testing: * buttons: this gets rid of all those red 'cancel' links that are actually buttons, make sure all the buttons you see look right. if you see 2 plain gray buttons next to each other like [Save] [Cancel], we should make the primary one blue (by adding the .btn-primary class) * Forms: a lot of this change has to do with how form elements look, especially <select>s, <input>s and <label>s. look at the diffs for the ones that have the most changes and make sure those look good, but also check for the ones I missed and make sure those look good too. * and just random style changes, if something looks ugly or broken (and it didn't before), we should fix that. Also: just use a link instead of a drop-menu for adding event from sidebar we used to have a drop down menu for adding events to cal2 from the sidebar where you'd hit a cog and it'd ask you if you wanted to add an event or an assignment. this just simplifies it to an add icon. this: http://cl.ly/image/133a2A3q3q1M instead of: http://cl.ly/image/46463o2s3W0g Change-Id: I384fe273934bca96bf28423afb1402c7792d8766 Reviewed-on: https://gerrit.instructure.com/15422 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com> QA-Review: Ryan Florence <ryanf@instructure.com>
2012-12-21 14:46:28 +08:00
wait_for_ajaximations
sleep 2
end
it "should filter by section" do
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
switch_to_section(@section1.display_name)
student_cell = f("#student_#{@student1.id}")
student_cell.should include_text @student1.sortable_name
student_cell.should include_text @section1.display_name
switch_to_section(@section2.display_name)
student_cell = f("#student_#{@student2.id}")
student_cell.should include_text @student2.sortable_name
student_cell.should include_text @section2.display_name
end
it "should handle multiple enrollments" do
student view; closes #6995 allows course admins to view the course from a student perspective. this is accessible from a button on the course/settings page. They should be able to interact with the course as a student would, including submitting homework and quizzes. Right now there is one student view student per course, so if the course has multiple administrators, they will all share the same student view student. There are a few things that won't work in student view the way the would for a normal student, most notably access to conversations is disabled. Additionally, any publicly visible action that the teacher takes while in student view will still be publicly visible -- for example if the teacher posts a discussion topic/reply as the student view student, it will be visible to the whole class. test-plan: - (the following should be tried both as a full teacher and as a section-limited course admin) - set up a few assignments, quizzes, discussions, and module progressions in a course. - enter student view from the coures settings page. - work through the things you set up above. - leave student view from the upper right corner of the page. - as a teacher you should be able to grade the fake student so that they can continue to progress. - the student should not show up in the course users list - the student should not show up at the account level at all: * total user list * statistics Change-Id: I886a4663777f3ef2bdae594349ff6da6981e14ed Reviewed-on: https://gerrit.instructure.com/9484 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-03-14 04:08:19 +08:00
@course.enroll_student(@student1, :section => @section2, :allow_multiple_enrollments => true)
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
student_cell = f("#student_#{@student1.id}")
student_cell.should include_text @student1.sortable_name
student_cell.should include_text @section1.display_name
student_cell.should include_text @section2.display_name
switch_to_section(@section1.display_name)
student_cell = f("#student_#{@student1.id}")
student_cell.should include_text @student1.sortable_name
student_cell.should include_text @section1.display_name
student_cell.should include_text @section2.display_name
switch_to_section(@section2.display_name)
student_cell = f("#student_#{@student1.id}")
student_cell.should include_text @student1.sortable_name
student_cell.should include_text @section1.display_name
student_cell.should include_text @section2.display_name
end
it "should show turnitin data" do
s1 = @assignment.submit_homework(@student1, :submission_type => 'online_text_entry', :body => 'asdf')
s1.update_attribute :turnitin_data, {"submission_#{s1.id}" => {:similarity_score => 0.0, :web_overlap => 0.0, :publication_overlap => 0.0, :student_overlap => 0.0, :state => 'none'}}
a = attachment_model(:context => @user, :content_type => 'text/plain')
s2 = @assignment.submit_homework(@student2, :submission_type => 'online_upload', :attachments => [a])
s2.update_attribute :turnitin_data, {"attachment_#{a.id}" => {:similarity_score => 1.0, :web_overlap => 5.0, :publication_overlap => 0.0, :student_overlap => 0.0, :state => 'acceptable'}}
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
ffj('.turnitin:visible').size.should == 2
# now create a ton of students so that the data loads via ajax
100.times { |i| student_in_course(:active_all => true, :name => "other guy #{i}") }
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
ffj('.turnitin:visible').size.should == 2
end
student view; closes #6995 allows course admins to view the course from a student perspective. this is accessible from a button on the course/settings page. They should be able to interact with the course as a student would, including submitting homework and quizzes. Right now there is one student view student per course, so if the course has multiple administrators, they will all share the same student view student. There are a few things that won't work in student view the way the would for a normal student, most notably access to conversations is disabled. Additionally, any publicly visible action that the teacher takes while in student view will still be publicly visible -- for example if the teacher posts a discussion topic/reply as the student view student, it will be visible to the whole class. test-plan: - (the following should be tried both as a full teacher and as a section-limited course admin) - set up a few assignments, quizzes, discussions, and module progressions in a course. - enter student view from the coures settings page. - work through the things you set up above. - leave student view from the upper right corner of the page. - as a teacher you should be able to grade the fake student so that they can continue to progress. - the student should not show up in the course users list - the student should not show up at the account level at all: * total user list * statistics Change-Id: I886a4663777f3ef2bdae594349ff6da6981e14ed Reviewed-on: https://gerrit.instructure.com/9484 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-03-14 04:08:19 +08:00
it "should include student view student for grading" do
@fake_student = @course.student_view_student
@fake_submission = @assignment.submit_homework(@fake_student, :body => 'fake student submission')
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
f("#student_#{@fake_student.id} .display_name").should include_text @fake_student.sortable_name
end
it "should link to the correct student in speedgrader" do
s1 = @assignment.submit_homework(@student1, :submission_type => 'online_text_entry', :body => 'asdf')
s2 = @assignment.submit_homework(@student2, :submission_type => 'online_text_entry', :body => 'heyo')
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
keep_trying_until {
fj('#datagrid_data .row:nth-child(3) .cell:first .grade').click
fj('#submission_information').should be_displayed
}
link_el = f('#submission_information .submission_details .view_submission_link')
URI.decode(URI.parse(link_el.attribute(:href)).fragment).should == "{\"student_id\":#{@student2.id}}"
end
def wait_for_grades
keep_trying_until {
f("[id^=submission][id$=final-grade]").text =~ /%/
}
end
def grade_student(student, assignment, score)
f("#submission_#{student.id}_#{assignment.id}").click
grade_input_box = fj("[id=student_grading_#{assignment.id}]:visible")
grade_input_box.send_keys(score)
grade_input_box.send_keys(:tab)
end
def final_grade_for(student)
f("#submission_#{student.id}_final-grade").text
end
def toggle_group_weighting_scheme
fj('#gradebook_options:visible').click
ff('#instructure_dropdown_list .option').find { |o|
o.text =~ /Set Group Weights/
}.click
f('#class_weighting_policy').click
fj('button:contains(Done):visible').click
end
it "allows you to toggle the group_weighting_scheme" do
get "/courses/#{@course.id}/gradebook"
wait_for_grades
grade_student(@student1, @assignment, 2)
grade_student(@student1, @project, 20)
wait_for_ajaximations
final_grade_for(@student1).to_f.should == 80 # (2/10*.25) + (20/20*.75)
toggle_group_weighting_scheme
keep_trying_until { final_grade_for(@student1).to_f != 80 }
final_grade_for(@student1).to_f.should == 73.3 # (2+20)/(10+20)
end
end