2017-04-30 03:04:01 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2014 - present Instructure, Inc.
|
|
|
|
#
|
|
|
|
# This file is part of Canvas.
|
|
|
|
#
|
|
|
|
# Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
# the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
# Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License along
|
|
|
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-12-19 03:04:42 +08:00
|
|
|
require_relative 'common'
|
|
|
|
require_relative 'helpers/notifications_common'
|
2014-09-23 05:29:52 +08:00
|
|
|
|
|
|
|
describe "dashboard" do
|
2017-01-18 09:00:06 +08:00
|
|
|
include NotificationsCommon
|
2015-08-08 06:24:05 +08:00
|
|
|
include_context "in-process server selenium tests"
|
2014-09-23 05:29:52 +08:00
|
|
|
|
|
|
|
context "as a teacher" do
|
|
|
|
before (:each) do
|
|
|
|
course_with_teacher_logged_in(:active_cc => true)
|
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should validate the functionality of soft concluded courses on courses page", priority: "1", test_id: 216396 do
|
2014-09-23 05:29:52 +08:00
|
|
|
term = EnrollmentTerm.new(:name => "Super Term", :start_at => 1.month.ago, :end_at => 1.week.ago)
|
|
|
|
term.root_account_id = @course.root_account_id
|
|
|
|
term.save!
|
|
|
|
c1 = @course
|
|
|
|
c1.name = 'a_soft_concluded_course'
|
2020-01-09 07:39:02 +08:00
|
|
|
c1.update!(:enrollment_term => term)
|
2014-09-23 05:29:52 +08:00
|
|
|
c1.reload
|
|
|
|
|
|
|
|
get "/courses"
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(fj("#past_enrollments_table a[href='/courses/#{@course.id}']")).to include_text(c1.name)
|
2014-09-23 05:29:52 +08:00
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should display assignment to grade in to do list for a teacher", priority: "1", test_id: 216397 do
|
2014-09-23 05:29:52 +08:00
|
|
|
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
|
2016-10-13 02:30:02 +08:00
|
|
|
student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :password => 'qwertyuiop')
|
2014-09-23 05:29:52 +08:00
|
|
|
@course.enroll_user(student, "StudentEnrollment", :enrollment_state => 'active')
|
|
|
|
assignment.reload
|
|
|
|
assignment.submit_homework(student, {:submission_type => 'online_text_entry', :body => 'ABC'})
|
|
|
|
assignment.reload
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
#verify assignment is in to do list
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(f('.to-do-list > li')).to include_text('Grade ' + assignment.title)
|
2014-09-23 05:29:52 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should be able to ignore an assignment until the next submission", priority: "1", test_id: 216399 do
|
2015-03-13 05:05:56 +08:00
|
|
|
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
|
2016-10-13 02:30:02 +08:00
|
|
|
student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :password => 'qwertyuiop')
|
|
|
|
student2 = user_with_pseudonym(:active_user => true, :username => 'student2@example.com', :password => 'qwertyuiop')
|
2015-03-13 05:05:56 +08:00
|
|
|
@course.enroll_user(student, "StudentEnrollment", :enrollment_state => 'active')
|
|
|
|
@course.enroll_user(student2, "StudentEnrollment", :enrollment_state => 'active')
|
|
|
|
assignment.reload
|
|
|
|
assignment.submit_homework(student, {:submission_type => 'online_text_entry', :body => 'ABC'})
|
|
|
|
assignment.reload
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
Redesign the To-Do, Coming Up, and Recent Feedback lists
Fixes CNVS-25877
Test plan:
- Create a user with:
- an assignment that needs to be submitted
- an assignment that needs to be graded
- an assignment whose grades the user needs to moderate
- an assignment that they need to peer review
- a calendar event that they can see
- Go to the user's home page
- Ensure all of the assignments show up in the to-do list
- Ensure they show up in Coming Up as well
- Ensure that the calendar event shows up under Coming Up
- Go to the courses where you created the assignments
- Ensure that each assignment shows up on its respective course to-do
list
- Submit an assignment
- As a teacher, ensure that the assignment shows up as needing
grading, and that the number in the badge to the left is 1
- Ensure that screenreaders read the badge as "1 submission
needs grading"
- Make another submission as a different user
- Clear the cache by running `Rails.cache.clear` at a Rails console
- As the teacher, ensure that the badge is now 2
- Ensure that screenreaders read the badge as "2 submissions
need grading"
- Repeat 8 more times as different users, so that there are now
10 submissions
- Clear the cache again
- Ensure that the badge now says "9+"
- Ensure that screenreaders read the badge as "More than 9
submissions need grading"
- As the user who submitted the assignment, ensure that the grade
shows up on the To-Do list, Coming Up, and Recent Feedback
- As a teacher, leave a submission comment
- As the user who submitted the assignment, ensure that the comment
shows up under Recent Feedback
- Create a public course
- You can make a course public by going to its settings page
and checking "Make this course publicly visible"
- Log out
- Visit /courses/<id>, where <id> is the id of the course
- Ensure that the course shows as expected, and that nothing
shows up on the to-do list
- Automated tests should cover everything else
Change-Id: I18673995db94d896bf2c39515258e61065b48319
Reviewed-on: https://gerrit.instructure.com/69474
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Tested-by: Jenkins
Product-Review: Allison Weiss <allison@instructure.com>
2015-12-29 08:39:37 +08:00
|
|
|
ignore_link = f('.to-do-list .disable_item_link')
|
2016-05-17 05:23:26 +08:00
|
|
|
expect(ignore_link['title']).to include("Ignore until new submission")
|
2015-10-08 00:55:55 +08:00
|
|
|
ignore_link.click
|
2015-03-13 05:05:56 +08:00
|
|
|
wait_for_ajaximations
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(f("#content")).not_to contain_css('.to-do-list > li')
|
2015-03-13 05:05:56 +08:00
|
|
|
|
|
|
|
get "/"
|
|
|
|
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(f("#content")).not_to contain_css('.to-do-list')
|
2015-03-13 05:05:56 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
assignment.reload
|
|
|
|
assignment.submit_homework(student2, {:submission_type => 'online_text_entry', :body => 'ABC'})
|
|
|
|
assignment.reload
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
expect(f('.to-do-list > li')).to include_text('Grade ' + assignment.title)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2016-03-09 03:56:10 +08:00
|
|
|
context 'stream items' do
|
|
|
|
before :once do
|
2017-01-18 09:00:06 +08:00
|
|
|
setup_notification(@teacher, name: 'Assignment Created')
|
2016-03-09 03:56:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows an assignment stream item under Recent Activity in dashboard', priority: "1", test_id: 108723 do
|
|
|
|
assignment_model({:submission_types => ['online_text_entry'], :course => @course})
|
|
|
|
get "/"
|
2016-12-07 04:01:12 +08:00
|
|
|
f('#DashboardOptionsMenu_Container button').click
|
|
|
|
fj('span[role="menuitemradio"]:contains("Recent Activity")').click
|
2016-03-09 03:56:10 +08:00
|
|
|
find('.toggle-details').click
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(fj('.fake-link:contains("Unnamed")')).to be_present
|
2016-03-09 03:56:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show an unpublished assignment under recent activity under dashboard', priority: "2", test_id: 108722 do
|
|
|
|
# manually creating assignment as assignment created through backend are published by default
|
|
|
|
get "/courses/#{@course.id}/assignments"
|
|
|
|
wait_for_ajaximations
|
|
|
|
|
|
|
|
# create assignment
|
|
|
|
f('.new_assignment').click
|
|
|
|
wait_for_ajaximations
|
|
|
|
f('#assignment_name').send_keys('unpublished assignment')
|
|
|
|
f("input[type=checkbox][id=assignment_text_entry]").click
|
|
|
|
f(".datePickerDateField[data-date-type='due_at']").send_keys(Time.zone.now + 1.day)
|
|
|
|
|
|
|
|
expect_new_page_load { f('.btn-primary[type=submit]').click }
|
|
|
|
wait_for_ajaximations
|
|
|
|
|
|
|
|
get "/"
|
2016-08-31 06:28:25 +08:00
|
|
|
f('#DashboardOptionsMenu_Container button').click
|
|
|
|
fj('span[role="menuitemradio"]:contains("Recent Activity")').click
|
2016-03-09 03:56:10 +08:00
|
|
|
expect(f('.no_recent_messages')).to be_truthy
|
|
|
|
end
|
2015-11-17 01:44:06 +08:00
|
|
|
end
|
|
|
|
|
2015-10-08 00:55:55 +08:00
|
|
|
context "moderation to do" do
|
|
|
|
before do
|
|
|
|
@teacher = @user
|
|
|
|
@student = student_in_course(:course => @course, :active_all => true).user
|
2018-06-01 03:58:50 +08:00
|
|
|
@assignment = @course.assignments.create!(
|
|
|
|
title: "some assignment",
|
|
|
|
submission_types: ['online_text_entry'],
|
|
|
|
moderated_grading: true,
|
2018-07-02 23:37:59 +08:00
|
|
|
grader_count: 2,
|
|
|
|
final_grader: @teacher
|
2018-06-01 03:58:50 +08:00
|
|
|
)
|
2015-10-08 00:55:55 +08:00
|
|
|
@assignment.submit_homework(@student, :body => "submission")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should show assignments needing moderation" do
|
|
|
|
enable_cache do
|
|
|
|
Timecop.freeze(1.minute.from_now) do
|
|
|
|
get "/"
|
|
|
|
expect(f('.to-do-list')).to_not include_text("Moderate #{@assignment.title}")
|
|
|
|
end
|
|
|
|
|
|
|
|
Timecop.freeze(2.minutes.from_now) do
|
|
|
|
# create a provisional grade
|
|
|
|
@assignment.grade_student(@student, :grade => "1", :grader => @teacher, :provisional => true)
|
|
|
|
|
|
|
|
run_jobs # touching admins is done in a delayed job
|
|
|
|
|
|
|
|
get "/"
|
|
|
|
expect(f('.to-do-list')).to include_text("Moderate #{@assignment.title}")
|
|
|
|
end
|
|
|
|
|
|
|
|
Timecop.freeze(3.minutes.from_now) do
|
|
|
|
@assignment.update_attribute(:grades_published_at, Time.now.utc)
|
2019-05-17 00:48:34 +08:00
|
|
|
@teacher.clear_cache_key(:todo_list) # would be done by the publishing endpoint
|
2015-10-08 00:55:55 +08:00
|
|
|
|
|
|
|
get "/"
|
|
|
|
expect(f('.to-do-list')).to_not include_text("Moderate #{@assignment.title}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be able to ignore assignments needing moderation until next provisional grade change" do
|
|
|
|
@assignment.grade_student(@student, :grade => "1", :grader => @teacher, :provisional => true)
|
|
|
|
pg = @assignment.provisional_grades.first
|
|
|
|
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
ff('.to-do-list .disable_item_link').each do |link|
|
2016-05-17 05:23:26 +08:00
|
|
|
expect(link['title']).to include("Ignore until new mark")
|
2015-10-08 00:55:55 +08:00
|
|
|
link.click
|
|
|
|
wait_for_ajaximations
|
|
|
|
end
|
|
|
|
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(f("#content")).not_to contain_css('.to-do-list > li')
|
2015-10-08 00:55:55 +08:00
|
|
|
|
|
|
|
get "/"
|
|
|
|
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(f("#content")).not_to contain_css('.to-do-list')
|
2015-10-08 00:55:55 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
pg.save! # reload
|
|
|
|
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
expect(f('.to-do-list')).to include_text("Moderate #{@assignment.title}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-03-13 05:05:56 +08:00
|
|
|
describe "Todo Ignore Options Focus Management" do
|
|
|
|
before :each do
|
|
|
|
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
|
2016-10-13 02:30:02 +08:00
|
|
|
@student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :password => 'qwertyuiop')
|
2015-03-13 05:05:56 +08:00
|
|
|
@course.enroll_user(@student, "StudentEnrollment", :enrollment_state => 'active')
|
|
|
|
assignment.submit_homework(@student, {:submission_type => 'online_text_entry', :body => 'ABC'})
|
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should focus on the previous ignore link after ignoring a todo item", priority: "1", test_id: 216400 do
|
2015-03-13 05:05:56 +08:00
|
|
|
assignment2 = assignment_model({:submission_types => 'online_text_entry', :course => @course})
|
|
|
|
assignment2.submit_homework(@student, {:submission_type => 'online_text_entry', :body => 'Number2'})
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
all_todo_links = ff('.to-do-list .disable_item_link')
|
|
|
|
all_todo_links.last.click
|
|
|
|
wait_for_ajaximations
|
|
|
|
|
|
|
|
check_element_has_focus(all_todo_links.first)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-01-21 09:17:49 +08:00
|
|
|
it "should focus on the 'To Do' header if there are no other todo items", priority: "1", test_id: 216401 do
|
2015-03-13 05:05:56 +08:00
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
f('.to-do-list .disable_item_link').click
|
|
|
|
wait_for_ajaximations
|
|
|
|
|
2016-01-21 09:17:49 +08:00
|
|
|
check_element_has_focus(f('.todo-list-header'))
|
2015-03-13 05:05:56 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should not display assignment to grade in to do list for a designer", priority: "1", test_id: 216402 do
|
2015-03-10 04:40:51 +08:00
|
|
|
course_with_designer_logged_in(:active_all => true)
|
|
|
|
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
|
2016-10-13 02:30:02 +08:00
|
|
|
student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :password => 'qwertyuiop')
|
2015-03-10 04:40:51 +08:00
|
|
|
@course.enroll_user(student, "StudentEnrollment", :enrollment_state => 'active')
|
|
|
|
assignment.reload
|
|
|
|
assignment.submit_homework(student, {:submission_type => 'online_text_entry', :body => 'ABC'})
|
|
|
|
assignment.reload
|
|
|
|
enable_cache do
|
|
|
|
get "/"
|
|
|
|
|
2016-05-01 06:23:03 +08:00
|
|
|
expect(f("#content")).not_to contain_css('.to-do-list')
|
2015-03-10 04:40:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should show submitted essay quizzes in the todo list", priority: "1", test_id: 216403 do
|
2014-09-23 05:29:52 +08:00
|
|
|
quiz_title = 'new quiz'
|
|
|
|
student_in_course(:active_all => true)
|
|
|
|
q = @course.quizzes.create!(:title => quiz_title)
|
|
|
|
q.quiz_questions.create!(:question_data => {:id => 31, :name => "Quiz Essay Question 1", :question_type => 'essay_question', :question_text => 'qq1', :points_possible => 10})
|
|
|
|
q.generate_quiz_data
|
|
|
|
q.workflow_state = 'available'
|
|
|
|
q.save
|
|
|
|
q.reload
|
|
|
|
qs = q.generate_submission(@user)
|
|
|
|
qs.mark_completed
|
|
|
|
qs.submission_data = {"question_31" => "<p>abeawebawebae</p>", "question_text" => "qq1"}
|
|
|
|
Quizzes::SubmissionGrader.new(qs).grade_submission
|
|
|
|
get "/"
|
|
|
|
|
|
|
|
todo_list = f('.to-do-list')
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(todo_list).not_to be_nil
|
|
|
|
expect(todo_list).to include_text(quiz_title)
|
2014-09-23 05:29:52 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
context "course menu customization" do
|
|
|
|
|
2015-06-30 07:05:40 +08:00
|
|
|
it "should always have a link to the courses page (with customizations)", priority: "1", test_id: 216404 do
|
2016-05-21 03:07:09 +08:00
|
|
|
course_with_teacher({:user => @user, :active_course => true, :active_enrollment => true})
|
2014-09-23 05:29:52 +08:00
|
|
|
|
|
|
|
get "/"
|
|
|
|
|
2016-07-01 04:02:51 +08:00
|
|
|
f('#global_nav_courses_link').click
|
2018-11-20 23:10:55 +08:00
|
|
|
expect(fj('[aria-label="Courses tray"] a:contains("All Courses")')).to be_present
|
2014-09-23 05:29:52 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-01-05 07:23:56 +08:00
|
|
|
|
|
|
|
context 'as a teacher in an unpublished course' do
|
|
|
|
before do
|
|
|
|
course_with_teacher_logged_in(:active_course => false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not show an unpublished assignment for an unpublished course', priority: "2", test_id: 56003 do
|
|
|
|
name = 'venkman'
|
|
|
|
due_date = Time.zone.now.utc + 2.days
|
2018-02-04 03:03:20 +08:00
|
|
|
assignment = @course.assignments.create(name: name,
|
|
|
|
submission_types: 'online',
|
|
|
|
due_at: due_date,
|
|
|
|
lock_at: 1.week.from_now,
|
|
|
|
unlock_at: due_date)
|
2017-01-05 07:23:56 +08:00
|
|
|
|
|
|
|
get '/'
|
|
|
|
expect(f('.coming_up')).to include_text(name)
|
|
|
|
|
|
|
|
assignment.unpublish
|
|
|
|
get '/'
|
|
|
|
expect(f('.coming_up')).not_to include_text(name)
|
|
|
|
end
|
|
|
|
end
|
2015-12-18 00:51:01 +08:00
|
|
|
end
|