forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavigation_spec.rb
More file actions
118 lines (106 loc) · 4.08 KB
/
Copy pathnavigation_spec.rb
File metadata and controls
118 lines (106 loc) · 4.08 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
# Copyright (C) 2015 - 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/>.
require File.expand_path(File.dirname(__FILE__) + '/common')
describe 'Global Navigation' do
include_context 'in-process server selenium tests'
context 'As a Teacher' do
before do
course_with_teacher_logged_in
end
describe 'Profile Link' do
it 'should show the profile tray upon clicking' do
get "/"
f('#global_nav_profile_link').click
expect(f('#global_nav_profile_header')).to be_displayed
end
# Profile links are hardcoded, so check that something is appearing for
# the display_name in the tray header
it 'should populate the profile tray with the current user display_name' do
get "/"
expect(displayed_username).to eq(@user.name)
end
end
describe 'Courses Link' do
it 'should show the courses tray upon clicking' do
get "/"
f('#global_nav_courses_link').click
wait_for_ajaximations
expect(f('.ic-NavMenu__primary-content')).to be_displayed
end
it 'should populate the courses tray when using the keyboard to open it' do
get "/"
driver.execute_script('$("#global_nav_courses_link").focus()')
f('#global_nav_courses_link').send_keys(:enter)
wait_for_ajaximations
links = ff('.ic-NavMenu__link-list li')
expect(links.count).to eql 2
end
end
describe 'Groups Link' do
it 'filters concluded groups and loads additional pages if necessary' do
Setting.set('api_per_page', 2)
student = user_factory
2.times do |x|
course = course_with_student(:user => student, :active_all => true).course
group_with_user(:user => student, :group_context => course, :name => "A Old Group #{x}")
course.complete!
end
course = course_with_student(:user => student, :active_all => true).course
group_with_user(:user => student, :group_context => course, :name => "Z Current Group")
user_session(student)
get "/"
f('#global_nav_groups_link').click
wait_for_ajaximations
links = ff('.ic-NavMenu__link-list li')
expect(links.map(&:text)).to eq(['Z Current Group', 'All Groups'])
end
end
describe 'LTI Tools' do
it 'should show a custom logo/link for LTI tools' do
Account.default.enable_feature! :lor_for_account
@teacher.enable_feature! :lor_for_user
@tool = Account.default.context_external_tools.new({
:name => "Commons",
:domain => "canvaslms.com",
:consumer_key => '12345',
:shared_secret => 'secret'
})
@tool.set_extension_setting(:global_navigation, {
:url => "canvaslms.com",
:visibility => "admins",
:display_type => "full_width",
:text => "Commons",
:icon_svg_path_64 => 'M100,37L70.1,10.5v17.6H38.6c-4.9,0-8.8,3.9-8.8,8.8s3.9,8.8,8.8,8.8h31.5v17.6L100,37z'
})
@tool.save!
get "/"
expect(f('.ic-icon-svg--lti')).to be_displayed
end
end
describe 'Navigation Expand/Collapse Link' do
it 'should collapse and expand the navigation when clicked' do
get "/"
f('#primaryNavToggle').click
wait_for_ajaximations
expect(f('body')).not_to have_class("primary-nav-expanded")
f('#primaryNavToggle').click
wait_for_ajaximations
expect(f('body')).to have_class("primary-nav-expanded")
end
end
end
end