Revert "spec: removal and shared specs and spec refactors"

This reverts commit 9c05b51714

Change-Id: Ia8250ef9d71cf70f0bc02208f2f459ed72c239e5
Reviewed-on: https://gerrit.instructure.com/19408
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
This commit is contained in:
Bryan Madsen 2013-04-08 20:49:29 +00:00
parent 7789bcc735
commit ba3c751a1a
34 changed files with 617 additions and 1015 deletions

View File

@ -1,29 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/question_bank_common.rb')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/question_banks_specs')
describe "account admin question banks" do
it_should_behave_like "in-process server selenium tests"
let(:url) { "/accounts/#{Account.default.id}/question_banks" }
before (:each) do
admin_logged_in
get url
describe "shared question bank specs" do
let(:url) { "/accounts/#{Account.default.id}/question_banks" }
it_should_behave_like "question bank basic tests"
end
it "should verify question bank is found by navigating to bookmark" do
should_verify_question_bank_is_found_by_navigating_to_bookmark
end
it "should unbookmark a question bank" do
should_unbookmark_a_question_bank
end
it "should edit a question bank" do
should_edit_a_question_bank
end
it "should delete a question bank" do
should_delete_a_question_bank
end
end
end

View File

@ -1,45 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/statistics_common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/statistics_specs')
describe "account admin statistics" do
describe "shared statistics specs" do
it_should_behave_like "in-process server selenium tests"
let(:url) { "/accounts/#{Account.default.id}/statistics" }
let(:account) { Account.default }
let(:list_css) { {:created => '#recently_created_item_list', :started => '#recently_started_item_list', :ended => '#recently_ended_item_list', :logged_in => '#recently_logged_in_item_list'} }
context "with admin initially logged in" do
before (:each) do
@course = Course.create!(:name => 'stats', :account => account)
@course.offer!
admin_logged_in
end
it "should validate recently created courses display" do
should_validate_recently_created_courses_display
end
it "should validate recently started courses display" do
should_validate_recently_started_courses_display
end
it "should validate no info in list display" do
should_validate_no_info_in_list_display
end
it "should validate link works in list" do
should_validate_link_works_in_list
end
it "should validate recently ended courses display" do
should_validate_recently_ended_courses_display
end
end
it "should validate recently logged-in courses display" do
should_validate_recently_logged_in_courses_display
end
it_should_behave_like "statistics basic tests"
end
end

View File

@ -1,188 +1,143 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/external_tools_common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/settings_common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/settings_specs')
describe "site admin settings tabs" do
describe "external tools tests" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "external tools tests"
before(:each) do
# course_with_
site_admin_logged_in
get "/accounts/#{Account.default.id}/settings"
end
before(:each) do
# course_with_
site_admin_logged_in
get "/accounts/#{Account.default.id}/settings"
end
context "settings tab" do
it "cal2 checkbox should toggle visibility of enable scheduler checkbox" do
f("#show_scheduler_checkbox").should_not be_displayed
f("#account_settings_enable_scheduler").click
f("#show_scheduler_checkbox").should be_displayed
end
context "settings tab" do
it "cal2 checkbox should toggle visibility of enable scheduler checkbox" do
f("#show_scheduler_checkbox").should_not be_displayed
f("#account_settings_enable_scheduler").click
f("#show_scheduler_checkbox").should be_displayed
end
end
end
describe "admin settings tabs" do
describe "external tools tests" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "external tools tests"
before (:each) do
course_with_admin_logged_in
get "/accounts/#{Account.default.id}/settings"
end
context "external tools tab" do
before (:each) do
f("#tab-tools-link").click
end
it "should add a manual external tool" do
add_external_tool
end
it "should add a manual external tool with an url and a work-flow state of public " do
add_external_tool :manual_url, :public
end
it "should add a manual external tool with work-flow state of name_only " do
add_external_tool :name_only
end
it "should add xml external tool" do
add_external_tool :xml
end
it "should add url external tool" do
#pending("failing because of external dependency")
add_external_tool :url
end
it "should delete an external tool" do
add_external_tool
hover_and_click(".delete_tool_link:visible")
driver.switch_to.alert.accept
wait_for_ajax_requests
tool = ContextExternalTool.last
tool.workflow_state.should == "deleted"
f("#external_tool#{tool.id} .name").should be_nil
end
it "should should edit an external tool" do
add_external_tool
new_description = "a different description"
hover_and_click(".edit_tool_link:visible")
replace_content(f("#external_tool_description"), new_description)
fj(".save_button:visible").click
wait_for_ajax_requests
tool = ContextExternalTool.last
tool.description.should == new_description
f("#external_tool_#{tool.id} .description").text.should == new_description
end
end
context "announcements tab" do
def date_chooser(date = "n")
today = f(".ui-datepicker-calendar .ui-state-highlight").text.to_i
days = ff("#ui-datepicker-div .ui-state-default").count
time= Time.now
if (date == "t")
if (today == days)
ff("#ui-datepicker-div .ui-icon")[1].click
ff("#ui-datepicker-div .ui-state-default")[0].click
else
ff("#ui-datepicker-div .ui-state-default")[today].click
end
time = time + 86400
else
f(".ui-datepicker-calendar .ui-state-highlight").click
end
f("#ui-datepicker-div button[type='button']").click
time.strftime("%Y-%m-%d")
end
def add_announcement
fj(".element_toggler:visible").click
subject = "This is a date change"
f("#account_notification_subject").send_keys(subject)
f("#account_notification_icon .calendar").click
ff("#add_notification_form .ui-datepicker-trigger")[0].click
today = date_chooser
ff("#add_notification_form .ui-datepicker-trigger")[1].click
tomorrow = date_chooser("t")
type_in_tiny "textarea", "this is a message"
submit_form("#add_notification_form")
wait_for_ajax_requests
notification = AccountNotification.first
notification.message.should include_text("this is a message")
notification.subject.should include_text(subject)
notification.start_at.to_s.should include_text today
notification.end_at.to_s.should include_text tomorrow
f("#tab-announcements .user_content").text.should == "this is a message"
end
before (:each) do
course_with_admin_logged_in
get "/accounts/#{Account.default.id}/settings"
f("#tab-announcements-link").click
end
context "external tools tab" do
before (:each) do
f("#tab-tools-link").click
end
it "should add a manual external tool" do
add_external_tool
end
it "should add a manual external tool with an url and a work-flow state of public " do
add_external_tool :manual_url, :public
end
it "should add a manual external tool with work-flow state of name_only " do
add_external_tool :name_only
end
it "should add xml external tool" do
add_external_tool :xml
end
it "should add url external tool" do
#pending("failing because of external dependency")
add_external_tool :url
end
it "should delete an external tool" do
add_external_tool
hover_and_click(".delete_tool_link:visible")
driver.switch_to.alert.accept
wait_for_ajax_requests
tool = ContextExternalTool.last
tool.workflow_state.should == "deleted"
f("#external_tool#{tool.id} .name").should be_nil
end
it "should should edit an external tool" do
add_external_tool
new_description = "a different description"
hover_and_click(".edit_tool_link:visible")
replace_content(f("#external_tool_description"), new_description)
fj(".save_button:visible").click
wait_for_ajax_requests
tool = ContextExternalTool.last
tool.description.should == new_description
f("#external_tool_#{tool.id} .description").text.should == new_description
end
it "should add an announcement" do
add_announcement
end
context "announcements tab" do
def date_chooser(date = "n")
today = f(".ui-datepicker-calendar .ui-state-highlight").text.to_i
days = ff("#ui-datepicker-div .ui-state-default").count
time= Time.now
if (date == "t")
if (today == days)
ff("#ui-datepicker-div .ui-icon")[1].click
ff("#ui-datepicker-div .ui-state-default")[0].click
else
ff("#ui-datepicker-div .ui-state-default")[today].click
end
time = time + 86400
else
f(".ui-datepicker-calendar .ui-state-highlight").click
end
f("#ui-datepicker-div button[type='button']").click
time.strftime("%Y-%m-%d")
end
def add_announcement
fj(".element_toggler:visible").click
subject = "This is a date change"
f("#account_notification_subject").send_keys(subject)
f("#account_notification_icon .calendar").click
ff("#add_notification_form .ui-datepicker-trigger")[0].click
today = date_chooser
ff("#add_notification_form .ui-datepicker-trigger")[1].click
tomorrow = date_chooser("t")
type_in_tiny "textarea", "this is a message"
submit_form("#add_notification_form")
wait_for_ajax_requests
notification = AccountNotification.first
notification.message.should include_text("this is a message")
notification.subject.should include_text(subject)
notification.start_at.to_s.should include_text today
notification.end_at.to_s.should include_text tomorrow
f("#tab-announcements .user_content").text.should == "this is a message"
end
before (:each) do
f("#tab-announcements-link").click
end
it "should add an announcement" do
add_announcement
end
it "should delete an announcement" do
add_announcement
f(".delete_notification_link").click
driver.switch_to.alert.accept
wait_for_animations
AccountNotification.count.should == 0
end
it "should delete an announcement" do
add_announcement
f(".delete_notification_link").click
driver.switch_to.alert.accept
wait_for_animations
AccountNotification.count.should == 0
end
end
end
describe 'shared settings specs' do
it_should_behave_like "in-process server selenium tests"
describe "settings" do
let(:account) { Account.default }
let(:account_settings_url) { "/accounts/#{Account.default.id}/settings" }
let(:admin_tab_url) { "/accounts/#{Account.default.id}/settings#tab-users" }
before (:each) do
course_with_admin_logged_in
end
context "admins tab" do
before (:each) do
get "/accounts/#{account.id}/settings"
f("#tab-users-link").click
end
it "should add an account admin" do
should_add_an_account_admin
end
it "should delete an account admin" do
should_delete_an_account_admin
end
end
context "account settings" do
before (:each) do
get account_settings_url
end
it "should change the account name " do
should_change_the_account_name
end
it "should change the default file quota" do
should_change_the_default_file_quota
end
it "should change the default language to spanish" do
should_change_the_default_language_to_spanish
end
end
it_should_behave_like "settings basic tests"
end
end

View File

@ -10,10 +10,7 @@ describe "admin courses tab" do
let(:account) { Account.default }
let(:url) { "/accounts/#{account.id}/users" }
let(:opts) { {:name => 'student'} }
it "should add a new user" do
should_add_a_new_user
end
it_should_behave_like "users basic tests"
end
end

View File

@ -1,177 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/permissions_common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/permissions_specs')
describe "account permissions" do
describe "shared permission specs" do
it_should_behave_like "in-process server selenium tests"
describe "shared permission specs" do
let(:url) { "/accounts/#{Account.default.id}/permissions?account_roles=1" }
let(:account) { Account.default }
before (:each) do
course_with_admin_logged_in
end
describe "Adding new roles" do
before do
get url
end
it "adds a new account role" do
role_name = "an account role"
f("#account_role_link").click
f('#account-roles-tab .new-role a.dropdown-toggle').click
f('#account-roles-tab .new-role form input').send_keys(role_name)
f('#account-roles-tab .new-role button').click
wait_for_ajax_requests
f('#account-roles-tab').should include_text(role_name)
end
it "adds a new course role" do
role_name = "a course role"
f("#course_role_link").click
f('#course-roles-tab .new-role a.dropdown-toggle').click
f('#course-roles-tab .new-role form input').send_keys(role_name)
f('#course-roles-tab .new-role button').click
wait_for_ajax_requests
f('#course-roles-tab').should include_text(role_name)
end
end
describe "Removing roles" do
context "when deleting account roles" do
let!(:role_name) { "delete this account role" }
before do
add_new_account_role role_name
get url
end
it "deletes a role" do
f("#account_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#account-roles-tab').should_not include_text(role_name)
end
end
context "when deleting course roles" do
let!(:role_name) { "delete this course role" }
before do
add_new_course_role role_name
get url
end
it "deletes a role" do
f("#course_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#course-roles-tab').should_not include_text(role_name)
end
end
end
describe "Managing roles" do
context "when managing account roles" do
let!(:role_name) { "TestAcccountRole" }
let!(:permission_name) { "read_sis" } # Everyone should have this permission
let!(:role) { add_new_account_role role_name }
before do
get url
f("#account_role_link").click
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
context "when managing course roles" do
let!(:role_name) { "TestCourseRole" }
let!(:permission_name) { "read_sis" } # Everyone should have this permission
let!(:role) { add_new_course_role role_name }
before do
f("#course_role_link").click
get url
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
end
it_should_behave_like "permission tests"
end
end

View File

@ -1,177 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../../common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/permissions_common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/permissions_specs')
describe "sub account permissions" do
describe "shared permission specs" do
it_should_behave_like "in-process server selenium tests"
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/permissions?account_roles=1" }
before (:each) do
course_with_admin_logged_in
end
describe "Adding new roles" do
before do
get url
end
it "adds a new account role" do
role_name = "an account role"
f("#account_role_link").click
f('#account-roles-tab .new-role a.dropdown-toggle').click
f('#account-roles-tab .new-role form input').send_keys(role_name)
f('#account-roles-tab .new-role button').click
wait_for_ajax_requests
f('#account-roles-tab').should include_text(role_name)
end
it "adds a new course role" do
role_name = "a course role"
f("#course_role_link").click
f('#course-roles-tab .new-role a.dropdown-toggle').click
f('#course-roles-tab .new-role form input').send_keys(role_name)
f('#course-roles-tab .new-role button').click
wait_for_ajax_requests
f('#course-roles-tab').should include_text(role_name)
end
end
describe "Removing roles" do
context "when deleting account roles" do
let!(:role_name) { "delete this account role" }
before do
add_new_account_role role_name
get url
end
it "deletes a role" do
f("#account_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#account-roles-tab').should_not include_text(role_name)
end
end
context "when deleting course roles" do
let!(:role_name) { "delete this course role" }
before do
add_new_course_role role_name
get url
end
it "deletes a role" do
f("#course_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#course-roles-tab').should_not include_text(role_name)
end
end
end
describe "Managing roles" do
context "when managing account roles" do
let!(:role_name) { "TestAcccountRole" }
let!(:permission_name) { "read_sis" } # Everyone should have this permission
let!(:role) { add_new_account_role role_name }
before do
get url
f("#account_role_link").click
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
context "when managing course roles" do
let!(:role_name) { "TestCourseRole" }
let!(:permission_name) { "read_sis" } # Everyone should have this permission
let!(:role) { add_new_course_role role_name }
before do
f("#course_role_link").click
get url
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
end
it_should_behave_like "permission tests"
end
end

View File

@ -1,30 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../../common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/question_bank_common.rb')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/question_banks_specs')
describe "sub account question banks" do
it_should_behave_like "in-process server selenium tests"
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/question_banks" }
before (:each) do
admin_logged_in
get url
end
it "should verify question bank is found by navigating to bookmark" do
should_verify_question_bank_is_found_by_navigating_to_bookmark
end
it "should unbookmark a question bank" do
should_unbookmark_a_question_bank
end
it "should edit a question bank" do
should_edit_a_question_bank
end
it "should delete a question bank" do
should_delete_a_question_bank
end
describe "shared question bank specs" do
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/question_banks" }
it_should_behave_like "question bank basic tests"
end
end

View File

@ -1,48 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../../common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/settings_common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/settings_specs')
describe "sub account settings" do
it_should_behave_like "in-process server selenium tests"
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:account_settings_url) { "/accounts/#{account.id}/settings" }
let(:admin_tab_url) { "/accounts/#{account.id}/settings#tab-users" }
before (:each) do
course_with_admin_logged_in
end
context "admins tab" do
before (:each) do
get "/accounts/#{account.id}/settings"
f("#tab-users-link").click
end
it "should add an account admin" do
should_add_an_account_admin
end
it "should delete an account admin" do
should_delete_an_account_admin
end
end
context "account settings" do
before (:each) do
get account_settings_url
end
it "should change the account name " do
should_change_the_account_name
end
it "should change the default file quota" do
should_change_the_default_file_quota
end
it "should change the default language to spanish" do
should_change_the_default_language_to_spanish
end
describe "shared settings specs" do
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:account_settings_url) { "/accounts/#{account.id}/settings" }
let(:admin_tab_url) { "/accounts/#{account.id}/settings#tab-users" }
it_should_behave_like "settings basic tests"
end
end

View File

@ -1,49 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../../common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/statistics_common')
require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/statistics_specs')
describe "sub account statistics" do
describe "shared statistics specs" do
it_should_behave_like "in-process server selenium tests"
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/statistics" }
let(:list_css) { {:started => '#recently_started_item_list', :ended => '#recently_ended_item_list', :logged_in => '#recently_logged_in_item_list'} }
context "with admin initially logged in" do
before (:each) do
@course = Course.create!(:name => 'stats', :account => account)
@course.offer!
admin_logged_in
end
it "should validate recently created courses display" do
pending('spec is broken on sub account level')
should_validate_recently_created_courses_display
end
it "should validate recently started courses display" do
pending('spec is broken on sub account level')
should_validate_recently_started_courses_display
end
it "should validate no info in list display" do
should_validate_no_info_in_list_display
end
it "should validate link works in list" do
pending('spec is broken on sub account level')
should_validate_link_works_in_list
end
it "should validate recently ended courses display" do
pending('spec is broken on sub account level')
should_validate_recently_ended_courses_display
end
end
it "should validate recently logged-in courses display" do
should_validate_recently_logged_in_courses_display
end
it_should_behave_like "statistics basic tests"
end
end

View File

@ -3,12 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../helpers/basic/users_sp
describe "sub account users" do
describe "shared users specs" do
it_should_behave_like "in-process server selenium tests"
it "should add a new user" do
pending('newly added user in sub account does not show up')
should_add_a_new_user
end
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/users" }
let(:opts) { {:name => 'student'} }
it_should_behave_like "users basic tests"
end
end

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "equation editor" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
it "should support multiple equation editors on the same page" do
course_with_teacher_logged_in
@ -14,7 +13,6 @@ describe "equation editor" do
submit_form('.question_form')
wait_for_ajaximations
end
wait_for_tiny(f("#quiz_description"))
2.times do |time|

View File

@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/helpers/external_tools_common')
describe "editing external tools" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "external tools tests"
before (:each) do
course_with_teacher_logged_in

View File

@ -93,5 +93,6 @@ module AssignmentOverridesSeleniumHelper
override.due_at_overridden = true
override.save!
end
end

View File

@ -1,49 +0,0 @@
def select_enable(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[0].click # 0 is Enable
wait_for_ajax_requests #Every select needs to wait for for the request to finish
end
def select_enable_and_lock(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[1].click # 1 is enabled and locked
wait_for_ajax_requests
end
def select_disable(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[2].click # 2 is Disabled
wait_for_ajax_requests
end
def select_disable_and_lock(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[3].click # 3 is Disabled and locked
wait_for_ajax_requests
end
def add_new_account_role(role_name)
role = account.roles.build({:name => role_name})
role.base_role_type = "AccountMembership"
role.save!
role
end
def add_new_course_role(role_name, role_type = "StudentEnrollment")
role = account.roles.build({:name => role_name})
role.base_role_type = role_type
role.save!
role
end

View File

@ -0,0 +1,219 @@
shared_examples_for "permission tests" do
it_should_behave_like "in-process server selenium tests"
before (:each) do
course_with_admin_logged_in
end
def select_enable(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[0].click # 0 is Enable
wait_for_ajax_requests #Every select needs to wait for for the request to finish
end
def select_enable_and_lock(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[1].click # 1 is enabled and locked
wait_for_ajax_requests
end
def select_disable(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[2].click # 2 is Disabled
wait_for_ajax_requests
end
def select_disable_and_lock(permission_name, role_name)
permission_button = fj("[data-permission_name='#{permission_name}'].[data-role_name='#{role_name}']")
permission_button.find_element(:css, "a").click
options = permission_button.find_elements(:css, ".dropdown-menu label")
options[3].click # 3 is Disabled and locked
wait_for_ajax_requests
end
def add_new_account_role(role_name)
role = account.roles.build({:name => role_name})
role.base_role_type = "AccountMembership"
role.save!
role
end
def add_new_course_role(role_name, role_type = "StudentEnrollment")
role = account.roles.build({:name => role_name})
role.base_role_type = role_type
role.save!
role
end
describe "Adding new roles" do
before do
get url
end
it "adds a new account role" do
role_name = "an account role"
f("#account_role_link").click
f('#account-roles-tab .new-role a.dropdown-toggle').click
f('#account-roles-tab .new-role form input').send_keys(role_name)
f('#account-roles-tab .new-role button').click
wait_for_ajax_requests
f('#account-roles-tab').should include_text(role_name)
end
it "adds a new course role" do
role_name = "a course role"
f("#course_role_link").click
f('#course-roles-tab .new-role a.dropdown-toggle').click
f('#course-roles-tab .new-role form input').send_keys(role_name)
f('#course-roles-tab .new-role button').click
wait_for_ajax_requests
f('#course-roles-tab').should include_text(role_name)
end
end
describe "Removing roles" do
context "when deleting account roles" do
let!(:role_name) {"delete this account role"}
before do
add_new_account_role role_name
get url
end
it "deletes a role" do
f("#account_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#account-roles-tab').should_not include_text(role_name)
end
end
context "when deleting course roles" do
let!(:role_name) {"delete this course role"}
before do
add_new_course_role role_name
get url
end
it "deletes a role" do
f("#course_role_link").click
f(".roleHeader a").click
driver.switch_to.alert.accept
wait_for_ajax_requests
f('#course-roles-tab').should_not include_text(role_name)
end
end
end
describe "Managing roles" do
context "when managing account roles" do
let!(:role_name) {"TestAcccountRole"}
let!(:permission_name) {"read_sis"} # Everyone should have this permission
let!(:role) { add_new_account_role role_name }
before do
get url
f("#account_role_link").click
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
context "when managing course roles" do
let!(:role_name) {"TestCourseRole"}
let!(:permission_name) {"read_sis"} # Everyone should have this permission
let!(:role) { add_new_course_role role_name }
before do
f("#course_role_link").click
get url
end
it "enables a permission" do
select_enable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_false
end
it "locks and enables a permission" do
select_enable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_true
role_override.locked.should be_true
end
it "disables a permission" do
select_disable(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_false
end
it "locks and disables a permission" do
select_disable_and_lock(permission_name, role_name)
role_override = RoleOverride.find_by_enrollment_type(role.name)
role_override.enabled.should be_false
role_override.locked.should be_true
end
it "sets a permission to default"
it "sets a permission to default and locked"
end
end
end

View File

@ -1,4 +1,9 @@
shared_examples_for "question bank basic tests" do
it_should_behave_like "in-process server selenium tests"
before (:each) do
admin_logged_in
get url
end
def add_question_bank(title = 'bank 1')
question_bank_title = keep_trying_until do
@ -18,14 +23,14 @@
question_bank
end
def should_verify_question_bank_is_found_by_navigating_to_bookmark
it "should verify question bank is found by navigating to bookmark" do
question_bank = add_question_bank
expect_new_page_load { f(".see_bookmarked_banks").click }
wait_for_ajaximations
f("#question_bank_#{question_bank.id}").should include_text question_bank.title
end
def should_unbookmark_a_question_bank
it "should un-bookmark a question bank" do
question_bank = add_question_bank
fj(".bookmark_bank_link img:visible").should have_attribute(:alt, "Bookmark")
fj(".bookmark_bank_link:visible").click
@ -35,7 +40,7 @@
question_bank.bookmarked_for?(User.last).should be_false
end
def should_edit_a_question_bank
it "should edit a question bank" do
new_title = "bank 2"
question_bank = add_question_bank
f("#questions .edit_bank_link").click
@ -47,7 +52,7 @@
f("#questions .title").should include_text new_title
end
def should_delete_a_question_bank
it "should delete a question bank" do
question_bank = add_question_bank
f("#questions .delete_bank_link").click
driver.switch_to.alert.accept
@ -58,3 +63,4 @@
f("#questions .title").should be_nil
end
end
end

View File

@ -1,3 +1,12 @@
shared_examples_for "settings basic tests" do
it_should_behave_like "in-process server selenium tests"
before (:each) do
course_with_admin_logged_in
end
context "admins tab" do
def add_account_admin
address = "student1@example.com"
f(".add_users_link").click
@ -16,24 +25,36 @@
admin.id
end
def click_submit
submit_form("#account_settings")
wait_for_ajax_requests
before (:each) do
get "/accounts/#{account.id}/settings"
f("#tab-users-link").click
end
def should_add_an_account_admin
it "should add an account admin" do
add_account_admin
end
def should_delete_an_account_admin
it "should delete an account admin" do
admin_id = add_account_admin
f("#enrollment_#{admin_id} .remove_account_user_link").click
driver.switch_to.alert.accept
wait_for_ajax_requests
AccountUser.find_by_id(admin_id).should be_nil
end
end
def should_change_the_account_name
context "account settings" do
def click_submit
submit_form("#account_settings")
wait_for_ajax_requests
end
before (:each) do
get account_settings_url
end
it "should change the account name " do
new_account_name = 'new default account name'
replace_content(f("#account_name"), new_account_name)
click_submit
@ -42,7 +63,7 @@
f("#account_name").should have_value(new_account_name)
end
def should_change_the_default_file_quota
it "should change the default file quota" do
mb = 300
quota_input = f("#account_default_course_storage_quota")
quota_input.should have_value("500")
@ -54,10 +75,12 @@
fj("#account_default_course_storage_quota").should have_value("300") # fj to avoid selenium caching
end
def should_change_the_default_language_to_spanish
it "should change the default language to spanish" do
f("#account_default_locale option[value='es']").click
click_submit
account.reload
account.default_locale.should == "es"
f("label[for='account_name']").text.should include_text("Nombre de Cuenta")
end
end
end

View File

@ -1,49 +0,0 @@
def item_lists
ff('.item_list')
end
def validate_item_list(css, header_text)
f(css).text.should include_text(header_text)
end
def should_validate_recently_created_courses_display
get url
validate_item_list(list_css[:created], @course.name)
end
def should_validate_recently_started_courses_display
get url
validate_item_list(list_css[:started], @course.name)
end
def should_validate_no_info_in_list_display
get url
validate_item_list(list_css[:ended], 'None to show')
end
def should_validate_link_works_in_list
get url
expect_new_page_load { f(list_css[:started]).find_element(:css, '.header').click }
f('#section-tabs-header').should include_text(@course.name)
end
def should_validate_recently_ended_courses_display
concluded_course = Course.create!(:name => 'concluded course', :account => account)
concluded_course.update_attributes(:conclude_at => 1.day.ago)
get url
validate_item_list(list_css[:ended], concluded_course.name)
end
def should_validate_recently_logged_in_courses_display
course = Course.create!(:name => 'new course', :account => account)
course.offer!
student = User.create!(:name => 'Example Student')
student.register!
pseudonym = student.pseudonyms.create!(:unique_id => 'student@example.com', :password => 'asdfasdf', :password_confirmation => 'asdfasdf')
course.enroll_user(student, 'StudentEnrollment').accept!
login_as(pseudonym.unique_id, 'asdfasdf')
driver.navigate.to(app_host + '/logout')
admin_logged_in
get url
validate_item_list(list_css[:logged_in], student.name)
end

View File

@ -0,0 +1,66 @@
shared_examples_for "statistics basic tests" do
it_should_behave_like "in-process server selenium tests"
def item_lists
ff('.item_list')
end
def validate_item_list(css, header_text)
f(css).text.should include_text(header_text)
end
context "with admin initially logged in" do
before (:each) do
@course = Course.create!(:name => 'stats', :account => account)
@course.offer!
admin_logged_in
end
it "should validate recently started courses display" do
pending('list is not available on sub account level') if account != Account.default
get url
validate_item_list(list_css[:created], @course.name)
end
it "should validate recently started courses display" do
pending('spec is broken on sub account level') if account != Account.default
get url
validate_item_list(list_css[:started], @course.name)
end
it "should validate no info in list display" do
get url
validate_item_list(list_css[:ended], 'None to show')
end
it "should validate link works in list" do
pending('spec is broken on sub account level') if account != Account.default
get url
expect_new_page_load { f(list_css[:started]).find_element(:css, '.header').click }
f('#section-tabs-header').should include_text(@course.name)
end
it "should validate recently ended courses display" do
pending('spec is broken on sub account level') if account != Account.default
concluded_course = Course.create!(:name => 'concluded course', :account => account)
concluded_course.update_attributes(:conclude_at => 1.day.ago)
get url
validate_item_list(list_css[:ended], concluded_course.name)
end
end
it "should validate recently logged-in courses display" do
course = Course.create!(:name => 'new course', :account => account)
course.offer!
student = User.create!(:name => 'Example Student')
student.register!
pseudonym = student.pseudonyms.create!(:unique_id => 'student@example.com', :password => 'asdfasdf', :password_confirmation => 'asdfasdf')
course.enroll_user(student, 'StudentEnrollment').accept!
login_as(pseudonym.unique_id, 'asdfasdf')
driver.navigate.to(app_host + '/logout')
admin_logged_in
get url
validate_item_list(list_css[:logged_in], student.name)
end
end

View File

@ -1,7 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../..//helpers/shared_user_methods')
shared_examples_for "users basic tests" do
it_should_behave_like "in-process server selenium tests"
def should_add_a_new_user
it "should add a new user" do
pending('newly added user in sub account does not show up') if account != Account.default
course_with_admin_logged_in
get url
user = add_user(opts)
@ -9,3 +12,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../..//helpers/shared_user_m
f("#user_#{user.id}").should be_displayed
f("#user_#{user.id}").should include_text(opts[:name])
end
end

View File

@ -1,5 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
shared_examples_for "external tools tests" do
it_should_behave_like "in-process server selenium tests"
def add_external_tool (*opts)
name = "external tool"
key = "1234567"
@ -201,3 +204,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
</cartridge_basiclti_link>
XML
end
end

View File

@ -1,6 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
#when 'teacher'; course_with_teacher_logged_in
#when 'student'; course_with_student_logged_in
#when 'admin'; course_with_admin_logged_in
def import_account_level_outcomes
keep_trying_until do
f(".btn-primary").click

View File

@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
shared_examples_for "quizzes selenium tests" do
it_should_behave_like "in-process server selenium tests"
def create_multiple_choice_question
question = fj(".question_form:visible")
@ -337,3 +339,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
target = "#group_top_#{group_id} + *"
js_drag_and_drop source, target
end
end

View File

@ -1,73 +0,0 @@
def should_register_a_new_user
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys('new@example.com')
f('#user_type_new').click
f("#student_name").send_keys('new guy')
f('#enroll_form input[name="user[terms_of_use]"]').click
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
def should_authenticate_and_register_an_existing_user_open
user_with_pseudonym(:active_all => true, :username => "existing@example.com", :password => "asdfasdf")
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys("existing@example.com")
f('#user_type_existing').click
f("#student_password").send_keys("asdfasdf")
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
def should_register_an_authenticated_user_open
user_logged_in
get "/enroll/#{@course.self_enrollment_code}"
# no option to log in/register, since already authenticated
f("input[name='pseudonym[unique_id]']").should be_nil
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
def should_not_register_a_new_user
get "/enroll/#{@course.self_enrollment_code}"
f("input[type=radio][name=user_type]").should be_nil
f("input[name='user[name]']").should be_nil
end
def should_authenticate_and_register_an_existing_user
user_with_pseudonym(:active_all => true, :username => "existing@example.com", :password => "asdfasdf")
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys("existing@example.com")
f("#student_password").send_keys("asdfasdf")
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
def should_register_an_authenticated_user_closed
user_logged_in
get "/enroll/#{@course.self_enrollment_code}"
# no option to log in/register, since already authenticated
f("input[name='pseudonym[unique_id]']").should be_nil
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "One Question at a Time Quizzes" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
def create_oqaat_quiz(opts={})

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quizzes question banks" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
before (:each) do
course_with_teacher_logged_in

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quizzes question creation" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
before (:each) do
course_with_teacher_logged_in

View File

@ -1,6 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/self_enrollment_common')
describe "self enrollment" do
it_should_behave_like "in-process server selenium tests"
@ -16,159 +14,146 @@ describe "self enrollment" do
end
end
shared_examples_for "open registration" do
before do
Account.default.update_attribute(:settings, :self_enrollment => 'any', :open_registration => true, :self_registration => true)
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should register a new user" do
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys('new@example.com')
f('#user_type_new').click
f("#student_name").send_keys('new guy')
f('#enroll_form input[name="user[terms_of_use]"]').click
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
it "should authenticate and register an existing user" do
user_with_pseudonym(:active_all => true, :username => "existing@example.com", :password => "asdfasdf")
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys("existing@example.com")
f('#user_type_existing').click
f("#student_password").send_keys("asdfasdf")
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
it "should register an authenticated user" do
user_logged_in
get "/enroll/#{@course.self_enrollment_code}"
# no option to log in/register, since already authenticated
f("input[name='pseudonym[unique_id]']").should be_nil
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
end
shared_examples_for "closed registration" do
before do
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should not register a new user" do
get "/enroll/#{@course.self_enrollment_code}"
f("input[type=radio][name=user_type]").should be_nil
f("input[name='user[name]']").should be_nil
end
it "should authenticate and register an existing user" do
user_with_pseudonym(:active_all => true, :username => "existing@example.com", :password => "asdfasdf")
get "/enroll/#{@course.self_enrollment_code}"
f("#student_email").send_keys("existing@example.com")
f("#student_password").send_keys("asdfasdf")
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
it "should register an authenticated user" do
user_logged_in
get "/enroll/#{@course.self_enrollment_code}"
# no option to log in/register, since already authenticated
f("input[name='pseudonym[unique_id]']").should be_nil
expect_new_page_load {
submit_form("#enroll_form")
}
f('.btn-primary').text.should eql primary_action
get "/"
assert_valid_dashboard
end
end
context "in a published course" do
let(:active_course) { true }
let(:set_up_course) {}
let(:primary_action) { "Go to the Course" }
let(:active_course){ true }
let(:set_up_course){ }
let(:primary_action){ "Go to the Course" }
let(:assert_valid_dashboard) {
f('#courses_menu_item').should include_text("Courses")
}
context "with open registration" do
before do
Account.default.update_attribute(:settings, :self_enrollment => 'any', :open_registration => true, :self_registration => true)
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should register a new user" do
should_register_a_new_user
end
it "should authenticate and register an existing user open" do
should_authenticate_and_register_an_existing_user_open
end
it "should register an authenticated user open" do
should_register_an_authenticated_user_open
end
it_should_behave_like "open registration"
end
context "without open registration" do
before do
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should not register a new user" do
should_not_register_a_new_user
end
it "should authenticate and register an existing user" do
should_authenticate_and_register_an_existing_user
end
it "should register an authenticated user closed" do
should_register_an_authenticated_user_closed
end
it_should_behave_like "closed registration"
end
end
context "in a not-yet-started course" do
let(:active_course) { true }
let(:active_course){ true }
let(:set_up_course) {
@course.start_at = 1.week.from_now
@course.restrict_enrollments_to_course_dates = true
@course.save!
}
let(:primary_action) { "Go to your Dashboard" }
let(:primary_action){ "Go to your Dashboard" }
let(:assert_valid_dashboard) {
f('#courses_menu_item').should include_text("Home")
f('#dashboard').should include_text("You've enrolled in one or more courses that have not started yet")
}
context "with open registration" do
before do
Account.default.update_attribute(:settings, :self_enrollment => 'any', :open_registration => true, :self_registration => true)
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should register a new user" do
should_register_a_new_user
end
it "should authenticate and register an existing user open" do
should_authenticate_and_register_an_existing_user_open
end
it "should register an authenticated user open" do
should_register_an_authenticated_user_open
end
it_should_behave_like "open registration"
end
context "without open registration" do
before do
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should not register a new user" do
should_not_register_a_new_user
end
it "should authenticate and register an existing user" do
should_authenticate_and_register_an_existing_user
end
it "should register an authenticated user closed" do
should_register_an_authenticated_user_closed
end
it_should_behave_like "closed registration"
end
end
context "in an unpublished course" do
let(:active_course) { false }
let(:set_up_course) {}
let(:primary_action) { "Go to your Dashboard" }
let(:active_course){ false }
let(:set_up_course){ }
let(:primary_action){ "Go to your Dashboard" }
let(:assert_valid_dashboard) {
f('#courses_menu_item').should include_text("Home")
f('#dashboard').should include_text("You've enrolled in one or more courses that have not started yet")
}
context "with open registration" do
before do
Account.default.update_attribute(:settings, :self_enrollment => 'any', :open_registration => true, :self_registration => true)
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should register a new user" do
should_register_a_new_user
end
it "should authenticate and register an existing user open" do
should_authenticate_and_register_an_existing_user_open
end
it "should register an authenticated user open" do
should_register_an_authenticated_user_open
end
it_should_behave_like "open registration"
end
context "without open registration" do
before do
course(:active_all => active_course)
set_up_course
@course.update_attribute(:self_enrollment, true)
end
it "should not register a new user" do
should_not_register_a_new_user
end
it "should authenticate and register an existing user" do
should_authenticate_and_register_an_existing_user
end
it "should register an authenticated user closed" do
should_register_an_authenticated_user_closed
end
it_should_behave_like "closed registration"
end
end
end

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quizzes" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
context "as a student" do
before (:each) do

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quizzes questions" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
before (:each) do
course_with_teacher_logged_in

View File

@ -1,11 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignment_overrides.rb')
describe "quizzes" do
it_should_behave_like "in-process server selenium tests"
include AssignmentOverridesSeleniumHelper
it_should_behave_like "quizzes selenium tests"
context "as a teacher" do
let(:due_at) { Time.zone.now }
@ -557,21 +555,20 @@ describe "quizzes" do
wait_for_ajaximations
select_first_override_section(default_section.name)
first_due_at_element.clear
first_due_at_element.send_keys(default_section_due.strftime('%b %-d, %y'))
first_due_at_element.
send_keys(default_section_due.strftime('%b %-d, %y'))
add_override
select_last_override_section(other_section.name)
last_due_at_element.send_keys(other_section_due.strftime('%b %-d, %y'))
last_due_at_element.
send_keys(other_section_due.strftime('%b %-d, %y'))
expect_new_page_load do
click_save_settings_button
wait_for_ajaximations
wait_for_ajax_requests
end
overrides = @quiz.reload.assignment_overrides
overrides.size.should == 2
default_override = overrides.detect { |o| o.set_id == default_section.id }
default_override.due_at.strftime('%b %-d, %y').
should == default_section_due.to_date.strftime('%b %-d, %y')

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quiz statistics" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
context "as a teacher" do

View File

@ -1,8 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "quizzes students" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
context "as a teacher " do

View File

@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
describe "Wiki pages and Tiny WYSIWYG editor Images" do
it_should_behave_like "in-process server selenium tests"
it_should_behave_like "quizzes selenium tests"
context "wiki and tiny images as a teacher" do
@ -52,7 +52,7 @@ describe "Wiki pages and Tiny WYSIWYG editor Images" do
images = ffj('#editor_tabs_4 .image_list .img')
images.length.should == 2
images.each { |i| i.should have_attribute('complete', 'true') } # - commented out because it is breaking with
#webdriver 2.22 and firefox 12
#webdriver 2.22 and firefox 12
end
end