forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins_spec.rb
More file actions
69 lines (56 loc) · 2.2 KB
/
Copy pathplugins_spec.rb
File metadata and controls
69 lines (56 loc) · 2.2 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
require File.expand_path(File.dirname(__FILE__) + '/common')
describe "plugins ui" do
include_context "in-process server selenium tests"
before(:each) do
site_admin_logged_in
end
it 'should have plugins default to disabled when no plugin_setting exits', priority: "1", test_id: 268053 do
get '/plugins/etherpad'
expect(is_checked('#plugin_setting_disabled')).to be_truthy
multiple_accounts_select
expect_new_page_load { submit_form("#new_plugin_setting") }
expect(PluginSetting.all.map(&:name)).to eq(["etherpad"])
PluginSetting.first.tap do |ps|
expect(ps.name).to eq "etherpad"
expect(ps.disabled).to be_truthy
end
get '/plugins/etherpad'
expect(is_checked('#plugin_setting_disabled')).to be_truthy
end
it 'should have plugin settings not disabled when set', priority: "1", test_id: 268054 do
get '/plugins/etherpad'
expect(is_checked('#plugin_setting_disabled')).to be_truthy
multiple_accounts_select
f('#plugin_setting_disabled').click
expect_new_page_load { submit_form("#new_plugin_setting") }
expect(PluginSetting.all.map(&:name)).to eq(["etherpad"])
PluginSetting.first.tap do |ps|
expect(ps.name).to eq "etherpad"
expect(ps.disabled).to be_falsey
end
get '/plugins/etherpad'
multiple_accounts_select
expect(is_checked('#plugin_setting_disabled')).to be_falsey
end
it "should not overwrite settings that are not shown", priority: "1", test_id: 268055 do
get '/plugins/etherpad'
multiple_accounts_select
f("#plugin_setting_disabled").click
expect_new_page_load { submit_form("#new_plugin_setting") }
plugin_setting = PluginSetting.last
plugin_setting.settings["other_thingy"] = "dude"
plugin_setting.save!
expect_new_page_load { submit_form("#edit_plugin_setting_#{plugin_setting.id}") }
plugin_setting.reload
expect(plugin_setting.settings["other_thingy"]).to eq "dude"
end
def multiple_accounts_select
if !f("#plugin_setting_disabled").displayed?
f("#accounts_select option:nth-child(2)").click
expect(f("#plugin_setting_disabled")).to be_displayed
end
if !f(".save_button").enabled?
f(".copy_settings_button").click
end
end
end