forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard_todo_spec.rb
More file actions
87 lines (68 loc) · 3.21 KB
/
Copy pathdashboard_todo_spec.rb
File metadata and controls
87 lines (68 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require File.expand_path(File.dirname(__FILE__) + '/common')
describe "dashboard" do
include_context "in-process server selenium tests"
context "as a student" do
before (:each) do
course_with_student_logged_in(:active_all => true)
end
it "should limit the number of visible items in the to do list", priority: "1", test_id: 216405 do
due_date = Time.now.utc + 2.days
20.times do
assignment_model :due_at => due_date, :course => @course, :submission_types => 'online_text_entry'
end
get "/"
expect(ffj(".to-do-list li:visible")).to have_size(5 + 1) # +1 is the see more link
f(".more_link").click
wait_for_ajaximations
expect(ffj(".to-do-list li:visible")).to have_size(20)
end
it "should display assignments to do in to do list for a student", priority: "1", test_id: 216406 do
notification_model(:name => 'Assignment Due Date Changed')
notification_policy_model(:notification_id => @notification.id)
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
assignment.due_at = Time.now + 60
assignment.created_at = 1.month.ago
assignment.save!
get "/"
f('#DashboardOptionsMenu_Container button').click
fj('span[role="menuitemradio"]:contains("Recent Activity")').click
# verify assignment changed notice is in messages
f('.stream-assignment .stream_header').click
expect(f('#assignment-details')).to include_text('Assignment Due Date Changed')
# verify assignment is in to do list
expect(f('.to-do-list > li')).to include_text(assignment.submission_action_string)
expect(f('.coming_up')).to include_text(assignment.title)
end
it "should not display assignments for soft-concluded courses in to do list for a student", priority: "1", test_id: 216407 do
notification_model(:name => 'Assignment Due Date Changed')
notification_policy_model(:notification_id => @notification.id)
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
assignment.due_at = Time.now + 60
assignment.created_at = 1.month.ago
assignment.save!
Timecop.freeze(1.hour.ago) do
@course.start_at = 1.month.ago
@course.soft_conclude!
@course.save!
end
get "/"
expect(f("#content")).not_to contain_css('.to-do-list')
expect(f('.coming_up')).to_not include_text(assignment.title)
end
it "should allow to do list items to be ignored", priority: "1", test_id: 216408 do
notification_model(:name => 'Assignment Due Date Changed')
notification_policy_model(:notification_id => @notification.id)
assignment = assignment_model({:submission_types => 'online_text_entry', :course => @course})
assignment.due_at = Time.now + 60
assignment.created_at = 1.month.ago
assignment.save!
get "/"
expect(f('.to-do-list > li')).to include_text(assignment.submission_action_string)
f('.to-do-list .disable_item_link').click
wait_for_ajaximations
expect(f("#content")).not_to contain_css('.to-do-list > li')
get "/"
expect(f("#content")).not_to contain_css('.to-do-list')
end
end
end