forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanvadoc_spec.rb
More file actions
86 lines (77 loc) · 2.96 KB
/
Copy pathcanvadoc_spec.rb
File metadata and controls
86 lines (77 loc) · 2.96 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
#
# 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')
require File.expand_path(File.dirname(__FILE__) + '/helpers/gradebook_common')
describe 'Canvadoc' do
include_context "in-process server selenium tests"
include GradebookCommon
before :once do
PluginSetting.create! :name => 'canvadocs',
:settings => {"api_key" => "blahblahblahblahblah",
"base_url" => "http://example.com",
"annotations_supported" => "1"}
end
def turn_on_plugin_settings
get '/plugins/canvadocs'
# whee different UI for plugins
if element_exists?('#accounts_select')
f("#accounts_select option:nth-child(2)").click
if !f(".save_button").enabled?
f(".copy_settings_button").click
end
if f("#plugin_setting_disabled")[:checked]
f("#plugin_setting_disabled").click
end
wait_for_ajaximations
end
end
context 'as an admin' do
before :each do
site_admin_logged_in
Canvadocs::API.any_instance.stubs(:upload).returns "id" => 1234
end
it 'should have the annotations checkbox in plugin settings', priority: "1", test_id: 345729 do
turn_on_plugin_settings
expect(fj('#settings_annotations_supported:visible')).to be_displayed
end
it 'should allow annotations settings to be saved', priority: "1", test_id: 345730 do
turn_on_plugin_settings
fj('#settings_annotations_supported').click
f('.save_button').click
assert_flash_notice_message('Plugin settings successfully updated.')
end
it "embed canvadocs in page", priority: "1", test_id: 126836 do
turn_on_plugin_settings
f('.save_button').click
course_with_teacher_logged_in :account => @account, :active_all => true
@course.wiki.wiki_pages.create!(title: 'Page1')
file = @course.attachments.create!(display_name: 'some test file', uploaded_data: default_uploaded_data)
file.context = @course
file.save!
get "/courses/#{@course.id}/pages/Page1/edit"
ff(".ui-tabs-anchor")[1].click
ff(".name.text")[0].click
wait_for_ajaximations
ff(".name.text")[1].click
wait_for_ajaximations
ff(".name.text")[2].click
wait_for_ajaximations
f(".btn-primary").click
expect(f(".scribd_file_preview_link")).to be_present
end
end
end