RuboCop: Layout spec/selenium

Change-Id: I1337af0129203761719b5fdcee3799dd5dea611f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274127
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-09-22 09:06:31 -06:00
parent 6c03d6bf89
commit 1bf181eaa2
430 changed files with 3847 additions and 4177 deletions

View File

@ -27,19 +27,17 @@ describe "accessibility assignments", priority: "2" do
get "/courses/#{@course.id}/assignments"
end
it "should be accessible" do
val_image_alt_tags_not_empty
val_input_alt_tags_present
#pending('not passing') val_input_alt_tags_not_empty
# pending('not passing') val_input_alt_tags_not_empty
val_image_alt_tags_max_length
val_page_title_present
val_page_title_not_empty
val_html_lang_attribute_present
val_html_lang_attribute_not_empty
#pending('not passing') val_h1_populated
#pending('not passing') val_link_name_uniqueness
#pending('not passing')val_all_tables_have_heading
# pending('not passing') val_h1_populated
# pending('not passing') val_link_name_uniqueness
# pending('not passing')val_all_tables_have_heading
end
end

View File

@ -34,7 +34,6 @@ describe "account" do
end
describe "term create/update" do
it "should be able to add a term" do
get "/accounts/#{Account.default.id}/terms"
f(".add_term_link").click
@ -66,11 +65,11 @@ describe "account" do
f(".submit_button").click
expect(term).not_to have_class("editing_term")
verify_displayed_term_dates(term, {
:general => ["Jul 1", "Jul 31"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["whenever", "term end"]
})
:general => ["Jul 1", "Jul 31"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["whenever", "term end"]
})
end
it 'student enrollment dates', priority: 1, test_id: 1621632 do
@ -82,11 +81,11 @@ describe "account" do
f(".submit_button").click
expect(term).not_to have_class("editing_term")
verify_displayed_term_dates(term, {
:general => ["whenever", "whenever"],
:student_enrollment => ["Jul 2", "Jul 30"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["whenever", "term end"]
})
:general => ["whenever", "whenever"],
:student_enrollment => ["Jul 2", "Jul 30"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["whenever", "term end"]
})
end
it 'teacher enrollment dates', priority: 1, test_id: 1621633 do
@ -98,11 +97,11 @@ describe "account" do
f(".submit_button").click
expect(term).not_to have_class("editing_term")
verify_displayed_term_dates(term, {
:general => ["whenever", "whenever"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["Jul 3", "Jul 29"],
:ta_enrollment => ["whenever", "term end"]
})
:general => ["whenever", "whenever"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["Jul 3", "Jul 29"],
:ta_enrollment => ["whenever", "term end"]
})
end
it 'ta enrollment dates', priority: 1, test_id: 1621934 do
@ -114,11 +113,11 @@ describe "account" do
f(".submit_button").click
expect(term).not_to have_class("editing_term")
verify_displayed_term_dates(term, {
:general => ["whenever", "whenever"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["Jul 4", "Jul 28"]
})
:general => ["whenever", "whenever"],
:student_enrollment => ["term start", "term end"],
:teacher_enrollment => ["whenever", "term end"],
:ta_enrollment => ["Jul 4", "Jul 28"]
})
end
end

View File

@ -22,7 +22,7 @@ require_relative '../common'
describe "add_people" do
include_context "in-process server selenium tests"
let(:enrollee_count){0}
let(:enrollee_count) { 0 }
context "as a teacher" do
before(:each) do
@ -81,34 +81,34 @@ describe "add_people" do
end
it "should tell our user when not adding any users to the course" do
get "/courses/#{@course.id}/users"
get "/courses/#{@course.id}/users"
# open the dialog
f('a#addUsers').click
expect(f(".addpeople")).to be_displayed
# open the dialog
f('a#addUsers').click
expect(f(".addpeople")).to be_displayed
# search for some gibberish
replace_content(f(".addpeople__peoplesearch textarea"), "jibberish@example.com")
# search for some gibberish
replace_content(f(".addpeople__peoplesearch textarea"), "jibberish@example.com")
# click next button
f("#addpeople_next").click
# click next button
f("#addpeople_next").click
# the validation issues panel is displayed
expect(f(".addpeople__peoplevalidationissues")).to be_displayed
# the validation issues panel is displayed
expect(f(".addpeople__peoplevalidationissues")).to be_displayed
# click the next button
f("#addpeople_next").click
# click the next button
f("#addpeople_next").click
# the people ready panel is displayed
people_ready_panel = f('.addpeople__peoplereadylist')
expect(people_ready_panel).to be_displayed
# the people ready panel is displayed
people_ready_panel = f('.addpeople__peoplereadylist')
expect(people_ready_panel).to be_displayed
# no table
expect(f('body')).not_to contain_css('.addpeople__peoplereadylist table')
# no table
expect(f('body')).not_to contain_css('.addpeople__peoplereadylist table')
# the message_user_path
msg = fj(".addpeople__peoplereadylist:contains('No users were selected to add to the course')")
expect(msg).to be_displayed
# the message_user_path
msg = fj(".addpeople__peoplereadylist:contains('No users were selected to add to the course')")
expect(msg).to be_displayed
end
it "should include only manageable roles (non-granular)" do
@ -155,7 +155,6 @@ describe "add_people" do
# check the checkbox again
f('label[for="limit_privileges_to_course_section"]').click
expect(f('#limit_privileges_to_course_section')).to be_selected
end
# tests that INSTUI fixed a bug in Select that would close the Modal
@ -179,7 +178,6 @@ describe "add_people" do
expect(f(".addpeople")).to be_displayed # still
end
end
context('as an admin') do

View File

@ -29,7 +29,6 @@ describe 'account authentication' do
end
describe 'sso settings' do
let(:login_handle_name) { f('#sso_settings_login_handle_name') }
let(:change_password_url) { f('#sso_settings_change_password_url') }
let(:auth_discovery_url) { f('#sso_settings_auth_discovery_url') }
@ -54,9 +53,7 @@ describe 'account authentication' do
end
describe 'identity provider' do
context 'ldap' do
let!(:ldap_aac) { AuthenticationProvider::LDAP }
it 'should allow creation of config', priority: "1", test_id: 250262 do
@ -130,7 +127,6 @@ describe 'account authentication' do
end
context 'saml' do
let!(:saml_aac) { AuthenticationProvider::SAML }
it 'should allow creation of config', priority: "1", test_id: 250266 do
@ -253,7 +249,7 @@ describe 'account authentication' do
ap.reload
expect(ap.federated_attributes).to eq({ 'locale' => { 'attribute' => 'provider_locale',
'provisioning_only' => false} })
'provisioning_only' => false } })
expect(f("input[name='authentication_provider[federated_attributes][locale][attribute]']")[:value]).to eq 'provider_locale'
end
@ -274,7 +270,7 @@ describe 'account authentication' do
ap.reload
expect(ap.federated_attributes).to eq({ 'locale' => { 'attribute' => 'provider_locale',
'provisioning_only' => true} })
'provisioning_only' => true } })
expect(f("input[name='authentication_provider[federated_attributes][locale][attribute]']").attribute('value')).to eq 'provider_locale'
expect(is_checked("input[name='authentication_provider[federated_attributes][locale][provisioning_only]']:visible")).to eq true
end
@ -346,7 +342,6 @@ describe 'account authentication' do
end
context 'cas' do
let!(:cas_aac) { AuthenticationProvider::CAS }
it 'should allow creation of config', priority: "1", test_id: 250272 do
@ -382,7 +377,6 @@ describe 'account authentication' do
end
context 'facebook' do
let!(:facebook_aac) { AuthenticationProvider::Facebook }
it 'should allow creation of config', priority: "2", test_id: 250275 do
@ -419,7 +413,6 @@ describe 'account authentication' do
end
context 'github' do
let!(:github_aac) { AuthenticationProvider::GitHub }
it 'should allow creation of config', priority: "2", test_id: 250278 do
@ -460,7 +453,6 @@ describe 'account authentication' do
end
context 'google' do
let!(:google_aac) { AuthenticationProvider::Google }
it 'should allow creation of config', priority: "2", test_id: 250281 do
@ -498,7 +490,6 @@ describe 'account authentication' do
end
context 'linkedin' do
let!(:linkedin_aac) { AuthenticationProvider::LinkedIn }
it 'should allow creation of config', priority: "2", test_id: 250284 do
@ -536,7 +527,6 @@ describe 'account authentication' do
end
context 'openid connect' do
let!(:openid_aac) { AuthenticationProvider::OpenIDConnect }
it 'should allow creation of config', priority: "2", test_id: 250287 do
@ -583,7 +573,6 @@ describe 'account authentication' do
end
context 'twitter' do
let!(:twitter_aac) { AuthenticationProvider::Twitter }
it 'should allow creation of config', priority: "2", test_id: 250290 do
@ -621,7 +610,6 @@ describe 'account authentication' do
end
context 'microsoft' do
let!(:microsoft_aac) { AuthenticationProvider::Microsoft }
it 'should allow creation of config', priority: "2" do
@ -657,6 +645,5 @@ describe 'account authentication' do
expect(microsoft_aac.count).to eq 1
end
end
end
end

View File

@ -459,5 +459,4 @@ describe 'Developer Keys' do
end
end
end
end

View File

@ -34,7 +34,6 @@ describe "account admin grading schemes" do
end
describe "grading schemes" do
it "should add a grading scheme", priority: "1", test_id: 163992 do
should_add_a_grading_scheme
end
@ -50,7 +49,6 @@ describe "account admin grading schemes" do
end
describe "grading scheme items" do
before do
create_simple_standard_and_edit(account, url)
end

View File

@ -35,36 +35,36 @@ describe "account admin question bank" do
end
def create_question(name = "question 1", bank = @question_bank)
answers = [{:text => "correct answer", :weight => 100}]
answers = [{ :text => "correct answer", :weight => 100 }]
3.times do
answer = {:text => "incorrect answer", :weight => 0}
answer = { :text => "incorrect answer", :weight => 0 }
answers.push answer
end
data = {:question_text => "what is the answer to #{name}?", :question_type => 'multiple_choice_question', :answers => answers}
data = { :question_text => "what is the answer to #{name}?", :question_type => 'multiple_choice_question', :answers => answers }
data[:question_name] = name
question = AssessmentQuestion.create(:question_data => data)
bank.assessment_questions << question
question
end
def create_outcome (short_description = "good student")
def create_outcome(short_description = "good student")
outcome = Account.default.learning_outcomes.create!(
:short_description => short_description,
:rubric_criterion => {
:description => "test description",
:points_possible => 10,
:mastery_points => 9,
:ratings => [
{:description => "Exceeds Expectations", :points => 5},
{:description => "Meets Expectations", :points => 3},
{:description => "Does Not Meet Expectations", :points => 0}
]
})
:short_description => short_description,
:rubric_criterion => {
:description => "test description",
:points_possible => 10,
:mastery_points => 9,
:ratings => [
{ :description => "Exceeds Expectations", :points => 5 },
{ :description => "Meets Expectations", :points => 3 },
{ :description => "Does Not Meet Expectations", :points => 0 }
]
}
)
Account.default.root_outcome_group.add_outcome(outcome)
outcome
end
def verify_added_question(name, question_text, chosen_question_type)
question = AssessmentQuestion.where(name: name).first
expect(question).to be_present
@ -101,7 +101,7 @@ describe "account admin question bank" do
answer_inputs = ff(".form_answers .select_answer input")
answer_inputs[0].send_keys("correct answer")
(1..3).each do |i|
answer_inputs[i*2].send_keys("incorrect answer")
answer_inputs[i * 2].send_keys("incorrect answer")
wait_for_ajaximations
end
submit_form(question_form)
@ -189,7 +189,7 @@ describe "account admin question bank" do
question_number = question_count + 1
questions = []
questions.push @question
question_count.times { |i| questions.push create_question("question #{question_number+i}") }
question_count.times { |i| questions.push create_question("question #{question_number + i}") }
f(".move_questions_link").click
wait_for_ajaximations
question_list = ffj(".list_question:visible")

View File

@ -29,7 +29,7 @@ describe "quizzes" do
quiz.unpublish!
role = custom_account_role("other admin", :account => Account.default)
account_admin_user_with_role_changes(:role => role, :role_changes => {:read_course_content => true} )
account_admin_user_with_role_changes(:role => role, :role_changes => { :read_course_content => true })
user_with_pseudonym(:user => @admin)
user_session(@admin)

View File

@ -29,7 +29,6 @@ describe "account shared rubric specs" do
let(:account) { Account.default }
before(:each) do
course_with_admin_logged_in
end
@ -49,7 +48,6 @@ describe "account shared rubric specs" do
end
it "should round to an integer when splitting" do
should_round_to_an_integer_when_splitting
end

View File

@ -188,7 +188,7 @@ describe "root account basic settings" do
end
it "should be able to remove account quiz ip filters" do
account.ip_filters = {"name" => "192.168.217.1/24"}
account.ip_filters = { "name" => "192.168.217.1/24" }
account.save!
course_with_admin_logged_in
@ -199,7 +199,7 @@ describe "root account basic settings" do
account.reload
expect(account.settings[:ip_filters]).to be_present # should not have cleared them if we didn't do anything
filter = ff('.ip_filter').detect{|fil| fil.displayed?}
filter = ff('.ip_filter').detect { |fil| fil.displayed? }
filter.find_element(:css, '.delete_filter_link').click
expect_new_page_load { submit_form("#account_settings") }

View File

@ -141,11 +141,11 @@ describe "sis imports ui" do
expect(f(".sis_messages .sis_error_message")).to include_text "The import failed with these messages:"
expect(SisBatch.last.batch_mode).to eq true
expect(SisBatch.last.options).to eq({
skip_deletes: false,
override_sis_stickiness: true,
add_sis_stickiness: true,
update_sis_id_if_login_claimed: false
})
skip_deletes: false,
override_sis_stickiness: true,
add_sis_stickiness: true,
update_sis_id_if_login_claimed: false
})
get "/accounts/#{@account.id}/sis_import"
f("#override_sis_stickiness").click
@ -155,9 +155,9 @@ describe "sis imports ui" do
expect(f(".sis_messages .sis_error_message")).to include_text "The import failed with these messages:"
expect(!!SisBatch.last.batch_mode).to be_falsey
expect(SisBatch.last.options).to eq({
skip_deletes: false,
override_sis_stickiness: true,
update_sis_id_if_login_claimed: false
})
skip_deletes: false,
override_sis_stickiness: true,
update_sis_id_if_login_claimed: false
})
end
end

View File

@ -24,7 +24,7 @@ describe "account admin statistics" do
describe "shared statistics specs" do
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'} }
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' } }
include_examples "statistics basic tests"
end
end

View File

@ -32,7 +32,7 @@ describe "account admin terms" do
expect(term_header).to include_text("#{course_count} Course")
# TODO: pend until a better solution is found to calculate user counts
#expect(term_header).to include_text("#{user_count} User")
# expect(term_header).to include_text("#{user_count} User")
end
before do
@ -69,7 +69,6 @@ describe "account admin terms" do
end
context "not default term" do
it "should add a new term" do
new_term_name = 'New Term'
get "/accounts/#{Account.default.id}/terms"
@ -125,7 +124,7 @@ describe "account admin terms" do
let(:group) { Factories::GradingPeriodGroupHelper.new.create_for_account(account) }
before do
group.enrollment_terms = [ term ]
group.enrollment_terms = [term]
end
it "should display link to grading standards page", test_id: 2528663, priority: "1" do

View File

@ -39,9 +39,9 @@ describe "direct share page" do
@assignment_1 = @course_1.assignments.create!(:title => 'Assignment First', :points_possible => 10)
assignment_model(course: @course_1, name: 'assignment to share')
@export_1 = @course_1.content_exports.create!(workflow_state: 'exported', settings: {"selected_content" => {"assignments" => {CC::CCHelper.create_key(@assignment_1) => '1'}}})
@export_2 = @course_1.content_exports.create!(workflow_state: 'exported', settings: {"selected_content" => {"assignments" => {CC::CCHelper.create_key(@assignment_1) => '1'}}})
@export_3 = @course_1.content_exports.create!(workflow_state: 'exported', settings: {"selected_content" => {"assignments" => {CC::CCHelper.create_key(@assignment_1) => '1'}}})
@export_1 = @course_1.content_exports.create!(workflow_state: 'exported', settings: { "selected_content" => { "assignments" => { CC::CCHelper.create_key(@assignment_1) => '1' } } })
@export_2 = @course_1.content_exports.create!(workflow_state: 'exported', settings: { "selected_content" => { "assignments" => { CC::CCHelper.create_key(@assignment_1) => '1' } } })
@export_3 = @course_1.content_exports.create!(workflow_state: 'exported', settings: { "selected_content" => { "assignments" => { CC::CCHelper.create_key(@assignment_1) => '1' } } })
@sent_share = @teacher_1.sent_content_shares.create! name: 'a-unread share1', content_export: @export_1, read_state: 'unread'
@unread_share1 = @teacher_2.received_content_shares.create! name: 'a-unread share1', content_export: @export_1, sender: @teacher_1, read_state: 'unread'
@unread_share2 = @teacher_2.received_content_shares.create! name: 'b-unread share2', content_export: @export_2, sender: @teacher_1, read_state: 'unread'
@ -109,5 +109,5 @@ describe "direct share page" do
# import_content_share.click
# expect(page_application_container).to contain_css("[role='dialog'][aria-label='Import...']")
#end
# end
end

View File

@ -25,129 +25,129 @@ require_relative 'pages/student_context_tray_page'
# We have the funky indenting here because we will remove this once the granular
# permission stuff is released, and I don't want to complicate the git history
RSpec.shared_examples "course_files" do
describe "admin avatars" do
include_context "in-process server selenium tests"
describe "admin avatars" do
include_context "in-process server selenium tests"
before do
set_granular_permission
end
before(:each) do
course_with_admin_logged_in
Account.default.enable_service(:avatars)
Account.default.settings[:avatars] = 'enabled_pending'
Account.default.save!
end
def create_avatar_state(avatar_state="submitted", avatar_image_url="http://www.example.com")
user = User.last
user.avatar_image_url = avatar_image_url
user.save!
user.avatar_state = avatar_state
user.save!
get "/accounts/#{Account.default.id}/avatars"
user
end
def verify_avatar_state(user, opts={})
if opts.empty?
expect(f("#submitted_profile")).to include_text "Submitted 1"
f("#submitted_profile").click
else
expect(f(opts.keys[0])).to include_text(opts.values[0])
f(opts.keys[0]).click
before do
set_granular_permission
end
expect(f("#avatars .name")).to include_text user.name
expect(f(".avatar")).to have_attribute('style', /http/)
end
def lock_avatar(user, element)
element.click
f(".links .lock_avatar_link").click
driver.switch_to.alert.accept
wait_for_ajax_requests
expect(f(".links .unlock_avatar_link")).to be_displayed
user.reload
expect(user.avatar_state).to eq :locked
user
end
it "should verify that the profile picture is submitted " do
user = create_avatar_state
verify_avatar_state(user)
end
it "should verify that the profile picture is reported " do
user = create_avatar_state("reported")
opts = {"#reported_profile" => "Reported 1"}
verify_avatar_state(user, opts)
end
it "should verify that the profile picture is approved, re-reported " do
user = create_avatar_state("re_reported")
opts = {"#re_reported_profile" => "Re-Reported 1"}
verify_avatar_state(user, opts)
end
it "should verify that all profile pictures are displayed " do
user = create_avatar_state
opts = {"#any_profile" => "All 1"}
verify_avatar_state(user, opts)
end
it "should lock the avatar state " do
user = create_avatar_state
lock_avatar(user, f("#any_profile"))
end
it "should unlock the avatar state " do
user = create_avatar_state
user = lock_avatar(user, f("#any_profile"))
f(".links .unlock_avatar_link").click
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :approved
expect(f(".links .lock_avatar_link")).to be_displayed
end
it "should approve un-approved avatar" do
user = create_avatar_state
expect(user.avatar_state).to eq :submitted
f(".links .approve_avatar_link").click
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :approved
expect(f(".links .approve_avatar_link")).not_to be_displayed
end
it "should delete the avatar" do
user = create_avatar_state
f("#any_profile").click
f(".links .reject_avatar_link").click
driver.switch_to.alert.accept
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :none
expect(user.avatar_image_url).to be_nil
end
context "student tray in original gradebook" do
include StudentContextTray
before(:each) do
@account = Account.default
@student = student_in_course.user
@student.avatar_image_url = "http://www.example.com"
Gradebook.visit(@course)
Gradebook::Cells.student_cell_name_link(@student).click
course_with_admin_logged_in
Account.default.enable_service(:avatars)
Account.default.settings[:avatars] = 'enabled_pending'
Account.default.save!
end
it "should display student avatar in tray", priority: "1", test_id: 3299466 do
wait_for_student_tray
def create_avatar_state(avatar_state = "submitted", avatar_image_url = "http://www.example.com")
user = User.last
user.avatar_image_url = avatar_image_url
user.save!
user.avatar_state = avatar_state
user.save!
get "/accounts/#{Account.default.id}/avatars"
user
end
expect(student_avatar_link).to be_displayed
def verify_avatar_state(user, opts = {})
if opts.empty?
expect(f("#submitted_profile")).to include_text "Submitted 1"
f("#submitted_profile").click
else
expect(f(opts.keys[0])).to include_text(opts.values[0])
f(opts.keys[0]).click
end
expect(f("#avatars .name")).to include_text user.name
expect(f(".avatar")).to have_attribute('style', /http/)
end
def lock_avatar(user, element)
element.click
f(".links .lock_avatar_link").click
driver.switch_to.alert.accept
wait_for_ajax_requests
expect(f(".links .unlock_avatar_link")).to be_displayed
user.reload
expect(user.avatar_state).to eq :locked
user
end
it "should verify that the profile picture is submitted " do
user = create_avatar_state
verify_avatar_state(user)
end
it "should verify that the profile picture is reported " do
user = create_avatar_state("reported")
opts = { "#reported_profile" => "Reported 1" }
verify_avatar_state(user, opts)
end
it "should verify that the profile picture is approved, re-reported " do
user = create_avatar_state("re_reported")
opts = { "#re_reported_profile" => "Re-Reported 1" }
verify_avatar_state(user, opts)
end
it "should verify that all profile pictures are displayed " do
user = create_avatar_state
opts = { "#any_profile" => "All 1" }
verify_avatar_state(user, opts)
end
it "should lock the avatar state " do
user = create_avatar_state
lock_avatar(user, f("#any_profile"))
end
it "should unlock the avatar state " do
user = create_avatar_state
user = lock_avatar(user, f("#any_profile"))
f(".links .unlock_avatar_link").click
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :approved
expect(f(".links .lock_avatar_link")).to be_displayed
end
it "should approve un-approved avatar" do
user = create_avatar_state
expect(user.avatar_state).to eq :submitted
f(".links .approve_avatar_link").click
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :approved
expect(f(".links .approve_avatar_link")).not_to be_displayed
end
it "should delete the avatar" do
user = create_avatar_state
f("#any_profile").click
f(".links .reject_avatar_link").click
driver.switch_to.alert.accept
wait_for_ajax_requests
user.reload
expect(user.avatar_state).to eq :none
expect(user.avatar_image_url).to be_nil
end
context "student tray in original gradebook" do
include StudentContextTray
before(:each) do
@account = Account.default
@student = student_in_course.user
@student.avatar_image_url = "http://www.example.com"
Gradebook.visit(@course)
Gradebook::Cells.student_cell_name_link(@student).click
end
it "should display student avatar in tray", priority: "1", test_id: 3299466 do
wait_for_student_tray
expect(student_avatar_link).to be_displayed
end
end
end
end
end # End shared_example block
RSpec.describe 'With granular permission on' do

View File

@ -34,7 +34,7 @@ describe "admin settings tab" do
service_hash = Account.default.allowed_services_hash
service_hash.each do |k, v|
default_services.push k if v[:expose_to_ui] &&
(!v[:expose_to_ui_proc] || v[:expose_to_ui_proc].call(@user, Account.default))
(!v[:expose_to_ui_proc] || v[:expose_to_ui_proc].call(@user, Account.default))
end
default_services
end
@ -47,7 +47,7 @@ describe "admin settings tab" do
end
end
def check_box_verifier (css_selectors, features, checker = true)
def check_box_verifier(css_selectors, features, checker = true)
is_symbol = false
css_selectors = [css_selectors] unless (css_selectors.is_a? Array)
@ -130,7 +130,7 @@ describe "admin settings tab" do
end
describe "allow self-enrollment" do
def enrollment_helper (value='')
def enrollment_helper(value = '')
if (value == '')
f("#account_settings_self_enrollment option[value='']").click
else
@ -185,21 +185,21 @@ describe "admin settings tab" do
get "/accounts/#{Account.default.id}/settings"
end
def add_quiz_filter name ="www.canvas.instructure.com", value="192.168.217.1/24"
def add_quiz_filter name = "www.canvas.instructure.com", value = "192.168.217.1/24"
fj("#ip_filters .name[value='']:visible").send_keys name
fj("#ip_filters .value[value='']:visible").send_keys value
click_submit
filter_hash = {name => value}
filter_hash = { name => value }
expect(Account.default.settings[:ip_filters]).to include filter_hash
expect(fj("#ip_filters .name[value='#{name}']")).to be_displayed
expect(fj("#ip_filters .value[value='#{value}']")).to be_displayed
filter_hash
end
def create_quiz_filter(name="www.canvas.instructure.com", value="192.168.217.1/24")
def create_quiz_filter(name = "www.canvas.instructure.com", value = "192.168.217.1/24")
Account.default.tap do |a|
a.settings[:ip_filters] ||= []
a.settings[:ip_filters] << {name => value}
a.settings[:ip_filters] << { name => value }
a.save!
end
end
@ -226,7 +226,7 @@ describe "admin settings tab" do
replace_content(fj("#ip_filters .name:visible"), new_name)
replace_content(fj("#ip_filters .value:visible"), new_value)
click_submit
filter_hash = {new_name => new_value}
filter_hash = { new_name => new_value }
expect(Account.default.settings[:ip_filters]).to include filter_hash
expect(fj("#ip_filters .name[value='#{new_name}']")).to be_displayed
expect(fj("#ip_filters .value[value='#{new_value}']")).to be_displayed
@ -257,7 +257,6 @@ describe "admin settings tab" do
end
describe "equella settings" do
def add_equella_feature
equella_url = "http://oer.equella.com/signon.do"
f("#account_settings_equella_endpoint").send_keys(equella_url)
@ -315,23 +314,23 @@ describe "admin settings tab" do
end
it "should unclick and then click on skype" do
check_box_verifier("#account_services_skype", {:allowed_services => :skype}, false)
check_box_verifier("#account_services_skype", {:allowed_services => :skype})
check_box_verifier("#account_services_skype", { :allowed_services => :skype }, false)
check_box_verifier("#account_services_skype", { :allowed_services => :skype })
end
it "should unclick and then click on delicious" do
check_box_verifier("#account_services_delicious", {:allowed_services => :delicious}, false)
check_box_verifier("#account_services_delicious", {:allowed_services => :delicious})
check_box_verifier("#account_services_delicious", { :allowed_services => :delicious }, false)
check_box_verifier("#account_services_delicious", { :allowed_services => :delicious })
end
it "should unclick and click on google docs previews" do
check_box_verifier("#account_services_google_docs_previews", {:allowed_services => :google_docs_previews}, false)
check_box_verifier("#account_services_google_docs_previews", {:allowed_services => :google_docs_previews})
check_box_verifier("#account_services_google_docs_previews", { :allowed_services => :google_docs_previews }, false)
check_box_verifier("#account_services_google_docs_previews", { :allowed_services => :google_docs_previews })
end
it "should click on user avatars" do
check_box_verifier("#account_services_avatars", {:allowed_services => :avatars})
check_box_verifier("#account_services_avatars", {:allowed_services => :avatars}, false)
check_box_verifier("#account_services_avatars", { :allowed_services => :avatars })
check_box_verifier("#account_services_avatars", { :allowed_services => :avatars }, false)
end
it "should disable all web services" do
@ -343,17 +342,17 @@ describe "admin settings tab" do
end
it "should enable and disable a plugin service (setting)" do
AccountServices.register_service(:myplugin, {:name => "My Plugin", :description => "", :expose_to_ui => :setting, :default => false})
AccountServices.register_service(:myplugin, { :name => "My Plugin", :description => "", :expose_to_ui => :setting, :default => false })
get "/accounts/#{Account.default.id}/settings"
check_box_verifier("#account_services_myplugin", {:allowed_services => :myplugin})
check_box_verifier("#account_services_myplugin", {:allowed_services => :myplugin}, false)
check_box_verifier("#account_services_myplugin", { :allowed_services => :myplugin })
check_box_verifier("#account_services_myplugin", { :allowed_services => :myplugin }, false)
end
it "should enable and disable a plugin service (service)" do
AccountServices.register_service(:myplugin, {:name => "My Plugin", :description => "", :expose_to_ui => :service, :default => false})
AccountServices.register_service(:myplugin, { :name => "My Plugin", :description => "", :expose_to_ui => :service, :default => false })
get "/accounts/#{Account.default.id}/settings"
check_box_verifier("#account_services_myplugin", {:allowed_services => :myplugin})
check_box_verifier("#account_services_myplugin", {:allowed_services => :myplugin}, false)
check_box_verifier("#account_services_myplugin", { :allowed_services => :myplugin })
check_box_verifier("#account_services_myplugin", { :allowed_services => :myplugin }, false)
end
end
@ -409,7 +408,8 @@ describe "admin settings tab" do
it "should not delete all of the pre-existing custom help links if notifications tab is submitted" do
Account.default.settings[:custom_help_links] = [
{"text"=>"text", "subtext"=>"subtext", "url"=>"http://www.example.com/example", "available_to"=>["user", "student", "teacher"]}]
{ "text" => "text", "subtext" => "subtext", "url" => "http://www.example.com/example", "available_to" => ["user", "student", "teacher"] }
]
Account.default.save!
get "/accounts/#{Account.default.id}/settings"
@ -419,12 +419,12 @@ describe "admin settings tab" do
wait_for_ajax_requests
expect(Account.default.settings[:custom_help_links]).to eq [
{"text"=>"text", "subtext"=>"subtext", "url"=>"http://www.example.com/example", "available_to"=>["user", "student", "teacher"]}
{ "text" => "text", "subtext" => "subtext", "url" => "http://www.example.com/example", "available_to" => ["user", "student", "teacher"] }
]
end
it "should preserve the default help links if the account hasn't been configured with the new ui yet" do
help_link = {:text => "text", :subtext => "subtext", :url => "http://www.example.com/example", :available_to => ["user", "student", "teacher"]}
help_link = { :text => "text", :subtext => "subtext", :url => "http://www.example.com/example", :available_to => ["user", "student", "teacher"] }
Account.default.settings[:custom_help_links] = [help_link]
Account.default.save!
@ -464,13 +464,13 @@ describe "admin settings tab" do
cl = Account.default.help_links.detect { |hl| hl['url'] == 'https://url.example.com' }
expect(cl).to include(
{
"text"=>"text",
"subtext"=>"subtext",
"url"=>"https://url.example.com",
"type"=>"custom",
"is_featured"=>true,
"is_new"=>false,
"available_to"=>["user", "student", "teacher", "admin", "observer", "unenrolled"]
"text" => "text",
"subtext" => "subtext",
"url" => "https://url.example.com",
"type" => "custom",
"is_featured" => true,
"is_new" => false,
"available_to" => ["user", "student", "teacher", "admin", "observer", "unenrolled"]
}
)
end
@ -490,15 +490,15 @@ describe "admin settings tab" do
cl = Account.default.help_links.detect { |hl| hl['url'] == 'https://newurl.example.com' }
expect(cl).to include(
{
"is_featured"=>false,
"is_new"=>true,
"is_featured" => false,
"is_new" => true,
}
)
end
it "edits a custom link" do
a = Account.default
a.settings[:custom_help_links] = [{"text"=>"custom-link-text-frd", "subtext"=>"subtext", "url"=>"https://url.example.com", "type"=>"custom", "available_to"=>["user", "student", "teacher", "admin"]}]
a.settings[:custom_help_links] = [{ "text" => "custom-link-text-frd", "subtext" => "subtext", "url" => "https://url.example.com", "type" => "custom", "available_to" => ["user", "student", "teacher", "admin"] }]
a.save!
get "/accounts/#{Account.default.id}/settings"
fj('#custom_help_link_settings span:contains("Edit custom-link-text-frd")').find_element(:xpath, '..').click
@ -600,6 +600,7 @@ describe "admin settings tab" do
features_text = f("#tab-features").text
Feature.applicable_features(Account.default).each do |feature|
next if feature.visible_on && !feature.visible_on.call(Account.default)
# We don't want flags that are enabled in code to appear in the UI
if feature.enabled? && !feature.can_override?
expect(features_text).not_to include(feature.display_name.call)

View File

@ -134,7 +134,7 @@ describe "admin sub accounts" do
added_courses_count = 3
get "/accounts/#{default_account_id}/sub_accounts"
validate_course_count(default_account_id, '1 Course') #make sure default account was setup correctly
validate_course_count(default_account_id, '1 Course') # make sure default account was setup correctly
sub_account = create_sub_account('add courses to me')
added_courses_count.times { Course.create!(:account => sub_account) }
refresh_page # to make new account with courses show up

View File

@ -48,13 +48,13 @@ describe "analytics in Canvas" do
# Analytics1.0 is disabled
@admin.account.update(allowed_services: "")
visit_admin_settings_tab(@admin.account.id)
expect(admin_left_nav_menu.text).not_to include('Analytics')
end
end
context "Analytics 2.0 LTI installed" do
before :once do
before :once do
@admin = account_admin_user(:active_all => true)
# Analytics1.0 is enabled for all tests by default
@admin.account.update(allowed_services: "+analytics")
@ -63,14 +63,14 @@ describe "analytics in Canvas" do
@tool_id = @admin.account.context_external_tools.first.id
# create a course, @teacher and student in course
@course = course_with_teacher(
:account => @admin.account,
:course_name => "A New Course",
name: 'Teacher1',
:account => @admin.account,
:course_name => "A New Course",
name: 'Teacher1',
:active_all => true
).course
@student = student_in_course(
:course => @course,
:name => "First Student",
:course => @course,
:name => "First Student",
:active_all => true
).user
end
@ -102,8 +102,8 @@ describe "analytics in Canvas" do
manage_user_link(@student.name).click
expect(manage_user_options_list.text).to include('Analytics 2')
expect(manage_user_analytics_2_link.attribute('href')).
to include("/courses/#{@course.id}/external_tools/#{@tool_id}?launch_type=student_context_card&student_id=#{@student.id}")
expect(manage_user_analytics_2_link.attribute('href'))
.to include("/courses/#{@course.id}/external_tools/#{@tool_id}?launch_type=student_context_card&student_id=#{@student.id}")
end
end
@ -134,8 +134,8 @@ describe "analytics in Canvas" do
# it "with FF enabled, displays Analytics 2 link on course nav" do
# visit_course_home_page(@course.id)
# expect(course_nav_menu.text).to include('Analytics 2')
# expect(course_nav_menu.text).to include('Analytics 2')
# end
# it "with FF enabled, displays Analytics 2 link on self profile page" do
@ -152,7 +152,7 @@ describe "analytics in Canvas" do
# view_all_grades permission is required in analytics 2 for student tray and user analytics
context "with A2 FF enabled" do
before :each do
@course.root_account.enable_feature!(:analytics_2)
@course.root_account.enable_feature!(:analytics_2)
@course.account.role_overrides.create!(permission: :view_all_grades, role: teacher_role, enabled: false)
user_session(@teacher)
end

View File

@ -121,4 +121,4 @@ describe "analytics in Canvas" do
end
end
end
end
end

View File

@ -26,7 +26,6 @@ describe "duplicate discussion" do
include_context "discussions_page_shared_context"
context 'discussion created by teacher' do
context 'duplicating' do
describe 'course context' do
before :each do
@ -56,7 +55,7 @@ describe "duplicate discussion" do
course_with_teacher(:active_all => true)
student_in_course(:active_all => true)
@course.update(:allow_student_discussion_editing => true,
:allow_student_discussion_topics=>true)
:allow_student_discussion_topics => true)
@group_category = @course.group_categories.create!(:name => "Group Category")
@group = @course.groups.create!(:group_category => @group_category, :name => "Group 1")
@course.enroll_user(@student, 'StudentEnrollment', :enrollment_state => 'active')

View File

@ -20,7 +20,6 @@
require_relative '../../common'
module AccountContentSharePage
# ---------------------- Elements ----------------------
def page_body
f('body')
@ -81,4 +80,4 @@ module AccountContentSharePage
end
# ---------------------- Methods -----------------------
end
end

View File

@ -35,7 +35,7 @@ module AdminSettingsPage
def profile_tray
f("div[role='dialog'][aria-label='Profile tray']")
end
def profile_tray_menu_items
f("div[role='dialog'][aria-label='Profile tray'] ul")
end
@ -43,19 +43,19 @@ module AdminSettingsPage
def profile_tray_content_share_link
fj("a:contains('Shared Content')")
end
def profile_tray_spinner
fj("li title:contains('Loading')")
end
# ---------------------- Actions -----------------------
def visit_admin_settings_tab(account_id)
get "/accounts/#{account_id}/settings"
end
# ---------------------- Methods -----------------------
def wait_for_profile_tray_spinner
begin
spinner = profile_tray_spinner
@ -65,5 +65,4 @@ module AdminSettingsPage
end
wait_for_ajaximations
end
end

View File

@ -19,7 +19,6 @@
require_relative '../../common'
module CourseHomePage
# ---------------------- Elements ----------------------
def course_header
@ -37,7 +36,7 @@ module CourseHomePage
def course_options_analytics1_link
fj(".course-options a:contains('View Course Analytics')")
end
def course_nav_menu
f('#section-tabs')
end

View File

@ -19,10 +19,8 @@
require_relative '../../common'
module EditExistingUserModalPage
# ---------------------- Controls ----------------------
def edit_full_name_input
fj('label:contains("Full Name") input')
end
end

View File

@ -19,7 +19,6 @@
require_relative '../../common'
module MasqueradePage
# ---------------------- Controls ----------------------
def act_as_label

View File

@ -19,8 +19,6 @@
require_relative '../../common'
module NewCourseAddCourseModal
# ---------------------- Controls ----------------------
def add_course_modal
f('[aria-label="Add a New Course"]')

View File

@ -19,8 +19,6 @@
require_relative '../../common'
module NewCourseAddPeopleModal
# ---------------------- Controls ----------------------
def add_people_modal
f('#add_people_modal')

View File

@ -100,7 +100,7 @@ module NewCourseSearchPage
end
def navigate_to_page(page_number)
wait_for_new_page_load{ table_nav_buttons(page_number).click }
wait_for_new_page_load { table_nav_buttons(page_number).click }
end
def select_term(term)
@ -112,7 +112,7 @@ module NewCourseSearchPage
end
def click_add_users_to_course(course)
row = rows.first{|e| e.text contains(course.name)}
row = rows.first { |e| e.text contains(course.name) }
fj('button:contains("Add Users to Unnamed Course")', row).click
add_people_modal
wait_for_ajaximations

View File

@ -19,7 +19,6 @@
require_relative '../../common'
module NewUserEditModalPage
# ---------------------- Controls ----------------------
def modal_object

View File

@ -19,7 +19,6 @@
require_relative '../../common'
module NewUserSearchPage
# ---------------------- Page ----------------------
def visit_users(account)
get("/accounts/#{account.id}/users")

View File

@ -203,17 +203,17 @@ class PermissionsIndex
# on the close button. Wait for it here.
def wait_for_tray_ready
keep_trying_until(2) do
disable_implicit_wait{ yield == current_active_element }
disable_implicit_wait { yield == current_active_element }
end
end
def open_edit_role_tray(role)
role_name(role).click
wait_for_tray_ready{ close_role_tray_button }
wait_for_tray_ready { close_role_tray_button }
keep_trying_until do
disable_implicit_wait{edit_role_icon.click}
disable_implicit_wait{edit_name_box.displayed?}
disable_implicit_wait { edit_role_icon.click }
disable_implicit_wait { edit_name_box.displayed? }
end
# sometimes the input loads and the value takes longer, wait for value
wait_for(method: nil, timeout: 1) { edit_name_box.attribute('value') == role.name }
@ -221,7 +221,7 @@ class PermissionsIndex
def add_role(name)
add_role_button.click
wait_for_tray_ready{ close_add_role_tray_button }
wait_for_tray_ready { close_add_role_tray_button }
add_role_input.click
set_value(add_role_input, name)
add_role_submit_button.click
@ -257,7 +257,7 @@ class PermissionsIndex
def open_permission_tray(permission_name)
permission_link(permission_name).click
wait_for_tray_ready{ close_permission_tray_button }
wait_for_tray_ready { close_permission_tray_button }
end
end
end

View File

@ -20,48 +20,46 @@
require_relative '../../common'
module StudentContextTray
#------------------------------ Selectors -----------------------------
#------------------------------ Selectors -----------------------------
#------------------------------ Elements ------------------------------
def student_tray_header
f(".StudentContextTray-Header")
end
#------------------------------ Elements ------------------------------
def student_tray_header
f(".StudentContextTray-Header")
end
def student_avatar_link
f(".StudentContextTray__Avatar a")
end
def student_avatar_link
f(".StudentContextTray__Avatar a")
end
def student_name_link
f(".StudentContextTray-Header__Name a")
end
def student_name_link
f(".StudentContextTray-Header__Name a")
end
def todo_tray_course_selector
f("#to-do-item-course-select")
end
def todo_tray_course_selector
f("#to-do-item-course-select")
end
def todo_tray_course_suggestions
fj("ul[role=listbox]:contains('Optional: Add Course')")
end
def todo_tray_course_suggestions
fj("ul[role=listbox]:contains('Optional: Add Course')")
end
def todo_tray_dropdown_select_course(course_name)
fj("li[role=none] span[role=option]:contains('#{course_name}')")
end
def todo_tray_dropdown_select_course(course_name)
fj("li[role=none] span[role=option]:contains('#{course_name}')")
end
def student_tray_quick_links
f('.StudentContextTray-QuickLinks')
end
#------------------------ Actions & Methods ---------------------------
def wait_for_student_tray
wait_for(method: nil, timeout: 1) { student_name_link.displayed? }
wait_for_ajaximations
wait_for(method: nil, timeout: 5) { ff(".StudentContextTray__Spinner").empty? }
end
def todo_tray_select_course_from_dropdown(course_name='Optional: Add Course')
todo_tray_course_selector.click
todo_tray_dropdown_select_course(course_name).click
end
def student_tray_quick_links
f('.StudentContextTray-QuickLinks')
end
#------------------------ Actions & Methods ---------------------------
def wait_for_student_tray
wait_for(method: nil, timeout: 1) { student_name_link.displayed? }
wait_for_ajaximations
wait_for(method: nil, timeout: 5) { ff(".StudentContextTray__Spinner").empty? }
end
def todo_tray_select_course_from_dropdown(course_name = 'Optional: Add Course')
todo_tray_course_selector.click
todo_tray_dropdown_select_course(course_name).click
end
end

View File

@ -19,47 +19,46 @@
require_relative '../../common'
module UserProfilePage
# ---------------------- Selectors ----------------------
# ---------------------- Selectors ----------------------
# ---------------------- Elements ----------------------
# ---------------------- Elements ----------------------
def merge_with_another_user_link
f('a.merge_user_link')
end
def merge_with_another_user_link
f('a.merge_user_link')
end
def search_username_input
f('.account_search input.user_name')
end
def search_username_input
f('.account_search input.user_name')
end
def search_userid_input
f('#manual_user_id')
end
def search_userid_input
f('#manual_user_id')
end
def username_search_suggestions
wait_for_ajaximations
f('ul.ui-autocomplete')
end
def username_search_suggestions
wait_for_ajaximations
f('ul.ui-autocomplete')
end
def choose_suggested_username(user_name)
fj("a:contains('#{user_name}')")
end
def choose_suggested_username(user_name)
fj("a:contains('#{user_name}')")
end
def selected_user
f('#selected_name')
end
def selected_user
f('#selected_name')
end
def select_user_button
f('#select_name')
end
def select_user_button
f('#select_name')
end
def merge_user_page_application_div
f("#application")
end
def merge_user_page_application_div
f("#application")
end
# ------------------ Actions & Methods -------------------
# ------------------ Actions & Methods -------------------
def visit_merge_user_accounts(user_id)
get "/users/#{user_id}/admin_merge"
end
def visit_merge_user_accounts(user_id)
get "/users/#{user_id}/admin_merge"
end
end

View File

@ -31,8 +31,8 @@ describe "permissions index" do
def create_role_override(permission_name, role, account, opts)
new_role = RoleOverride.create!(:permission => permission_name, :enabled => opts[:enabled],
:locked => opts[:locked], :context => account, :applies_to_self => true, :applies_to_descendants => true,
:role_id => role.id, :context_type => 'Account')
:locked => opts[:locked], :context => account, :applies_to_self => true, :applies_to_descendants => true,
:role_id => role.id, :context_type => 'Account')
new_role.id
end
@ -45,14 +45,14 @@ describe "permissions index" do
it "updates the role to the new name after editing" do
PermissionsIndex.edit_role(@custom_student_role, "A Better Kitty") # TODO flakiness lies within
expect{PermissionsIndex.role_name(@custom_student_role).text}.to become("A Better Kitty")
expect{PermissionsIndex.edit_tray_header.text}.to become("Edit A Better Kitty")
expect { PermissionsIndex.role_name(@custom_student_role).text }.to become("A Better Kitty")
expect { PermissionsIndex.edit_tray_header.text }.to become("Edit A Better Kitty")
end
it "updates the permission to the correct selection" do
PermissionsIndex.open_edit_role_tray(@custom_student_role)
PermissionsIndex.disable_tray_permission("read_announcements", @custom_student_role.id)
expect{PermissionsIndex.role_tray_permission_state("read_announcements", @custom_student_role.id)}.to become('Disabled')
expect { PermissionsIndex.role_tray_permission_state("read_announcements", @custom_student_role.id) }.to become('Disabled')
end
end
@ -169,8 +169,8 @@ describe "permissions index" do
it "updates a permission when changed in the tray" do
PermissionsIndex.open_permission_tray(@permission_name)
PermissionsIndex.disable_tray_permission(@permission_name, @role.id)
expect{PermissionsIndex.role_tray_permission_state(@permission_name, @role.id)}.to become('Disabled')
expect{PermissionsIndex.grid_permission_state(@permission_name, @role.id)}.to become('Disabled')
expect { PermissionsIndex.role_tray_permission_state(@permission_name, @role.id) }.to become('Disabled')
expect { PermissionsIndex.grid_permission_state(@permission_name, @role.id) }.to become('Disabled')
end
end

View File

@ -22,15 +22,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
describe "Authentication Providers" do
include_context "in-process server selenium tests"
context "Server errors " do
it "should show the error message generated by the server" do
site_admin_logged_in
Account.default.authentication_providers.create!({
:auth_host => "blah.blah",
:auth_over_tls => false,
:auth_port => "123",
:auth_type => "ldap",
})
:auth_host => "blah.blah",
:auth_over_tls => false,
:auth_port => "123",
:auth_type => "ldap",
})
get "/accounts/#{Account.default.id}/authentication_providers"
f(".test_ldap_link").click
wait_for_ajaximations

View File

@ -95,7 +95,6 @@ describe "site admin jobs ui" do
end
context "search" do
it "should only action the individual job when it has been searched for" do
job = Delayed::Job.list_jobs(:current, 1).first
get "/jobs?flavor=id&q=#{job.id}"

View File

@ -29,7 +29,6 @@ describe "sub account shared rubric specs" do
let(:who_to_login) { 'admin' }
before(:each) do
course_with_admin_logged_in
end
@ -44,13 +43,11 @@ describe "sub account shared rubric specs" do
should_allow_fractional_points
end
it "should round to 2 decimal places" do
should_round_to_2_decimal_places
end
it "should round to an integer when splitting" do
should_round_to_an_integer_when_splitting
end

View File

@ -28,7 +28,7 @@ describe "sub account basic settings" do
it "should disable inherited settings if locked by a parent account", priority: "1", test_id: 250007 do
parent = Account.default
parent.settings[:restrict_student_future_view] = {locked: true, value: true}
parent.settings[:restrict_student_future_view] = { locked: true, value: true }
parent.save!
get account_settings_url

View File

@ -24,7 +24,7 @@ describe "sub account statistics" do
describe "shared statistics specs" do
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'} }
let(:list_css) { { :started => '#recently_started_item_list', :ended => '#recently_ended_item_list', :logged_in => '#recently_logged_in_item_list' } }
include_examples "statistics basic tests"
end
end

View File

@ -55,7 +55,7 @@ describe "admin_tools" do
setup_account_admin
end
def setup_account_admin(permissions = {:view_notifications => true})
def setup_account_admin(permissions = { :view_notifications => true })
# Setup an account admin (@account_admin) and logged in.
account_admin_user_with_role_changes(:account => @account, :role_changes => permissions)
@account_admin = @admin
@ -198,7 +198,7 @@ describe "admin_tools" do
context "without permissions" do
it "should not see tab" do
setup_account_admin({:view_notifications => false})
setup_account_admin({ :view_notifications => false })
load_admin_tools_page
wait_for_ajaximations
expect(f('#adminToolsTabs')).not_to contain_css('.notifications')
@ -269,7 +269,7 @@ describe "admin_tools" do
click_view_tab "logging"
options = ffj("#loggingType > option")
options.map!{ |o| o.text }
options.map! { |o| o.text }
expect(options).not_to include("Login / Logout Activity")
end
@ -281,7 +281,7 @@ describe "admin_tools" do
click_view_tab "logging"
options = ffj("#loggingType > option")
options.map!{ |o| o.text }
options.map! { |o| o.text }
expect(options).not_to include("Grade Change Activity")
end
@ -293,7 +293,7 @@ describe "admin_tools" do
click_view_tab "logging"
options = ffj("#loggingType > option")
options.map!{ |o| o.text }
options.map! { |o| o.text }
expect(options).not_to include("Course Activity")
end
end
@ -601,7 +601,7 @@ describe "admin_tools" do
cc.workflow_state = 'active'
cc.bounce_count = 3
cc.last_bounce_at = 6.days.ago
cc.last_bounce_details = {'bouncedRecipients' => [{'diagnosticCode' => '550 what a luser'}]}
cc.last_bounce_details = { 'bouncedRecipients' => [{ 'diagnosticCode' => '550 what a luser' }] }
end
@user = @account_admin
end

View File

@ -181,7 +181,7 @@ describe "Alerts" do
end
it "should not show the add link when all recipients are already there" do
alert = @alerts.create!(:recipients => [:student, :teachers, {:role_id => admin_role.id}], :criteria => [{:criterion_type => 'Interaction', :threshold => 7}])
alert = @alerts.create!(:recipients => [:student, :teachers, { :role_id => admin_role.id }], :criteria => [{ :criterion_type => 'Interaction', :threshold => 7 }])
get "/accounts/#{@context.id}/settings"
find('#tab-alerts-link').click
@ -213,7 +213,7 @@ describe "Alerts" do
role1 = custom_account_role('these rolls are delicious', :account => @context)
role2 = custom_account_role('your just jelly', :account => @context)
alert = @alerts.create!(:recipients => [{:role_id => role1.id}], :criteria => [{:criterion_type => 'Interaction', :threshold => 7}])
alert = @alerts.create!(:recipients => [{ :role_id => role1.id }], :criteria => [{ :criterion_type => 'Interaction', :threshold => 7 }])
get "/accounts/#{@context.id}/settings"
find('#tab-alerts-link').click
@ -234,7 +234,7 @@ describe "Alerts" do
wait_for_ajaximations
alert.reload
expect(alert.recipients.map{|r| r[:role_id]}.sort).to eq [role1.id, role2.id].sort
expect(alert.recipients.map { |r| r[:role_id] }.sort).to eq [role1.id, role2.id].sort
end
end
end

View File

@ -39,11 +39,11 @@ describe "course catalog" do
Account.default.settings[:enable_course_catalog] = true
Account.default.save!
# create_courses factory returns id's of courses unless you specify return_type
create_courses([ public_indexed_course_attrs ], {return_type: :record}).first
create_courses([public_indexed_course_attrs], { return_type: :record }).first
end
def public_indexed_course_attrs
{
{
name: 'Intro to Testing',
public_description: 'An overview of testing with Selenium',
is_public: true,
@ -69,8 +69,8 @@ describe "course catalog" do
end
it "should list a next button when >12 courses are in the index and public", priority: "1", test_id: 2963672 do
create_courses(13.times.map{ |i| public_indexed_course_attrs.merge(name: "#{i}") })
refresh_page
expect(f('#next-link').displayed?).to be(true)
create_courses(13.times.map { |i| public_indexed_course_attrs.merge(name: "#{i}") })
refresh_page
expect(f('#next-link').displayed?).to be(true)
end
end

View File

@ -32,7 +32,6 @@ shared_context "announcements_page_shared_context" do
let(:course_page_disabled_notice) { "That page has been disabled for this course" }
end
module AnnouncementHelpers
def new_announcement(course)
course.announcements.create!(title: "Announcement 1", message: "Announcement 1 detail")
@ -40,12 +39,12 @@ module AnnouncementHelpers
def disable_view_announcements(course, context_role)
course.root_account.role_overrides.create!(permission: 'read_announcements',
role: context_role, enabled: false)
role: context_role, enabled: false)
end
def enable_view_announcements(course, context_role)
course.root_account.role_overrides.create!(permission: 'read_announcements',
role: context_role, enabled: true)
role: context_role, enabled: true)
end
def view_announcement_detail

View File

@ -84,7 +84,6 @@ describe 'announcement permissions' do
setup_designer_context
end
shared_examples 'disallow announcement view with discussions disallowed' do |context|
before :each do
disable_view_announcements(@course, context_role)
@ -114,7 +113,6 @@ describe 'announcement permissions' do
setup_observer_context
end
shared_examples 'disallow discussion topic view with announcements allowed' do |context|
before :each do
enable_view_announcements(@course, context_role)
@ -157,7 +155,6 @@ describe 'announcement permissions' do
setup_designer_context
end
shared_examples 'disallow discussion detail view with announcements allowed' do |context|
before :each do
enable_view_announcements(@course, context_role)
@ -191,7 +188,6 @@ describe 'announcement permissions' do
end
end
context 'discussion created by student' do
before :each do
course_with_student(active_all: true, name: 'student1')
@ -205,7 +201,6 @@ describe 'announcement permissions' do
new_announcement(@course)
end
shared_examples 'disallow discussion detail view with announcements allowed' do |context|
before :each do
enable_view_announcements(@course, context_role)

View File

@ -37,7 +37,7 @@ describe "announcements" do
stub_rcs_config
end
it "should allow saving of section announcement", test_id:3469728, priority: "1" do
it "should allow saving of section announcement", test_id: 3469728, priority: "1" do
@course.course_sections.create!(name: "Section 1")
@course.course_sections.create!(name: "Section 2")
AnnouncementNewEdit.visit_new(@course)
@ -45,11 +45,11 @@ describe "announcements" do
AnnouncementNewEdit.add_message("Announcement Body")
AnnouncementNewEdit.add_title("Announcement Title")
AnnouncementNewEdit.submit_announcement_form
expect(driver.current_url).to include(AnnouncementNewEdit.
individual_announcement_url(Announcement.last))
expect(driver.current_url).to include(AnnouncementNewEdit
.individual_announcement_url(Announcement.last))
end
it "should not allow empty sections", test_id:3469730, priority: "1" do
it "should not allow empty sections", test_id: 3469730, priority: "1" do
@course.course_sections.create!(name: "Section 1")
@course.course_sections.create!(name: "Section 2")
AnnouncementNewEdit.visit_new(@course)
@ -132,7 +132,7 @@ describe "announcements" do
submit_form('.form-actions')
wait_for_ajaximations
expect(ff('.error_box').any?{|box| box.text.include?("A message is required")}).to be_truthy
expect(ff('.error_box').any? { |box| box.text.include?("A message is required") }).to be_truthy
end
it "should add an attachment to a graded topic", priority: "1", test_id: 220367 do
@ -178,7 +178,7 @@ describe "announcements" do
it "displayed delayed post note on page of delayed announcement" do
a = @course.announcements.create!(:title => "Announcement", :message => "foobers",
:delayed_post_at => 1.week.from_now)
:delayed_post_at => 1.week.from_now)
get AnnouncementNewEdit.full_individual_announcement_url(@course, a)
expect(f('.discussion-fyi')).to include_text(
'The content of this announcement will not be visible to users until'

View File

@ -173,5 +173,3 @@ class AnnouncementIndex
end
end
end

View File

@ -42,7 +42,7 @@ describe "Authenticity Tokens" do
token2 = driver.execute_script "return $.cookie('_csrf_token')"
expect(token).not_to eq token2
expect(CanvasBreachMitigation::MaskingSecrets.send(:unmasked_token, token)).not_to eq(
CanvasBreachMitigation::MaskingSecrets.send(:unmasked_token, token2)
CanvasBreachMitigation::MaskingSecrets.send(:unmasked_token, token2)
)
end
end

View File

@ -88,6 +88,5 @@ describe "assignment" do
expect(AssignmentPage.allowed_attempts_count.text).to include "2"
end
end
end

View File

@ -130,4 +130,3 @@ describe 'Anonymous Moderated Marking' do
end
end
end

View File

@ -67,22 +67,22 @@ describe "assignment batch edit" do
)
# add some overrides for Assignment1
@override1 = create_adhoc_override_for_assignment(@assignment1,
[@student1],
{title: 'override1', due_at: @date - 1.day,
lock_at: @date + 4.days,
unlock_at: @date - 4.days})
[@student1],
{ title: 'override1', due_at: @date - 1.day,
lock_at: @date + 4.days,
unlock_at: @date - 4.days })
@override2 = create_adhoc_override_for_assignment(@assignment1,
[@student2],
{title: 'override2',
due_at: @date - 10.days,
lock_at: @date + 10.days,
unlock_at: @date - 10.days})
[@student2],
{ title: 'override2',
due_at: @date - 10.days,
lock_at: @date + 10.days,
unlock_at: @date - 10.days })
@override2 = create_adhoc_override_for_assignment(@assignment1,
[@student3],
{title: 'override3',
due_at: @date + 10.days,
lock_at: @date + 20.days,
unlock_at: @date})
[@student3],
{ title: 'override3',
due_at: @date + 10.days,
lock_at: @date + 20.days,
unlock_at: @date })
end
context "bulk edit feature" do
@ -131,18 +131,18 @@ describe "assignment batch edit" do
batch_edit_dialog_ok_button.click
date_inputs = assignment_dates_inputs(@assignment1.title)
save_bulk_edited_dates
expect(date_inputs[0].attribute('value')).to eq (@date+3.days).strftime("%a %-b %-d, %Y")
expect(date_inputs[0].attribute('value')).to eq (@date + 3.days).strftime("%a %-b %-d, %Y")
# unlock_at was today-3.days
expect(date_inputs[1].attribute('value')).to eq (@date-1.day).strftime("%a %-b %-d, %Y")
expect(date_inputs[1].attribute('value')).to eq (@date - 1.day).strftime("%a %-b %-d, %Y")
# lock_at date was today+3days
expect(date_inputs[2].attribute('value')).to eq (@date+5.days).strftime("%a %-b %-d, %Y")
expect(date_inputs[2].attribute('value')).to eq (@date + 5.days).strftime("%a %-b %-d, %Y")
date_inputs = assignment_dates_inputs(@override1.title)
# Override1 due date was today-1.day
expect(date_inputs[0].attribute('value')).to eq (@date+1.day).strftime("%a %-b %-d, %Y")
expect(date_inputs[0].attribute('value')).to eq (@date + 1.day).strftime("%a %-b %-d, %Y")
# Override1 unlock_at date was today-4.days
expect(date_inputs[1].attribute('value')).to eq (@date-2.days).strftime("%a %-b %-d, %Y")
expect(date_inputs[1].attribute('value')).to eq (@date - 2.days).strftime("%a %-b %-d, %Y")
# Override1 lock_at date was today+4days
expect(date_inputs[2].attribute('value')).to eq (@date+6.days).strftime("%a %-b %-d, %Y")
expect(date_inputs[2].attribute('value')).to eq (@date + 6.days).strftime("%a %-b %-d, %Y")
end
it 'allows clearing dates', custom_timeout: 30 do

View File

@ -25,7 +25,6 @@ require_relative '../admin/pages/account_content_share_page'
require_relative '../../spec_helper'
describe 'assignments' do
include_context 'in-process server selenium tests'
include AssignmentsIndexPage
include CopyToTrayPage

View File

@ -42,8 +42,8 @@ describe "discussion assignments" do
it "should redirect to the discussion new page and maintain parameters", priority: "1", test_id: 209966 do
ag = @course.assignment_groups.create!(:name => "Stuff")
get "/courses/#{@course.id}/assignments"
expect_new_page_load { build_assignment_with_type("Discussion", :assignment_group_id => ag.id, :name => "More options created discussion", :points => '30', :more_options => true)}
#check the content of the discussion page for our set point value and name and the URL to make sure were in /discussions
expect_new_page_load { build_assignment_with_type("Discussion", :assignment_group_id => ag.id, :name => "More options created discussion", :points => '30', :more_options => true) }
# check the content of the discussion page for our set point value and name and the URL to make sure were in /discussions
expect(driver.current_url).to include("discussion_topics/new?assignment_group_id=#{ag.id}&due_at=null&points_possible=30&title=More+options+created+discussion")
expect(f('#discussion-title')).to have_value "More options created discussion"
expect(f('#discussion_topic_assignment_points_possible')).to have_value "30"
@ -63,7 +63,7 @@ describe "discussion assignments" do
it "should redirect to the discussion edit page and maintain parameters", priority: "2", test_id: 209968 do
assign = @course.assignments.create!(:name => "Discuss!", :points_possible => "5", :submission_types => "discussion_topic")
get "/courses/#{@course.id}/assignments"
expect_new_page_load{ edit_assignment(assign.id, :name => "Rediscuss!", :points => "10", :more_options => true) }
expect_new_page_load { edit_assignment(assign.id, :name => "Rediscuss!", :points => "10", :more_options => true) }
expect(f('#discussion-title')).to have_value "Rediscuss!"
expect(f('#discussion_topic_assignment_points_possible')).to have_value "10"
end

View File

@ -28,10 +28,10 @@ describe "external tool assignments" do
@t2 = factory_with_protected_attributes(@course.context_external_tools, :url => "http://www.justanexamplenotarealwebsite.com/tool2", :shared_secret => 'test123', :consumer_key => 'test123', :name => 'tool 2')
end
it "should allow creating through index", priority: "2", test_id: 209971 do
it "should allow creating through index", priority: "2", test_id: 209971 do
get "/courses/#{@course.id}/assignments"
expect_no_flash_message :error
#create assignment
# create assignment
f('.add_assignment').click
f('.ui-datepicker-trigger').click
f('.create_assignment_dialog input[name="name"]').send_keys('test1')
@ -50,7 +50,7 @@ describe "external tool assignments" do
it "should allow creating through the 'More Options' link", priority: "2", test_id: 209973 do
get "/courses/#{@course.id}/assignments"
#create assignment
# create assignment
f('.add_assignment').click
expect_new_page_load { f('.more_options').click }
@ -107,8 +107,8 @@ describe "external tool assignments" do
end
it "should show module sequence even without module_item_id param" do
allow(BasicLTI::Sourcedid).to receive(:encryption_secret) {'encryption-secret-5T14NjaTbcYjc4'}
allow(BasicLTI::Sourcedid).to receive(:signing_secret) {'signing-secret-vp04BNqApwdwUYPUI'}
allow(BasicLTI::Sourcedid).to receive(:encryption_secret) { 'encryption-secret-5T14NjaTbcYjc4' }
allow(BasicLTI::Sourcedid).to receive(:signing_secret) { 'signing-secret-vp04BNqApwdwUYPUI' }
a = assignment_model(:course => @course, :title => "test2", :submission_types => 'external_tool')
a.create_external_tool_tag(:url => @t1.url)
a.external_tool_tag.update_attribute(:content_type, 'ContextExternalTool')
@ -128,7 +128,7 @@ describe "external tool assignments" do
context "submission type selection placement" do
before :each do
[@t1, @t2].each do |tool|
tool.submission_type_selection = {:text => "link to #{tool.name} or whatever"}
tool.submission_type_selection = { :text => "link to #{tool.name} or whatever" }
tool.save!
end
end
@ -156,7 +156,7 @@ describe "external tool assignments" do
it "should show the tool as selected when editing a saved configured assignment" do
assmt = @course.assignments.create!(:title => "blah", :submission_types => "external_tool",
:external_tool_tag_attributes => {:content => @t1, :url => @t1.url})
:external_tool_tag_attributes => { :content => @t1, :url => @t1.url })
get "/courses/#{@course.id}/assignments/#{assmt.id}/edit"
selected = first_selected_option(f("#assignment_submission_type"))
expect(selected.text.strip).to eq @t1.name
@ -178,7 +178,7 @@ describe "external tool assignments" do
:course => @course,
:title => "test1",
:submission_types => 'external_tool',
:external_tool_tag_attributes => {:content => @t1, :url => @t1.url, :external_data => ext_data.to_json}
:external_tool_tag_attributes => { :content => @t1, :url => @t1.url, :external_data => ext_data.to_json }
)
get "/courses/#{@course.id}/assignments/#{a.id}/edit"
@ -200,7 +200,7 @@ describe "external tool assignments" do
close_button_selector = "//span[@aria-label = 'Launch External Tool']//button[//*[text() = 'Close']]"
close_button = fxpath(close_button_selector)
close_button.click
expect(element_exists?(close_button_selector,true)).to eq(false)
expect(element_exists?(close_button_selector, true)).to eq(false)
end
end
end

View File

@ -25,9 +25,9 @@ describe "assignments" do
include_context "in-process server selenium tests"
before(:once) do
@user = user_with_pseudonym({:active_user => true})
@user = user_with_pseudonym({ :active_user => true })
@pseudonym = @user.pseudonym
@course = course_with_teacher({:user => @user, :active_course => true, :active_enrollment => true}).course
@course = course_with_teacher({ :user => @user, :active_course => true, :active_enrollment => true }).course
end
before :each do
@ -57,7 +57,7 @@ describe "assignments" do
end
end
it "should validate points for letter grading (!= '')", priority: '2', test_id:209985 do
it "should validate points for letter grading (!= '')", priority: '2', test_id: 209985 do
points_validation(@assignment) do
AssignmentCreateEditPage.select_grading_type 'Letter Grade'
AssignmentCreateEditPage.enter_points_possible ''
@ -136,7 +136,7 @@ describe "assignments" do
yield if block_given?
AssignmentCreateEditPage.assignment_save_button.click
wait_for_ajaximations
expect(f('.errorBox:not(#error_box_template)')).
to include_text('Points possible must be 0 or more for selected grading type')
expect(f('.errorBox:not(#error_box_template)'))
.to include_text('Points possible must be 0 or more for selected grading type')
end
end

View File

@ -27,8 +27,8 @@ describe "assignment group that can't manage assignments" do
it "does not display the manage cog menu" do
@domain_root_account = Account.default
course_factory
account_admin_user_with_role_changes(:role_changes => {:manage_course => true,
:manage_assignments => false})
account_admin_user_with_role_changes(:role_changes => { :manage_course => true,
:manage_assignments => false })
user_session(@user)
@course.require_assignment_group
@assignment_group = @course.assignment_groups.first
@ -233,7 +233,7 @@ describe "assignment groups" do
4.times do |i|
ags << @course.assignment_groups.create!(name: "group_#{i}")
end
expect(ags.collect(&:position)).to eq [1,2,3,4,5]
expect(ags.collect(&:position)).to eq [1, 2, 3, 4, 5]
get "/courses/#{@course.id}/assignments"
wait_for_ajaximations
@ -241,15 +241,15 @@ describe "assignment groups" do
wait_for_ajaximations
ags.each(&:reload)
expect(ags.collect(&:position)).to eq [1,3,2,4,5]
expect(ags.collect(&:position)).to eq [1, 3, 2, 4, 5]
end
context 'quick-adding an assignment to a group' do
let(:assignment_group) { @course.assignment_groups.first }
let(:assignment_name) { "Do this" }
let(:assignment_points) { "13" }
let(:time) {Time.zone.local(2018,2,7,4,15)}
let(:current_time) {format_time_for_view(time, :medium)}
let(:time) { Time.zone.local(2018, 2, 7, 4, 15) }
let(:current_time) { format_time_for_view(time, :medium) }
before :each do
@course.require_assignment_group

View File

@ -28,12 +28,12 @@ describe 'assignments index menu tool placement' do
@tool1 = Account.default.context_external_tools.new(:name => "a", :domain => "google.com", :consumer_key => '12345', :shared_secret => 'secret')
# tool1 is on index and group menus
@tool1.assignment_index_menu = {:url => "http://www.example.com", :text => "Import Stuff"}
@tool1.assignment_group_menu = {:url => "http://www.example.com", :text => "Import Stuff Here"}
@tool1.assignment_index_menu = { :url => "http://www.example.com", :text => "Import Stuff" }
@tool1.assignment_group_menu = { :url => "http://www.example.com", :text => "Import Stuff Here" }
@tool1.save!
@tool2 = Account.default.context_external_tools.new(:name => "b", :domain => "google.com", :consumer_key => '12345', :shared_secret => 'secret')
# tool2 is on assignment menu
@tool2.assignment_menu = {:url => "http://www.example.com", :text => "Second Tool"}
@tool2.assignment_menu = { :url => "http://www.example.com", :text => "Second Tool" }
@tool2.save!
# assignments groups
@agroup1 = @course.assignment_groups.create!(:name => "assignments group1")
@ -62,8 +62,8 @@ describe 'assignments index menu tool placement' do
expect(query_params["com_instructure_course_canvas_resource_type"]).to eq "assignment"
expect(query_params["com_instructure_course_accept_canvas_resource_types"]).to eq ["assignment"]
expect(query_params["com_instructure_course_available_canvas_resources"].values).to eq [
{"course_id" => @course.id.to_s, "type" => "assignment_group"}
] # will replace with the groups on the variable expansion
{ "course_id" => @course.id.to_s, "type" => "assignment_group" }
] # will replace with the groups on the variable expansion
end
it "should be able to launch the group menu tool via the tray", custom_timeout: 30 do
@ -82,7 +82,7 @@ describe 'assignments index menu tool placement' do
expect(query_params["com_instructure_course_canvas_resource_type"]).to eq "assignment"
expect(query_params["com_instructure_course_accept_canvas_resource_types"]).to eq ["assignment"]
group_data = [@agroup2].map{|ag| {"id" => ag.id.to_s, "name" => ag.name}} # just the selected group
group_data = [@agroup2].map { |ag| { "id" => ag.id.to_s, "name" => ag.name } } # just the selected group
expect(query_params["com_instructure_course_available_canvas_resources"].values).to match_array(group_data)
end

View File

@ -35,7 +35,7 @@ describe "assignment groups" do
course_with_teacher_logged_in
end
it "should create an assignment with default dates", priority:"1", test_id: 216344 do
it "should create an assignment with default dates", priority: "1", test_id: 216344 do
visit_new_assignment_page
fill_assignment_title 'vdd assignment'
fill_assignment_overrides
@ -54,12 +54,12 @@ describe "assignment groups" do
assignment = create_assignment!
visit_assignment_edit_page(assignment)
expect(first_due_at_element.attribute(:value)).
to match format_date_for_view(due_at)
expect(first_unlock_at_element.attribute(:value)).
to match format_date_for_view(unlock_at)
expect(first_lock_at_element.attribute(:value)).
to match format_date_for_view(lock_at)
expect(first_due_at_element.attribute(:value))
.to match format_date_for_view(due_at)
expect(first_unlock_at_element.attribute(:value))
.to match format_date_for_view(unlock_at)
expect(first_lock_at_element.attribute(:value))
.to match format_date_for_view(lock_at)
end
it "should edit a due date", priority: "2", test_id: 216346 do
@ -72,8 +72,8 @@ describe "assignment groups" do
first_due_at_element.send_keys(format_date_for_view(due_at, :medium))
update_assignment!
expect(assignment.reload.due_at.to_date).
to eq due_at.to_date
expect(assignment.reload.due_at.to_date)
.to eq due_at.to_date
end
it "should clear a due date", priority: "2", test_id: 216348 do
@ -101,28 +101,28 @@ describe "assignment groups" do
select_first_override_section(default_section.name)
select_first_override_header("Mastery Paths")
first_due_at_element.clear
first_due_at_element.
send_keys(format_date_for_view(default_section_due, :medium))
first_due_at_element
.send_keys(format_date_for_view(default_section_due, :medium))
add_override
wait_for_ajaximations
select_last_override_section(other_section.name)
last_due_at_element.
send_keys(format_date_for_view(other_section_due, :medium))
last_due_at_element
.send_keys(format_date_for_view(other_section_due, :medium))
# `return_to` is not set, so no redirect happens
wait_for_new_page_load{ submit_form('#edit_assignment_form') }
wait_for_new_page_load { submit_form('#edit_assignment_form') }
overrides = assign.reload.assignment_overrides
expect(overrides.count).to eq 3
default_override = overrides.detect{ |o| o.set_id == default_section.id }
expect(default_override.due_at.to_date).
to eq default_section_due.to_date
noop_override = overrides.detect{ |o| o.set_type == "Noop" }
default_override = overrides.detect { |o| o.set_id == default_section.id }
expect(default_override.due_at.to_date)
.to eq default_section_due.to_date
noop_override = overrides.detect { |o| o.set_type == "Noop" }
expect(noop_override.title).to eq "Mastery Paths"
other_override = overrides.detect{ |o| o.set_id == other_section.id }
expect(other_override.due_at.to_date).
to eq other_section_due.to_date
other_override = overrides.detect { |o| o.set_id == other_section.id }
expect(other_override.due_at.to_date)
.to eq other_section_due.to_date
end
it "should not show inactive students when setting overrides" do
@ -162,11 +162,11 @@ describe "assignment groups" do
first_due_at_element.clear
first_unlock_at_element.clear
first_lock_at_element.clear
last_due_at_element.
send_keys(format_date_for_view(due_date, :medium))
wait_for_new_page_load{ submit_form('#edit_assignment_form') }
last_due_at_element
.send_keys(format_date_for_view(due_date, :medium))
wait_for_new_page_load { submit_form('#edit_assignment_form') }
overrides = assign.reload.assignment_overrides
section_override = overrides.detect{ |o| o.set_id == section1.id }
section_override = overrides.detect { |o| o.set_id == section1.id }
expect(section_override.due_at.to_date)
.to eq due_date.to_date
end
@ -207,12 +207,10 @@ describe "assignment groups" do
end
context "as a student" do
let(:unlock_at) { Time.zone.now - 2.days }
let(:lock_at) { Time.zone.now + 4.days }
before(:each) do
course_with_student_logged_in(:active_all => true)
end

View File

@ -30,10 +30,10 @@ describe "assignments" do
@student2 = student_in_course.user
@assignment = assignment_model({
course: @course,
peer_reviews: true,
automatic_peer_reviews: false,
})
course: @course,
peer_reviews: true,
automatic_peer_reviews: false,
})
@assignment.assign_peer_review(@student1, @student2)
@assignment.assign_peer_review(@student2, @student1)
@ -57,11 +57,11 @@ describe "assignments" do
gc = GroupCategory.create(:name => "Inconceivable", :context => @course)
@course.groups.create!(:group_category => gc)
@assignment = assignment_model({
course: @course,
peer_reviews: true,
automatic_peer_reviews: true,
group_category_id: gc.id
})
course: @course,
peer_reviews: true,
automatic_peer_reviews: true,
group_category_id: gc.id
})
submission = @assignment.submit_homework(student)
submission.submission_type = "online_text_entry"
@ -80,7 +80,7 @@ describe "assignments" do
student_in_course(:user => @student1, :active_all => true)
@student2 = student_in_course(:active_all => true).user
@assignment = assignment_model({course: @course, peer_reviews: true, automatic_peer_reviews: false})
@assignment = assignment_model({ course: @course, peer_reviews: true, automatic_peer_reviews: false })
end
before :each do
@ -127,10 +127,10 @@ describe "assignments" do
@student = student_in_course.user
@assignment = assignment_model({
course: @course,
peer_reviews: true,
automatic_peer_reviews: false,
})
course: @course,
peer_reviews: true,
automatic_peer_reviews: false,
})
rubric_association_model(purpose: 'grading', association_object: @assignment)
@assignment.assign_peer_review(@admin, @student)
@ -154,60 +154,60 @@ describe "assignments" do
let!(:reviewer) { student_in_course(active_all: true).user }
let!(:assignment) {
@assignment = assignment_model({
course: review_course,
peer_reviews: true,
anonymous_peer_reviews: true
})
course: review_course,
peer_reviews: true,
anonymous_peer_reviews: true
})
@assignment.unmute!
@assignment
}
let!(:submission) {
submission_model({
assignment: assignment,
body: 'submission body',
course: review_course,
grade: "5",
score: "5",
submission_type: 'online_text_entry',
user: reviewed
})
assignment: assignment,
body: 'submission body',
course: review_course,
grade: "5",
score: "5",
submission_type: 'online_text_entry',
user: reviewed
})
}
let!(:submissionReviewer) {
submission_model({
assignment: assignment,
body: 'submission body reviewer',
course: review_course,
grade: "5",
score: "5",
submission_type: 'online_text_entry',
user: reviewer
})
assignment: assignment,
body: 'submission body reviewer',
course: review_course,
grade: "5",
score: "5",
submission_type: 'online_text_entry',
user: reviewer
})
}
let!(:comment) {
submission_comment_model({
author: reviewer,
submission: submission
})
author: reviewer,
submission: submission
})
}
let!(:rubric) { rubric_model }
let!(:association) {
rubric.associate_with(assignment, review_course, {
:purpose => 'grading', :use_for_grading => true
})
:purpose => 'grading', :use_for_grading => true
})
}
let!(:assessment) {
association.assess({
:user => reviewed,
:assessor => reviewer,
:artifact => submission,
:assessment => {
:assessment_type => 'peer_review',
:criterion_crit1 => {
:points => 5,
:comments => "Hey, it's a comment."
}
}
})
:user => reviewed,
:assessor => reviewer,
:artifact => submission,
:assessment => {
:assessment_type => 'peer_review',
:criterion_crit1 => {
:points => 5,
:comments => "Hey, it's a comment."
}
}
})
}
before(:each) { assignment.assign_peer_review(reviewer, reviewed) }

View File

@ -33,7 +33,6 @@ describe 'assignments' do
end
context 'quick add' do
def fill_out_quick_add_modal(type)
get "/courses/#{@course.id}/assignments"
f('.add_assignment').click
@ -42,14 +41,14 @@ describe 'assignments' do
@assignment_date = '2015-07-31'
@assignment_points = '3'
click_option(f('[name="submission_types"]'),type)
click_option(f('[name="submission_types"]'), type)
f('div.form-dialog-content.create_assignment_dialog > div.form-horizontal > div:nth-of-type(2) > div.controls > input').send_keys(@assignment_name)
f('.datetime_field').send_keys(@assignment_date)
f('input[name="points_possible"]').send_keys(@assignment_points)
end
it 'should open quick add modal ', priority:"1", test_id: 238872 do
it 'should open quick add modal ', priority: "1", test_id: 238872 do
get "/courses/#{@course.id}/assignments"
f('.add_assignment').click
@ -59,7 +58,7 @@ describe 'assignments' do
end
context 'more options button' do
it 'should work for assignments and transfer values', priority:"1", test_id: 56009 do
it 'should work for assignments and transfer values', priority: "1", test_id: 56009 do
fill_out_quick_add_modal('Assignment')
f('.more_options').click
@ -69,7 +68,7 @@ describe 'assignments' do
expect(f('input.date_field.datePickerDateField.DueDateInput.datetime_field_enabled.hasDatepicker').attribute(:value)).to include('Jul 31')
end
it 'should work for discussions and transfer values', priority:"1", test_id: 58760 do
it 'should work for discussions and transfer values', priority: "1", test_id: 58760 do
fill_out_quick_add_modal('Discussion')
f('.more_options').click
@ -79,7 +78,7 @@ describe 'assignments' do
expect(f('input.date_field.datePickerDateField.DueDateInput.datetime_field_enabled.hasDatepicker').attribute(:value)).to include('Jul 31')
end
it 'should work for quizzes and transfer values', priority:"1", test_id: 238873 do
it 'should work for quizzes and transfer values', priority: "1", test_id: 238873 do
fill_out_quick_add_modal('Quiz')
f('.more_options').click
@ -95,15 +94,15 @@ describe 'assignments' do
@title = 'zoidberg'
end
it 'should work with an assignment', priority:"1", test_id: 112794 do
assignment = @course.assignments.create!(title: 'test assignment', name:@title, workflow_state: "published")
it 'should work with an assignment', priority: "1", test_id: 112794 do
assignment = @course.assignments.create!(title: 'test assignment', name: @title, workflow_state: "published")
get "/courses/#{@course.id}/assignments"
click_cog_to_edit
expect(f("#assign_#{assignment.id}_assignment_name").attribute(:value)).to include(@title)
end
it 'should work with a quiz', priority:"1", test_id: 269809 do
it 'should work with a quiz', priority: "1", test_id: 269809 do
assignment = @course.assignments.create(title: @title, submission_types: "online_quiz", workflow_state: "published")
get "/courses/#{@course.id}/assignments"
click_cog_to_edit
@ -111,8 +110,8 @@ describe 'assignments' do
expect(f("#assign_#{assignment.id}_assignment_name").attribute(:value)).to include(@title)
end
it 'should work with a graded discussion', priority:"1", test_id: 269810 do
assignment = @course.assignments.create!(name: @title, submission_types: 'discussion_topic')
it 'should work with a graded discussion', priority: "1", test_id: 269810 do
assignment = @course.assignments.create!(name: @title, submission_types: 'discussion_topic')
get "/courses/#{@course.id}/assignments"
click_cog_to_edit
expect(f("#assign_#{assignment.id}_assignment_name").attribute(:value)).to include(@title)

View File

@ -62,7 +62,7 @@ describe "quizzes assignments" do
it "should redirect to the quiz edit page and maintain parameters", priority: "2", test_id: 220309 do
assign = @course.assignments.create!(:name => "Testy!", :submission_types => "online_quiz")
get "/courses/#{@course.id}/assignments"
expect_new_page_load { edit_assignment(assign.id, :name => "Retest!", :more_options => true)}
expect_new_page_load { edit_assignment(assign.id, :name => "Retest!", :more_options => true) }
expect(f('input[name="quiz[title]"]')).to have_value "Retest!"
end
end

View File

@ -51,25 +51,25 @@ describe "assignment rubrics" do
get "/courses/#{@course.id}/rubrics"
expect do
f('.add_rubric_link').click
f('#add_criterion_container a:nth-of-type(1)').click
f('#add_criterion_button').click
set_value(f('#edit_criterion_form .description'), 'criterion 1')
f('.ui-dialog-buttonset .save_button').click
wait_for_ajaximations
f('#criterion_2 .add_rating_link_after').click
f('.add_rubric_link').click
f('#add_criterion_container a:nth-of-type(1)').click
f('#add_criterion_button').click
set_value(f('#edit_criterion_form .description'), 'criterion 1')
f('.ui-dialog-buttonset .save_button').click
wait_for_ajaximations
f('#criterion_2 .add_rating_link_after').click
expect(f('#flash_screenreader_holder')).to have_attribute("textContent", "New Rating Created")
set_value(f('.rating_description'), 'rating 1')
fj('.ui-dialog-buttonset:visible .save_button').click
wait_for_ajaximations
submit_form('#edit_rubric_form')
wait_for_ajaximations
expect(f('#flash_screenreader_holder')).to have_attribute("textContent", "New Rating Created")
set_value(f('.rating_description'), 'rating 1')
fj('.ui-dialog-buttonset:visible .save_button').click
wait_for_ajaximations
submit_form('#edit_rubric_form')
wait_for_ajaximations
end.to change(Rubric, :count).by(1)
expect(f('.rubric_table tbody tr:nth-of-type(3) .description_title')).
to include_text('criterion 1')
expect(f('.rubric_table tbody tr:nth-of-type(3) .ratings td:nth-of-type(2) .rating_description_value')).
to include_text('rating 1')
expect(f('.rubric_table tbody tr:nth-of-type(3) .description_title'))
.to include_text('criterion 1')
expect(f('.rubric_table tbody tr:nth-of-type(3) .ratings td:nth-of-type(2) .rating_description_value'))
.to include_text('rating 1')
end
it "should add a new rubric to assignment and verify points", priority: "1", test_id: 114341 do
@ -115,9 +115,9 @@ describe "assignment rubrics" do
wait_for_ajaximations
fln('My Rubric').click
wait_for_ajaximations
f('#rubric_dialog_'+course_rubric.id.to_s+' .select_rubric_link').click
f('#rubric_dialog_' + course_rubric.id.to_s + ' .select_rubric_link').click
wait_for_ajaximations
expect(f('#rubric_'+course_rubric.id.to_s+' .rubric_title .title')).to include_text(course_rubric.title)
expect(f('#rubric_' + course_rubric.id.to_s + ' .rubric_title .title')).to include_text(course_rubric.title)
# Find the associated rubric for the assignment we just edited
association = RubricAssociation.where(title: "first test assignment")
@ -160,10 +160,10 @@ describe "assignment rubrics" do
f('.add_rubric_link').click
f('#rubric_new .editing .find_rubric_link').click
wait_for_ajax_requests
expect(f('#rubric_dialog_'+@rubric.id.to_s+' .title')).to include_text(@rubric.title)
f('#rubric_dialog_'+@rubric.id.to_s+' .select_rubric_link').click
expect(f('#rubric_dialog_' + @rubric.id.to_s + ' .title')).to include_text(@rubric.title)
f('#rubric_dialog_' + @rubric.id.to_s + ' .select_rubric_link').click
wait_for_ajaximations
expect(f('#rubric_'+@rubric.id.to_s+' .rubric_title .title')).to include_text(@rubric.title)
expect(f('#rubric_' + @rubric.id.to_s + ' .rubric_title .title')).to include_text(@rubric.title)
expect(f('#rubrics span .rubric_total').text).to eq '8'
end
@ -179,7 +179,7 @@ describe "assignment rubrics" do
before do
@course.account.enable_feature!(:account_level_mastery_scales)
proficiency = outcome_proficiency_model(@course)
@proficiency_rating_points = proficiency.outcome_proficiency_ratings.map { |rating| round_if_whole(rating.points).to_s}
@proficiency_rating_points = proficiency.outcome_proficiency_ratings.map { |rating| round_if_whole(rating.points).to_s }
end
it "should use the course mastery scale for outcome criterion when editing account rubrics within an assignment" do
@ -275,7 +275,7 @@ describe "assignment rubrics" do
outcome_with_rubric
@assignment = @course.assignments.create(name: 'assignment with rubric')
@association = @rubric.associate_with(@assignment, @course, purpose: 'grading', use_for_grading: true)
@submission = @assignment.submit_homework(@student, {url: "http://www.instructure.com/"})
@submission = @assignment.submit_homework(@student, { url: "http://www.instructure.com/" })
@rubric.data[0][:ignore_for_scoring] = '1'
@rubric.points_possible = 5
@rubric.save!
@ -298,16 +298,16 @@ describe "assignment rubrics" do
outcome_with_rubric
@assignment = @course.assignments.create(:name => 'assignment with rubric')
@association = @rubric.associate_with(@assignment, @course, purpose: 'grading', use_for_grading: true)
@submission = @assignment.submit_homework(@student, {url: "http://www.instructure.com/"})
@submission = @assignment.submit_homework(@student, { url: "http://www.instructure.com/" })
get "/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}"
wait_for_ajaximations
f(".assess_submission_link").click
wait_for_ajaximations
check_element_has_focus(f(".hide_rubric_link"))
driver.action.key_down(:shift)
.send_keys(:tab)
.key_up(:shift)
.perform
.send_keys(:tab)
.key_up(:shift)
.perform
check_element_has_focus(f(".save_rubric_button"))
driver.action.send_keys(:tab).perform
check_element_has_focus(f(".hide_rubric_link"))
@ -486,12 +486,12 @@ describe "assignment rubrics" do
:description => "Amazing",
},
"1" => {
:points => 50,
:description => "Reduced Marks",
:points => 50,
:description => "Reduced Marks",
},
"2" => {
:points => 20,
:description => "Less than twenty percent",
:points => 20,
:description => "Less than twenty percent",
}
}
}
@ -686,13 +686,12 @@ describe "assignment rubrics" do
assessor: @teacher,
artifact: assignment.find_or_create_submission(@student),
assessment: {
assessment_type: 'grading',
:"criterion_#{@rubric.criteria_object.first.id}" => {
points: 3,
comments: comment,
}
}
)
assessment_type: 'grading',
:"criterion_#{@rubric.criteria_object.first.id}" => {
points: 3,
comments: comment,
}
})
# when
get "/courses/#{@course.id}/assignments/#{assignment.id}/submissions/#{@student.id}"
f('.assess_submission_link').click

View File

@ -36,10 +36,9 @@ describe "assignments" do
# note: due date testing can be found in assignments_overrides_spec
context "as a teacher" do
before(:once) do
@teacher = user_with_pseudonym
course_with_teacher({:user => @teacher, :active_course => true, :active_enrollment => true})
course_with_teacher({ :user => @teacher, :active_course => true, :active_enrollment => true })
@course.start_at = nil
@course.save!
@course.require_assignment_group
@ -77,8 +76,7 @@ describe "assignments" do
end
context "save and publish button" do
def create_assignment(publish = true, params = {name: "Test Assignment"})
def create_assignment(publish = true, params = { name: "Test Assignment" })
@assignment = @course.assignments.create(params)
@assignment.unpublish unless publish
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
@ -89,7 +87,7 @@ describe "assignments" do
expect(f("#assignment-draft-state")).to be_displayed
expect_new_page_load {f(".save_and_publish").click}
expect_new_page_load { f(".save_and_publish").click }
expect(f("#assignment_publish_button.btn-published")).to be_displayed
# Check that the list of quizzes is also updated
@ -104,9 +102,8 @@ describe "assignments" do
end
context "moderated grading assignments" do
before do
@assignment = @course.assignments.create({name: "Test Moderated Assignment"})
@assignment = @course.assignments.create({ name: "Test Moderated Assignment" })
@assignment.update_attribute(:moderated_grading, true)
@assignment.update_attribute(:grader_count, 1)
@assignment.update_attribute(:final_grader, @teacher)
@ -136,10 +133,10 @@ describe "assignments" do
group = @course.assignment_groups.create!(:name => "default")
second_group = @course.assignment_groups.create!(:name => "second default")
@assignment = @course.assignments.create!(
:name => assignment_name,
:due_at => due_date,
:assignment_group => group,
:unlock_at => due_date - 1.day
:name => assignment_name,
:due_at => due_date,
:assignment_group => group,
:unlock_at => due_date - 1.day
)
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
@ -149,13 +146,13 @@ describe "assignments" do
click_option('#assignment_group_id', second_group.name)
click_option('#assignment_grading_type', 'Letter Grade')
#check grading levels dialog
# check grading levels dialog
f('.edit_letter_grades_link').click
wait_for_ajaximations
expect(f('#edit_letter_grades_form')).to be_displayed
close_visible_dialog
#check peer reviews option
# check peer reviews option
form = f("#edit_assignment_form")
assignment_points_possible = f("#assignment_points_possible")
replace_content(assignment_points_possible, "5")
@ -171,7 +168,7 @@ describe "assignments" do
wait_for_ajaximations
f('#assignment_name').send_keys(' edit')
#save changes
# save changes
submit_assignment_form
expect(driver.title).to include(assignment_name + ' edit')
end
@ -179,7 +176,7 @@ describe "assignments" do
it "should create an assignment using main add button", :xbrowser, priority: "1", test_id: 132582 do
assignment_name = 'first assignment'
# freeze for a certain time, so we don't get unexpected ui complications
time = DateTime.new(Time.now.year,1,7,2,13)
time = DateTime.new(Time.now.year, 1, 7, 2, 13)
Timecop.freeze(time) do
due_at = format_time_for_view(time)
@ -206,14 +203,14 @@ describe "assignments" do
end
it "only allows an assignment editor to edit points and title if assignment " +
"if assignment has multiple due dates", priority: "2", test_id: 622376 do
"if assignment has multiple due dates", priority: "2", test_id: 622376 do
skip "DEMO-25 (8/21/20)"
middle_number = '15'
expected_date = (Time.now - 1.month).strftime("%b #{middle_number}")
@assignment = @course.assignments.create!(
:title => "VDD Test Assignment",
:due_at => expected_date
:title => "VDD Test Assignment",
:due_at => expected_date
)
section = @course.course_sections.create!(:name => "new section")
@assignment.assignment_overrides.create! do |override|
@ -244,7 +241,7 @@ describe "assignments" do
it 'creates a simple assignment and defaults post_to_sis' do
a = @course.account
a.settings[:sis_default_grade_export] = {locked: false, value: true}
a.settings[:sis_default_grade_export] = { locked: false, value: true }
a.save!
assignment_name = "test_assignment_thing_#{rand(10000)}"
get "/courses/#{@course.id}/assignments"
@ -262,7 +259,7 @@ describe "assignments" do
enable_cache do
expected_text = "Assignment 1"
# freeze time to avoid ui complications
time = DateTime.new(2015,1,7,2,13)
time = DateTime.new(2015, 1, 7, 2, 13)
Timecop.freeze(time) do
due_at = format_time_for_datepicker(time)
points = '25'
@ -297,9 +294,9 @@ describe "assignments" do
middle_number = '15'
expected_date = (Time.now - 1.month).strftime("%b #{middle_number}")
@assignment = @course.assignments.create!(
:title => "Test Assignment",
:points_possible => 10,
:due_at => expected_date
:title => "Test Assignment",
:points_possible => 10,
:due_at => expected_date
)
section = @course.course_sections.create!(:name => "new section")
@assignment.assignment_overrides.create! do |override|
@ -329,9 +326,9 @@ describe "assignments" do
it "should validate that a group category is selected", priority: "1", test_id: 626905 do
assignment_name = 'first test assignment'
@assignment = @course.assignments.create({
:name => assignment_name,
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
:name => assignment_name,
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
f('#has_group_category').click
@ -345,9 +342,9 @@ describe "assignments" do
it "shows assignment details, un-editable, for concluded teachers", priority: "2", test_id: 626906 do
@teacher.enrollments.first.conclude
@assignment = @course.assignments.create({
:name => "assignment after concluded",
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
:name => "assignment after concluded",
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
@ -373,12 +370,10 @@ describe "assignments" do
expect(name.text).to eq "Well hello there"
end
context "group assignments" do
before(:once) do
ag = @course.assignment_groups.first
@assignment1, @assignment2 = [1,2].map do |i|
@assignment1, @assignment2 = [1, 2].map do |i|
gc = GroupCategory.create(:name => "gc#{i}", :context => @course)
group = @course.groups.create!(:group_category => gc)
group.users << student_in_course(:course => @course, :active_all => true).user
@ -388,7 +383,8 @@ describe "assignments" do
group_category: gc,
submission_types: 'online_text_entry',
peer_reviews: "1",
automatic_peer_reviews: true)
automatic_peer_reviews: true
)
end
submission = @assignment1.submit_homework(@student)
submission.submission_type = "online_text_entry"
@ -402,7 +398,7 @@ describe "assignments" do
end
it "should still show deleted group set only on an attached assignment with " +
"submissions", priority: "2", test_id: 627149 do
"submissions", priority: "2", test_id: 627149 do
@assignment1.group_category.destroy
@assignment2.group_category.destroy
@ -445,7 +441,7 @@ describe "assignments" do
@assignment = @course.assignments.create(name: "Student Annotation", submission_types: 'student_annotation,online_text_entry', annotatable_attachment_id: attachment.id)
end
it "creates a student annotation assignment with annotatable attachment with usage rights" do
it "creates a student annotation assignment with annotatable attachment with usage rights" do
get "/courses/#{@course.id}/assignments"
wait_for_new_page_load { f(".new_assignment").click }
@ -454,7 +450,7 @@ describe "assignments" do
replace_content(f('#assignment_points_possible'), "10")
click_option('#assignment_submission_type', 'Online')
['#assignment_annotated_document','#assignment_text_entry'].each do |element|
['#assignment_annotated_document', '#assignment_text_entry'].each do |element|
f(element).click
end
@ -462,11 +458,11 @@ describe "assignments" do
expect(f('#assignment_annotated_document_info')).to be_displayed
#select attachment from file explorer
# select attachment from file explorer
fxpath('//*[@id="annotated_document_chooser_container"]/div/div[1]/ul/li[1]/button').click
fxpath('//*[@id="annotated_document_chooser_container"]/div/div[1]/ul/li[1]/ul/li/button').click
#set usage rights
# set usage rights
f('#usageRightSelector').click
fxpath('//*[@id="usageRightSelector"]/option[2]').click
f('#copyrightHolder').send_keys('Me')
@ -507,7 +503,7 @@ describe "assignments" do
expect(element).to contain_css("a.delete_group.disabled")
end
it "should not allow deleting a frozen assignment from index page", priority:"2", test_id: 649309 do
it "should not allow deleting a frozen assignment from index page", priority: "2", test_id: 649309 do
get "/courses/#{@course.id}/assignments"
fj("div#assignment_#{@frozen_assign.id} button.al-trigger").click
wait_for_ajaximations
@ -521,7 +517,7 @@ describe "assignments" do
end
expect(f('.assignment_dates').text).to match /Sep 20, 2012/
#some sort of time zone issue is occurring with Sep 20, 2012 - it rolls back a day and an hour locally.
# some sort of time zone issue is occurring with Sep 20, 2012 - it rolls back a day and an hour locally.
expect(@frozen_assign.reload.due_at.to_i).not_to eq old_due_at.to_i
end
end
@ -531,7 +527,7 @@ describe "assignments" do
it "should delete assignments", priority: "1", test_id: 647609 do
skip_if_safari(:alert)
ag = @course.assignment_groups.first
as = @course.assignments.create({:assignment_group => ag})
as = @course.assignments.create({ :assignment_group => ag })
get "/courses/#{@course.id}/assignments"
wait_for_ajaximations
@ -684,8 +680,8 @@ describe "assignments" do
@assignment.grade_student(@student, grade: 14, grader: @teacher)
get "/courses/#{@course.id}/assignments"
wait_for_ajaximations
expect(f("#assignment_#{@assignment.id} .js-score .non-screenreader").
text).to match "14/15 pts"
expect(f("#assignment_#{@assignment.id} .js-score .non-screenreader")
.text).to match "14/15 pts"
end
it "should allow publishing from the show page", priority: "1", test_id: 647851 do
@ -810,12 +806,11 @@ describe "assignments" do
end
context "moderated grading" do
before do
course_with_teacher_logged_in
@course.start_at = nil
@course.save!
@assignment = @course.assignments.create({name: "Test Moderated Assignment"})
@assignment = @course.assignments.create({ name: "Test Moderated Assignment" })
@assignment.update(
moderated_grading: true,
grader_count: 1,
@ -825,7 +820,7 @@ describe "assignments" do
end
it "should deny access for a regular student to the moderation page", priority: "1", test_id: 609652 do
course_with_student_logged_in({course: @course})
course_with_student_logged_in({ course: @course })
get "/courses/#{@course.id}/assignments/#{@assignment.id}/moderate"
expect(f('#unauthorized_message')).to be_displayed
end
@ -845,7 +840,7 @@ describe "assignments" do
end
it "should default to post grades if account setting is enabled", priority: "2", test_id: 498879 do
@account.settings[:sis_default_grade_export] = {:locked => false, :value => true}
@account.settings[:sis_default_grade_export] = { :locked => false, :value => true }
@account.save!
get "/courses/#{@course.id}/assignments/new"
@ -869,7 +864,7 @@ describe "assignments" do
fj('div.controls > input:visible').send_keys(@new_group)
end
it "should add a new assignment group", priority: "1", test_id:525190 do
it "should add a new assignment group", priority: "1", test_id: 525190 do
fj('.button_type_submit:visible').click
wait_for_ajaximations

View File

@ -106,7 +106,8 @@ describe "assignments" do
:title => "some assignment",
:submission_types => "online_url,online_upload,online_text_entry",
:group_category => GroupCategory.create!(:name => "groups", :context => @course),
:grade_group_students_individually => false)
:grade_group_students_individually => false
)
group = assignment.group_category.groups.create!(:name => 'g1', :context => @course)
group.users << u1
group.users << @user
@ -163,7 +164,6 @@ describe "assignments" do
expect(f(".student-assignment-overview")).to be_displayed
end
it "should still not show assignment data if locked by unlock date" do
assignment = @course.assignments.create!(:name => 'not unlocked assignment',
:due_at => 5.days.from_now,
@ -190,7 +190,7 @@ describe "assignments" do
it "should allow submission when within override locks" do
@assignment.update(:submission_types => 'online_text_entry')
# Change unlock dates to be valid for submission
@override.unlock_at = Time.now.utc - 1.days # available now
@override.unlock_at = Time.now.utc - 1.days # available now
@override.save!
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
@ -211,7 +211,7 @@ describe "assignments" do
end
end
context "click_away_accept_alert" do #this context exits to handle the click_away_accept_alert method call after each spec that needs it even if it fails early to prevent other specs from failing
context "click_away_accept_alert" do # this context exits to handle the click_away_accept_alert method call after each spec that needs it even if it fails early to prevent other specs from failing
after(:each) do
click_away_accept_alert
end
@ -418,7 +418,7 @@ describe "assignments" do
it "should correctly categorize assignments by date" do
# assuming two undated and two future assignments created above
undated, upcoming = @course.assignments.partition{ |a| a.due_date.nil? }
undated, upcoming = @course.assignments.partition { |a| a.due_date.nil? }
get "/courses/#{@course.id}/assignments"
wait_for_no_such_element { f('[data-view="assignmentGroups"] .loadingIndicator') }

View File

@ -56,7 +56,6 @@ describe 'submissions' do
wait_for_new_page_load(f('button[type="submit"]').click)
expect(f('#sidebar_content .header')).to include_text 'Submitted!'
end

View File

@ -31,7 +31,6 @@ describe "submissions" do
include K5Common
context 'as a student' do
before(:once) do
@due_date = Time.now.utc + 2.days
course_with_student(active_all: true)
@ -69,7 +68,7 @@ describe "submissions" do
it "should not break when you open and close the media comment dialog", priority: "1", test_id: 237020 do
stub_kaltura
#pending("failing because it is dependant on an external kaltura system")
# pending("failing because it is dependant on an external kaltura system")
create_assignment_and_go_to_page('media_recording')
@ -98,7 +97,7 @@ describe "submissions" do
it "should not allow blank media submission", priority: "1", test_id: 237021 do
skip_if_safari(:alert)
stub_kaltura
#pending("failing because it is dependant on an external kaltura system")
# pending("failing because it is dependant on an external kaltura system")
create_assignment_and_go_to_page 'media_recording'
f(".submit_assignment_link").click
@ -175,7 +174,6 @@ describe "submissions" do
driver.switch_to.default_content
end
it "should not allow a user to submit a file-submission assignment with an empty file", priority: "1" do
skip('flaky, will be fixed in ADMIN-3015')
@assignment.submission_types = 'online_upload'
@ -329,16 +327,16 @@ describe "submissions" do
asset = @submission.turnitin_assets.first.asset_string
@submission.turnitin_data = {
"#{asset}" => {
:object_id => "123456",
:publication_overlap => 5,
:similarity_score => 100,
:state => "failure",
:status => "scored",
:student_overlap => 44,
:web_overlap => 100
},
:last_processed_attempt => 1
"#{asset}" => {
:object_id => "123456",
:publication_overlap => 5,
:similarity_score => 100,
:state => "failure",
:status => "scored",
:student_overlap => 44,
:web_overlap => 100
},
:last_processed_attempt => 1
}
@submission.turnitin_data_changed!
@submission.save!
@ -349,15 +347,14 @@ describe "submissions" do
end
end
it "should submit an assignment and validate confirmation information", priority: "1", test_id: 237029
context 'with Canvadocs enabled' do
before(:once) do
PluginSetting.create! name: 'canvadocs',
settings: {"api_key" => "blahblahblahblahblah",
"base_url" => "http://example.com",
"disabled" => false}
settings: { "api_key" => "blahblahblahblahblah",
"base_url" => "http://example.com",
"disabled" => false }
end
it "should show preview link after submitting a canvadocable file type", priority: "1", test_id: 587302 do
@ -435,7 +432,7 @@ describe "submissions" do
# traverse the tree
f('li[aria-label="My files"] button').click
f('li[aria-label="'+FILENAME+'"] button').click
f('li[aria-label="' + FILENAME + '"] button').click
f('#submit_file_button').click
@ -516,7 +513,7 @@ describe "submissions" do
end
it 'indicates as excused on the submission details page', priority: "1", test_id: 201937 do
get "/courses/#{@course.id}/assignments/#{assignment.id}/submissions/#{@student.id}"
get "/courses/#{@course.id}/assignments/#{assignment.id}/submissions/#{@student.id}"
expect(f("#content .submission_details .entered_grade")).to include_text 'Excused'
end
end
@ -527,7 +524,7 @@ describe "submissions" do
end
before(:once) do
assignment.submit_homework(@student, {submission_type: 'online_text_entry'})
assignment.submit_homework(@student, { submission_type: 'online_text_entry' })
assignment.grade_student @student, excuse: true, grader: @teacher
end
@ -540,7 +537,7 @@ describe "submissions" do
end
before(:once) do
assignment.submit_homework(@student, {submission_type: 'online_text_entry'})
assignment.submit_homework(@student, { submission_type: 'online_text_entry' })
assignment.grade_student @student, excuse: true, grader: @teacher
end

View File

@ -30,7 +30,7 @@ describe 'submissions' do
context "Assignment" do
it "Create an assignment as a teacher", priority: "1", test_id: 56751 do
group_test_setup(3,3,1)
group_test_setup(3, 3, 1)
expect do
create_assignment_with_group_category_preparation
validate_and_submit_form
@ -41,7 +41,7 @@ describe 'submissions' do
it "Edit an assignment", priority: "1", test_id: 238864 do
@assignment = @course.assignments.create!(title: 'assignment 1', name: 'assignment 1', due_at: Time.now.utc + 2.days,
points_possible: 50, submission_types: 'online_text_entry')
group_test_setup(3,3,1)
group_test_setup(3, 3, 1)
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
select_assignment_group_category(-2)
validate_and_submit_form

View File

@ -27,7 +27,6 @@ describe "submissions" do
include SubmissionsCommon
context 'as a teacher' do
before(:each) do
course_with_teacher_logged_in
end
@ -58,7 +57,6 @@ describe "submissions" do
end
context "student view" do
before(:each) do
Account.default.enable_feature!(:rce_enhancements)
course_with_teacher_logged_in
@ -66,10 +64,11 @@ describe "submissions" do
it "should allow a student view student to view/submit assignments", priority: "1", test_id: 237034 do
@assignment = @course.assignments.create(
:title => 'Cool Assignment',
:points_possible => 10,
:submission_types => "online_text_entry",
:due_at => Time.now.utc + 2.days)
:title => 'Cool Assignment',
:points_possible => 10,
:submission_types => "online_text_entry",
:due_at => Time.now.utc + 2.days
)
enter_student_view
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
@ -90,10 +89,11 @@ describe "submissions" do
it "should allow a student view student to submit file upload assignments", priority: "1", test_id: 237035 do
@assignment = @course.assignments.create(
:title => 'Cool Assignment',
:points_possible => 10,
:submission_types => "online_upload",
:due_at => Time.now.utc + 2.days)
:title => 'Cool Assignment',
:points_possible => 10,
:submission_types => "online_upload",
:due_at => Time.now.utc + 2.days
)
enter_student_view
get "/courses/#{@course.id}/assignments/#{@assignment.id}"

View File

@ -34,10 +34,9 @@ describe "assignments sync to sis" do
# note: due date testing can be found in assignments_overrides_spec
context "as a teacher" do
before(:once) do
@teacher = user_with_pseudonym
course_with_teacher({:user => @teacher, :active_course => true, :active_enrollment => true})
course_with_teacher({ :user => @teacher, :active_course => true, :active_enrollment => true })
@course.start_at = nil
@course.save!
@course.require_assignment_group
@ -51,7 +50,7 @@ describe "assignments sync to sis" do
end
let(:name_length_limit) { 10 }
let(:invalid_name) { "Name Assignment Too Long"}
let(:invalid_name) { "Name Assignment Too Long" }
let(:valid_name) { "Name" }
let(:points) { "10" }
let(:differentiate) { false }
@ -99,9 +98,9 @@ describe "assignments sync to sis" do
ff('.DueDateInput')
end
def check_due_date_table(section, due_date="-")
def check_due_date_table(section, due_date = "-")
row_elements = f('.assignment_dates').find_elements(:tag_name, 'tr')
section_row = row_elements.detect{ |i| i.text.include?(section)}
section_row = row_elements.detect { |i| i.text.include?(section) }
expect(section_row).not_to be_nil
expect(section_row.text.split("\n").first).to eq due_date
end
@ -126,7 +125,7 @@ describe "assignments sync to sis" do
def length_settings
{
:sis_assignment_name_length => { :value=> true },
:sis_assignment_name_length => { :value => true },
:sis_assignment_name_length_input => { :value => name_length_limit.to_s }
}
end
@ -147,7 +146,7 @@ describe "assignments sync to sis" do
context 'due date required' do
let(:error) { "Please add a due date" }
let(:settings_enable) { {:sis_require_assignment_due_date => {:value=> true} } }
let(:settings_enable) { { :sis_require_assignment_due_date => { :value => true } } }
it 'validates due date while sis is on' do
submit_blocked_with_errors
@ -178,7 +177,7 @@ describe "assignments sync to sis" do
it 'checks each due date when on' do
submit_blocked_with_errors
due_date_input_fields.each{ |h| set_value(h, due_date_valid) }
due_date_input_fields.each { |h| set_value(h, due_date_valid) }
f('#edit_assignment_form .btn-primary[type=submit]').click
check_due_date_table(section_to_set, short_date)
end
@ -193,7 +192,7 @@ describe "assignments sync to sis" do
end
context 'when on index page' do
let(:assignment_name) { "Test Assignment"}
let(:assignment_name) { "Test Assignment" }
let(:settings_enable) { { :sis_require_assignment_due_date => { value: true } } }
let(:expected_date) { format_date_for_view(Time.zone.now - 1.month) }
let(:assignment_id) { @assignment.id }
@ -203,8 +202,8 @@ describe "assignments sync to sis" do
let(:sis_state_text) { f('.icon-post-to-sis', post_to_sis_button).attribute(:alt) }
let(:due_date_display) { true }
let(:sis_state) { due_date_display ? "disabled" : "enabled" }
let(:set_date) { due_date_display ? nil : 1.day.ago}
let(:params) { { name: assignment_name} }
let(:set_date) { due_date_display ? nil : 1.day.ago }
let(:params) { { name: assignment_name } }
let(:type) { @course.assignments }
before(:each) do

View File

@ -61,16 +61,16 @@ describe "assignments turn it in" do
def expected_settings
{
'originality_report_visibility' => 'after_due_date',
's_paper_check' => '0',
'internet_check' => '0',
'journal_check' => '0',
'exclude_biblio' => '0',
'exclude_quoted' => '0',
'exclude_type' => '1',
'exclude_value' => '5',
'submit_papers_to' => '0',
's_view_report' => '1'
'originality_report_visibility' => 'after_due_date',
's_paper_check' => '0',
'internet_check' => '0',
'journal_check' => '0',
'exclude_biblio' => '0',
'exclude_quoted' => '0',
'exclude_type' => '1',
'exclude_value' => '5',
'submit_papers_to' => '0',
's_view_report' => '1'
}
end
@ -89,9 +89,9 @@ describe "assignments turn it in" do
it "should edit turnitin settings" do
skip_if_chrome('issue with change_turnitin_settings method')
assignment = @course.assignments.create!(
:name => 'test assignment',
:due_at => (Time.now.utc + 2.days),
:assignment_group => @course.assignment_groups.create!(:name => "default")
:name => 'test assignment',
:due_at => (Time.now.utc + 2.days),
:assignment_group => @course.assignment_groups.create!(:name => "default")
)
get "/courses/#{@course.id}/assignments/#{assignment.id}/edit"

View File

@ -141,4 +141,4 @@ class AssignmentCreateEditPage
click_option(submission_type, type, select_by)
end
end
end
end

View File

@ -150,23 +150,23 @@ module AssignmentsIndexPage
def visit_assignments_index_page(course_id)
get "/courses/#{course_id}/assignments"
wait_for(method: nil, timeout: 1) { assignment_group_loading_spinner.displayed? == false}
wait_for(method: nil, timeout: 1) { assignment_group_loading_spinner.displayed? == false }
end
def goto_bulk_edit_view
course_assignments_settings_button.click
bulk_edit_dates_menu.click
wait_for(method: nil, timeout: 5) { bulk_edit_loading_spinner.displayed? == false}
wait_for(method: nil, timeout: 5) { bulk_edit_loading_spinner.displayed? == false }
end
def save_bulk_edited_dates
bulk_edit_save_button.click
run_jobs
wait_for(method: nil, timeout: 5) { saving_dates_button.displayed? == false}
wait_for(method: nil, timeout: 5) { saving_dates_button.displayed? == false }
end
def open_batch_edit_dialog
batch_edit_button.click
wait_for(method: nil, timeout: 3) { batch_edit_dialog.displayed? == true}
wait_for(method: nil, timeout: 3) { batch_edit_dialog.displayed? == true }
end
end

View File

@ -47,7 +47,6 @@ class SubmissionDetails
fj('button:contains("Save")')
end
# page actions
def submit_comment(text)

View File

@ -21,7 +21,6 @@ require_relative './page_objects/student_assignment_page_v2'
require_relative '../common'
require_relative '../helpers/assignments_common'
describe 'assignments' do
include_context "in-process server selenium tests"
include AssignmentsCommon
@ -62,7 +61,7 @@ describe 'assignments' do
@assignment = @course.assignments.create!(
name: 'locked_assignment',
due_at: 5.days.from_now,
unlock_at:3.days.from_now,
unlock_at: 3.days.from_now,
lock_at: 10.days.from_now,
points_possible: 10,
submission_types: 'online_text_entry'
@ -101,8 +100,8 @@ describe 'assignments' do
)
tag = module1.add_item(type: 'assignment', id: assignment1.id)
module2.add_item(type: 'assignment', id: @assignment2.id)
module1.update!(completion_requirements: [{id: tag.id, type: 'must_submit'}])
module2.update!(prerequisites: [{id: module1.id, name: module1.name, type: 'context_module'}])
module1.update!(completion_requirements: [{ id: tag.id, type: 'must_submit' }])
module2.update!(prerequisites: [{ id: module1.id, name: module1.name, type: 'context_module' }])
end
before(:each) do

View File

@ -47,7 +47,7 @@ describe 'as a student' do
description: "Some criterion",
points: 5,
id: 'crit1',
ratings: [{description: "Good", points: 5, id: 'rat1', criterion_id: 'crit1'}]
ratings: [{ description: "Good", points: 5, id: 'rat1', criterion_id: 'crit1' }]
}],
description: 'new rubric description'
)
@ -337,8 +337,8 @@ describe 'as a student' do
submission_types: 'on_paper'
)
@module = @course.context_modules.create!(name: 'Module 1')
@tag = @module.add_item({id: @assignment.id, type: 'assignment'})
@module.completion_requirements = {@tag.id => {type: 'must_mark_done'}}
@tag = @module.add_item({ id: @assignment.id, type: 'assignment' })
@module.completion_requirements = { @tag.id => { type: 'must_mark_done' } }
@module.save!
end

View File

@ -19,7 +19,6 @@
require_relative '../../common'
module LogoutPage
#------------------------- Selectors --------------------------
def logout_confirm_btn_selector

View File

@ -31,7 +31,6 @@ describe "calendar2" do
before(:each) do
# or some stuff we need to click is "below the fold"
Account.default.tap do |a|
a.settings[:show_scheduler] = true
a.save!
@ -155,7 +154,7 @@ describe "calendar2" do
it "should allow deleting assignments", priority: "1", test_id: 138858 do
title = "Maniac Mansion"
@assignment = @course.assignments.create!(name: title,due_at: 3.days.from_now)
@assignment = @course.assignments.create!(name: title, due_at: 3.days.from_now)
load_agenda_view
expect(agenda_item_title).to include_text(title)
@ -359,7 +358,7 @@ describe "calendar2" do
it "student can not delete events created by a teacher", priority: "1", test_id: 138856 do
# create an event as the teacher
@course.calendar_events.create!(title: "Monkey Island", start_at: Time.zone.now.advance(days:4))
@course.calendar_events.create!(title: "Monkey Island", start_at: Time.zone.now.advance(days: 4))
# browse to the view as a student
load_agenda_view

View File

@ -32,7 +32,7 @@ describe "calendar2" do
before(:each) do
Account.default.tap do |a|
a.settings[:show_scheduler] = true
a.settings[:show_scheduler] = true
a.save!
end
end
@ -71,7 +71,7 @@ describe "calendar2" do
expect(title).to be_displayed
replace_content(title, event_title)
expect_new_page_load { f('.more_options_link').click }
expect(driver.current_url).to match /start_date=\d\d\d\d-\d\d-\d\d/ # passed in ISO format, not localized
expect(driver.current_url).to match /start_date=\d\d\d\d-\d\d-\d\d/ # passed in ISO format, not localized
expect(f('.title')).to have_value event_title
expect(f('#editCalendarEventFull .btn-primary').text).to eq "Create Event"
replace_content(f('#calendar_event_location_name'), location_name)
@ -189,15 +189,15 @@ describe "calendar2" do
replace_content(f("input[type=number][name='duplicate_count']"), 1)
form = f('#editCalendarEventFull')
expect_new_page_load{form.submit}
expect_new_page_load { form.submit }
expect(CalendarEvent.count).to eq(6) # 2 parent events each with 2 child events
s1_events = CalendarEvent.where(:context_code => section1.asset_string).
where.not(:parent_calendar_event_id => nil).order(:start_at).to_a
s1_events = CalendarEvent.where(:context_code => section1.asset_string)
.where.not(:parent_calendar_event_id => nil).order(:start_at).to_a
expect(s1_events[1].start_at.to_date).to eq (s1_events[0].start_at.to_date + 1.week)
s2_events = CalendarEvent.where(:context_code => section2.asset_string).
where.not(:parent_calendar_event_id => nil).order(:start_at).to_a
s2_events = CalendarEvent.where(:context_code => section2.asset_string)
.where.not(:parent_calendar_event_id => nil).order(:start_at).to_a
expect(s2_events[1].start_at.to_date).to eq (s2_events[0].start_at.to_date + 1.week)
end
@ -259,8 +259,8 @@ describe "calendar2" do
get "/calendar2"
f('.fc-content .fc-title').click
event_content = fj('.event-details-content:visible')
expect(event_content.find_element(:css, '.event-details-timestring').text).
to eq format_time_for_view(@todo_date, :short)
expect(event_content.find_element(:css, '.event-details-timestring').text)
.to eq format_time_for_view(@todo_date, :short)
expect(event_content).to contain_link('Student 1')
end
end
@ -281,8 +281,8 @@ describe "calendar2" do
get "/calendar2"
f('.fc-content .fc-title').click
event_content = fj('.event-details-content:visible')
expect(event_content.find_element(:css, '.event-details-timestring').text).
to eq format_time_for_view(@todo_date, :short)
expect(event_content.find_element(:css, '.event-details-timestring').text)
.to eq format_time_for_view(@todo_date, :short)
expect(event_content).to contain_link('Course 1')
end
end
@ -294,7 +294,6 @@ describe "calendar2" do
end
it "respects the calendars checkboxes" do
get "/calendar2"
expect(ff('.fc-view-container .fc-content .fc-title').length).to equal(1)
@ -305,7 +304,6 @@ describe "calendar2" do
f("span.group_user_#{@student1.id}").click
expect(ff('.fc-view-container .fc-content .fc-title').length).to equal(1)
# click to edit
f(".fc-event-container a.group_user_#{@student1.id}").click
# detial popup is displayed
@ -335,17 +333,17 @@ describe "calendar2" do
replace_content(f('input[name=title]'), 'new to-do edited')
datetime = @todo_date
datetime = if datetime.to_date().mday() == '15'
datetime.change({day: 20})
datetime.change({ day: 20 })
else
datetime.change({day: 15})
datetime.change({ day: 15 })
end
replace_content(f('input[name=date]'), format_date_for_view(datetime, :short))
f('.validated-form-view').submit
refresh_page
f('.fc-content .fc-title').click
event_content = fj('.event-details-content:visible')
expect(event_content.find_element(:css, '.event-details-timestring').text).
to eq format_time_for_view(datetime, :short)
expect(event_content.find_element(:css, '.event-details-timestring').text)
.to eq format_time_for_view(datetime, :short)
@to_do.reload
expect(format_time_for_view(@to_do.todo_date, :short)).to eq(format_time_for_view(datetime, :short))
end

View File

@ -31,7 +31,6 @@ describe "calendar2" do
before(:each) do
# or some stuff we need to click is "below the fold"
Account.default.tap do |a|
a.settings[:show_scheduler] = true
a.save!
@ -46,9 +45,9 @@ describe "calendar2" do
it "should let me go to the Edit Appointment group page from the appointment group slot dialog" do
date = Date.today.to_s
create_appointment_group :new_appointments => [
["#{date} 12:00:00", "#{date} 13:00:00"],
["#{date} 13:00:00", "#{date} 14:00:00"],
]
["#{date} 12:00:00", "#{date} 13:00:00"],
["#{date} 13:00:00", "#{date} 14:00:00"],
]
get '/calendar2'
@ -62,9 +61,9 @@ describe "calendar2" do
it "should let me message students who have signed up for an appointment" do
date = Date.today.to_s
create_appointment_group :new_appointments => [
["#{date} 12:00:00", "#{date} 13:00:00"],
["#{date} 13:00:00", "#{date} 14:00:00"],
]
["#{date} 12:00:00", "#{date} 13:00:00"],
["#{date} 13:00:00", "#{date} 14:00:00"],
]
student1, student2 = 2.times.map do
student_in_course :course => @course, :active_all => true
@student
@ -216,8 +215,8 @@ describe "calendar2" do
local_now = @user.time_zone.now
event_start = @user.time_zone.local(local_now.year, local_now.month, 15, 22, 0, 0)
@course.assignments.create!(
title: 'test assignment',
due_at: event_start,
title: 'test assignment',
due_at: event_start,
)
get "/calendar2"
f('.fc-event').click
@ -296,7 +295,7 @@ describe "calendar2" do
create_graded_discussion
# Even though graded discussion overwrites its assignment's title, less fragile to grab discussion's title
assert_views(@gd.title,@assignment.due_at)
assert_views(@gd.title, @assignment.due_at)
end
it "event appears on all calendars", priority: "1", test_id: 138846 do
@ -306,7 +305,7 @@ describe "calendar2" do
due_time = 5.minutes.from_now
@course.calendar_events.create!(title: title, start_at: due_time)
assert_views(title,due_time)
assert_views(title, due_time)
end
it "assignment appears on all calendars", priority: "1", test_id: 238862 do
@ -316,7 +315,7 @@ describe "calendar2" do
due_time = 5.minutes.from_now
@assignment = @course.assignments.create!(name: title, due_at: due_time)
assert_views(title,due_time)
assert_views(title, due_time)
end
it "quiz appears on all calendars", priority: "1", test_id: 238863 do
@ -324,7 +323,7 @@ describe "calendar2" do
create_quiz
assert_views(@quiz.title,@quiz.due_at)
assert_views(@quiz.title, @quiz.due_at)
end
end

View File

@ -48,7 +48,6 @@ describe "calendar2" do
end
describe "main month calendar" do
it "should remember the selected calendar view" do
get "/calendar2"
expect(find("#month")).to have_class('active')
@ -82,7 +81,6 @@ describe "calendar2" do
end
context "drag and drop" do
def element_location
driver.execute_script("return $('#calendar-app .fc-content-skeleton:first')
.find('tbody td.fc-event-container').index()")
@ -281,11 +279,11 @@ describe "calendar2" do
end
it "should not have a delete link for a frozen assignment" do
allow(PluginSetting).to receive(:settings_for_plugin).and_return({"assignment_group_id" => "true"})
allow(PluginSetting).to receive(:settings_for_plugin).and_return({ "assignment_group_id" => "true" })
frozen_assignment = @course.assignments.build(
name: "frozen assignment",
due_at: Time.zone.now,
freeze_on_copy: true,
name: "frozen assignment",
due_at: Time.zone.now,
freeze_on_copy: true,
)
frozen_assignment.copied = true
frozen_assignment.save!
@ -361,8 +359,8 @@ describe "calendar2" do
date = Date.today
e1 = @course.calendar_events.build :title => "ohai",
:child_event_data => [
{:start_at => "#{date} 12:00:00", :end_at => "#{date} 13:00:00", :context_code => @course.default_section.asset_string},
{:start_at => "#{date} 13:00:00", :end_at => "#{date} 14:00:00", :context_code => s2.asset_string},
{ :start_at => "#{date} 12:00:00", :end_at => "#{date} 13:00:00", :context_code => @course.default_section.asset_string },
{ :start_at => "#{date} 13:00:00", :end_at => "#{date} 14:00:00", :context_code => s2.asset_string },
]
e1.updating_user = @user
e1.save!
@ -404,10 +402,10 @@ describe "calendar2" do
make_event(:location_name => location_name, :location_address => location_address)
load_month_view
#Click calendar item to bring up event summary
# Click calendar item to bring up event summary
find(".fc-event").click
#expect to find the location name and address
# expect to find the location name and address
expect(find('.event-details-content')).to include_text(location_name)
expect(find('.event-details-content')).to include_text(location_address)
end
@ -415,7 +413,7 @@ describe "calendar2" do
it "should bring up a calendar date picker when clicking on the month" do
load_month_view
#Click on the month header
# Click on the month header
find('.navigation_title').click
# Expect that a the event picker is present
@ -477,7 +475,6 @@ describe "calendar2" do
end
context "as a student" do
before(:each) do
course_with_student_logged_in
end
@ -490,7 +487,6 @@ describe "calendar2" do
end
describe "main month calendar" do
it "should strikethrough completed assignment title", priority: "1", test_id: 518372 do
date_due = Time.zone.now.utc + 2.days
@assignment = @course.assignments.create!(

View File

@ -36,7 +36,6 @@ describe "scheduler" do
before :each do
user_session(@student1)
end
it 'shows the find appointment button with feature flag turned on', priority: "1", test_id: 2908326 do
@ -110,7 +109,7 @@ describe "scheduler" do
expect(f('.fc-time')).to include_text expected_time
end
it 'unreserves appointment slot', priority:"1", test_id: 2936791 do
it 'unreserves appointment slot', priority: "1", test_id: 2936791 do
reserve_appointment_for(@student1, @student1, @app1)
expect(@app1.appointments.first.workflow_state).to eq('locked')
get "/calendar2"

View File

@ -26,7 +26,6 @@ describe "scheduler" do
include Calendar2Common
context "as a teacher" do
before(:once) do
Account.default.settings[:show_scheduler] = true
Account.default.save!
@ -80,7 +79,7 @@ describe "scheduler" do
fj('.ui-datepicker-trigger:visible').click
datepicker_current
set_value(fj('.time_field.start_time:visible'), start_time_text)
set_value(fj('.time_field.end_time:visible'),end_time_text)
set_value(fj('.time_field.end_time:visible'), end_time_text)
set_value(fj('.date_field:visible'), date)
find('.scheduler-event-details-footer .btn-primary').click
wait_for_ajax_requests

View File

@ -27,7 +27,6 @@ describe "scheduler" do
include SchedulerCommon
context "as a student" do
before(:once) do
Account.default.tap do |a|
a.settings[:show_scheduler] = true
@ -39,7 +38,6 @@ describe "scheduler" do
before(:each) do
user_session(@student)
end
def reserve_appointment_manual(n, comment = nil)
@ -103,7 +101,7 @@ describe "scheduler" do
# causing fragile tests in Chrome
participant_visibility: 'protected',
new_appointments: [
[ earliest_appointment_time, 1.hour.from_now ]
[earliest_appointment_time, 1.hour.from_now]
]
)
AppointmentGroup.last.appointments.first.reserve_for(@student, @teacher)
@ -152,7 +150,7 @@ describe "scheduler" do
max_appointments_per_participant: 1,
new_appointments: [
# this can fail if run in the first 2 seconds of the month.
[ 2.seconds.ago, 1.second.ago ]
[2.seconds.ago, 1.second.ago]
]
)
AppointmentGroup.last.appointments.first.reserve_for(@student, @teacher)

View File

@ -25,7 +25,6 @@ describe "scheduler" do
include Calendar2Common
context "as a teacher" do
before(:once) do
Account.default.tap do |a|
a.settings[:show_scheduler] = true
@ -37,14 +36,13 @@ describe "scheduler" do
before(:each) do
user_session(@teacher)
end
it "should validate the appointment group shows on all views after a student signed up", priority: "1", test_id: 1729408 do
date = Time.zone.today.to_s
create_appointment_group(:new_appointments => [
[date + ' 12:00:00', date + ' 13:00:00'],
])
[date + ' 12:00:00', date + ' 13:00:00'],
])
ag = AppointmentGroup.first
student_in_course(course: @course, active_all: true)
ag.appointments.first.reserve_for(@user, @user, comments: 'this is important')

View File

@ -30,7 +30,7 @@ describe "calendar2" do
before(:each) do
Account.default.tap do |a|
a.settings[:show_scheduler] = true
a.settings[:show_scheduler] = true
a.save!
end
end
@ -80,14 +80,14 @@ describe "calendar2" do
get "/calendar2"
wait_for_ajax_requests
#Because it is in a past month, it should not be on the mini calendar
# Because it is in a past month, it should not be on the mini calendar
expect(f("#content")).not_to contain_css(".event")
#Go back a month
# Go back a month
f(".fc-prev-button").click
wait_for_ajaximations
#look for the event on the mini calendar
# look for the event on the mini calendar
expect(f(".event")['data-date']).to eq(date.strftime("%Y-%m-%d"))
end
@ -139,14 +139,14 @@ describe "calendar2" do
make_event :context => @course, :start => Time.now, :title => title
load_month_view
#expect event to be on the calendar
# expect event to be on the calendar
expect(f('.fc-title').text).to include title
# Click the toggle button. First button should be user, second should be course
ff(".context-list-toggle-box")[1].click
expect(f("#content")).not_to contain_css('.fc-title')
#Turn back on the calendar and verify that your item appears
# Turn back on the calendar and verify that your item appears
ff(".context-list-toggle-box")[1].click
expect(f('.fc-title').text).to include title
end

View File

@ -26,7 +26,7 @@ describe "calendar2" do
before(:each) do
Account.default.tap do |a|
a.settings[:show_scheduler] = true
a.settings[:show_scheduler] = true
a.save!
end
end
@ -134,8 +134,8 @@ describe "calendar2" do
date = Date.today
e1 = @course.calendar_events.build :title => "ohai",
:child_event_data => [
{:start_at => "#{date} 12:00:00", :end_at => "#{date} 13:00:00", :context_code => s2.asset_string},
{:start_at => "#{date} 13:00:00", :end_at => "#{date} 14:00:00", :context_code => @course.default_section.asset_string},
{ :start_at => "#{date} 12:00:00", :end_at => "#{date} 13:00:00", :context_code => s2.asset_string },
{ :start_at => "#{date} 13:00:00", :end_at => "#{date} 14:00:00", :context_code => @course.default_section.asset_string },
]
e1.updating_user = @teacher
e1.save!

View File

@ -1,6 +1,7 @@
# frozen_string_literal: true
# coding: utf-8
#
# Copyright (C) 2014 - present Instructure, Inc.
#
@ -42,7 +43,6 @@ describe "calendar2" do
end
context "week view" do
it "should navigate to week view when week button is clicked", :xbrowser, priority: "2", test_id: 766945 do
load_week_view
expect(fj('.fc-agendaWeek-view:visible')).to be_present
@ -172,7 +172,7 @@ describe "calendar2" do
# Click non all-day event
fj('.fc-agendaWeek-view .fc-time-grid .fc-slats .fc-widget-content:not(.fc-axis):first').click
event_from_modal(title,false,false)
event_from_modal(title, false, false)
expect(f('.fc-title')).to include_text title
end
@ -182,7 +182,7 @@ describe "calendar2" do
# click all day event
f('.fc-agendaWeek-view .fc-week .fc-wed').click
event_from_modal(title,false,false)
event_from_modal(title, false, false)
expect(f('.fc-title')).to include_text title
end
@ -280,7 +280,6 @@ describe "calendar2" do
end
context "drag and drop" do
before(:each) do
@saturday = 8
@initial_time = Time.zone.parse('2015-1-1').beginning_of_day + 9.hours

View File

@ -28,15 +28,14 @@ describe "calendar2" do
course_with_teacher(active_all: true, new_user: true)
@student1 = User.create!(name: 'Student 1')
@course.enroll_student(@student1).accept!
@student1.update!(preferences: {:selected_calendar_contexts => ["user_#{@student1.id}", "course_#{@course.id}"]})
@teacher.update!(preferences: {:selected_calendar_contexts => ["user_#{@teacher.id}", "course_#{@course.id}"]})
@student1.update!(preferences: { :selected_calendar_contexts => ["user_#{@student1.id}", "course_#{@course.id}"] })
@teacher.update!(preferences: { :selected_calendar_contexts => ["user_#{@teacher.id}", "course_#{@course.id}"] })
end
context "as the student" do
before :each do
# or some stuff we need to click is "below the fold"
user_session(@student1)
end
@ -142,8 +141,8 @@ describe "calendar2" do
it "creates a calendar event for non graded discussions with to do date" do
discussion = @course.discussion_topics.create!(user: @teacher, title: "topic 1",
message: "somebody topic message",
todo_date: 30.seconds.from_now)
message: "somebody topic message",
todo_date: 30.seconds.from_now)
get '/calendar2'
wait_for_ajax_requests
f('.fc-content').click
@ -158,7 +157,6 @@ describe "calendar2" do
before :each do
# or some stuff we need to click is "below the fold"
user_session(@teacher)
end
@ -191,8 +189,8 @@ describe "calendar2" do
it "edits a todo discussion" do
discussion = @course.discussion_topics.create!(user: @teacher, title: "topic 1",
message: "somebody topic message",
todo_date: Date.today)
message: "somebody topic message",
todo_date: Date.today)
get '/calendar2'
wait_for_ajax_requests
f('.fc-content').click
@ -208,8 +206,8 @@ describe "calendar2" do
it "deletes a todo discussion" do
discussion = @course.discussion_topics.create!(user: @teacher, title: "topic 1",
message: "somebody topic message",
todo_date: Date.today)
message: "somebody topic message",
todo_date: Date.today)
get '/calendar2'
wait_for_ajax_requests
f('.fc-content').click
@ -229,7 +227,7 @@ describe "calendar2" do
before :each do
# or some stuff we need to click is "below the fold"
@user.update!(preferences: {:selected_calendar_contexts => ["user_#{@user.id}", "course_#{@course1.id}", "course_#{@course2.id}"]})
@user.update!(preferences: { :selected_calendar_contexts => ["user_#{@user.id}", "course_#{@course1.id}", "course_#{@course2.id}"] })
user_session(@user)
end

View File

@ -33,9 +33,7 @@ describe 'Stuff related to how we load stuff from CDN and use brandable_css' do
include_context "in-process server selenium tests"
describe BrandableCSS do
describe 'cache_for' do
it 'finds the right fingerprints for normal bundles, plugins & handlebars' do
sample_bundles = {
'bundles/common' => false,
@ -57,7 +55,7 @@ describe 'Stuff related to how we load stuff from CDN and use brandable_css' do
next unless includes_no_variables
msg = "all variants should output the same css if a bundle doesn't pull in the variables file"
unique_fingerprints = fingerprints.map{ |f| f[:combinedChecksum] }.uniq
unique_fingerprints = fingerprints.map { |f| f[:combinedChecksum] }.uniq
expect(unique_fingerprints.length).to eq(1), msg
end
end
@ -77,7 +75,7 @@ describe 'Stuff related to how we load stuff from CDN and use brandable_css' do
assert_tag('link', 'href', url)
end
def check_asset(tag, asset_path, skip_rev=false)
def check_asset(tag, asset_path, skip_rev = false)
unless skip_rev
asset_path = Canvas::Cdn::RevManifest.url_for(asset_path)
expect(asset_path).to be_present

View File

@ -24,9 +24,9 @@ describe "canvas_quizzes" do
before do
quiz_with_graded_submission([
{:question_data => {:name => 'question 1', :points_possible => 1, 'question_type' => 'true_false_question'}},
{:question_data => {:name => 'question 2', :points_possible => 1, 'question_type' => 'true_false_question'}}
])
{ :question_data => { :name => 'question 1', :points_possible => 1, 'question_type' => 'true_false_question' } },
{ :question_data => { :name => 'question 2', :points_possible => 1, 'question_type' => 'true_false_question' } }
])
course_with_teacher_logged_in(:active_all => true, :course => @course)
end
@ -50,5 +50,4 @@ describe "canvas_quizzes" do
expect(f("#ic-EventStream")).to include_text('Action Log')
end
end
end

View File

@ -77,7 +77,6 @@ describe "collaborations" do
end
end
context "a students's etherpad collaboration" do
before(:each) do
course_with_teacher(:active_all => true, :name => 'teacher@example.com')

View File

@ -80,7 +80,7 @@ describe "collaborations" do
end
it 'should select from all course groups', priority: "1", test_id: 162352 do
select_from_all_course_groups(type,title)
select_from_all_course_groups(type, title)
end
it 'should deselect collaborators', priority: "1", test_id: 139054 do

View File

@ -84,7 +84,7 @@ describe "collaborations" do
@collaboration = Collaboration.typed_collaboration_instance('EtherPad')
@collaboration.context = @course
@collaboration.attributes = { :title => 'My collaboration',
:user => @teacher }
:user => @teacher }
@collaboration.update_members([@student])
@collaboration.save!
@ -95,4 +95,3 @@ describe "collaborations" do
end
end
end

View File

@ -30,7 +30,7 @@ require_relative 'test_setup/selenium_extensions'
if ENV["TESTRAIL_RUN_ID"]
require 'testrailtagging'
RSpec.configure do |config|
TestRailRSpecIntegration.register_rspec_integration(config,:canvas, add_formatter: false)
TestRailRSpecIntegration.register_rspec_integration(config, :canvas, add_formatter: false)
end
elsif ENV["TESTRAIL_ENTRY_RUN_ID"]
require "testrailtagging"
@ -39,7 +39,7 @@ elsif ENV["TESTRAIL_ENTRY_RUN_ID"]
end
end
Dir[File.dirname(__FILE__) + '/test_setup/common_helper_methods/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/test_setup/common_helper_methods/*.rb'].each { |file| require file }
RSpec.configure do |config|
config.before :suite do
@ -198,8 +198,8 @@ shared_context "in-process server selenium tests" do
# log INSTUI deprecation warnings
if browser_logs.present?
spec_file = example.file_path.sub(/.*spec\/selenium\//, '')
deprecations = browser_logs.select {|l| l.message =~ /\[.*deprecated./}.map do |l|
">>> #{spec_file}: \"#{example.description}\": #{driver.current_url}: #{l.message.gsub(/.*Warning/, 'Warning') }"
deprecations = browser_logs.select { |l| l.message =~ /\[.*deprecated./ }.map do |l|
">>> #{spec_file}: \"#{example.description}\": #{driver.current_url}: #{l.message.gsub(/.*Warning/, 'Warning')}"
end
puts "\n", deprecations.uniq
end
@ -252,7 +252,7 @@ shared_context "in-process server selenium tests" do
javascript_errors = browser_logs.select do |e|
e.level == "SEVERE" &&
e.message.present? &&
browser_errors_we_dont_care_about.none? {|s| e.message.include?(s)}
browser_errors_we_dont_care_about.none? { |s| e.message.include?(s) }
end
if javascript_errors.present?

View File

@ -84,7 +84,7 @@ describe "communication channel selenium tests" do
end
it 'confirms the communication channels', priority: "2", test_id: 193786 do
user_with_pseudonym({active_user: true})
user_with_pseudonym({ active_user: true })
create_session(@pseudonym)
get '/profile/settings'
@ -104,9 +104,9 @@ describe "communication channel selenium tests" do
end
it 'resends sms confirmations properly' do
user_with_pseudonym({active_user: true})
user_with_pseudonym({ active_user: true })
create_session(@pseudonym)
sms_cc = communication_channel(@user, {username: '8011235555@example.com', path_type: 'sms'})
sms_cc = communication_channel(@user, { username: '8011235555@example.com', path_type: 'sms' })
get '/profile/settings'
expect(f('.other_channels')).to contain_css('.unconfirmed')
@ -123,7 +123,7 @@ describe "communication channel selenium tests" do
it 'should show the bounce count reset button when a siteadmin is masquerading' do
u = user_with_pseudonym(active_all: true)
communication_channel(u, {username: 'test@example.com', active_cc: true, bounce_count: 3})
communication_channel(u, { username: 'test@example.com', active_cc: true, bounce_count: 3 })
site_admin_logged_in
masquerade_as(u)
@ -134,7 +134,7 @@ describe "communication channel selenium tests" do
it 'should not show the bounce count reset button when an account admin is masquerading' do
u = user_with_pseudonym(active_all: true)
communication_channel(u, {username: 'test@example.com', active_cc: true, bounce_count: 3})
communication_channel(u, { username: 'test@example.com', active_cc: true, bounce_count: 3 })
admin_logged_in
masquerade_as(u)
@ -145,7 +145,7 @@ describe "communication channel selenium tests" do
it 'should not show the bounce count reset button when the channel is not bouncing' do
u = user_with_pseudonym(active_all: true)
communication_channel(u, {username: 'test@example.com', active_cc: true})
communication_channel(u, { username: 'test@example.com', active_cc: true })
site_admin_logged_in
masquerade_as(u)

View File

@ -180,7 +180,7 @@ describe 'native canvas conditional release' do
ConditionalReleaseObjects.assignment_options_button(assignment_for_mp.title).click
ConditionalReleaseObjects.menu_option('Move to 70 pts - 100 pts').click
expect(ConditionalReleaseObjects.assignment_exists_in_scoring_range?(1,assignment_for_mp.title)).to be(true)
expect(ConditionalReleaseObjects.assignment_exists_in_scoring_range?(1, assignment_for_mp.title)).to be(true)
end
it 'should be able see errors for invalid scoring ranges' do
@ -235,7 +235,7 @@ describe 'native canvas conditional release' do
upper_bound: 0.4
),
]
@rule = @course.conditional_release_rules.create!(:trigger_assignment => @trigger_assmt, :scoring_ranges => ranges)
@rule = @course.conditional_release_rules.create!(:trigger_assignment => @trigger_assmt, :scoring_ranges => ranges)
end
it 'should show Mastery Path Breakdown for an Assignment' do
@ -253,4 +253,3 @@ describe 'native canvas conditional release' do
end
end
end

View File

@ -53,12 +53,11 @@ describe 'BigBlueButton conferences' do
after { close_extra_windows }
context 'when a conference is open' do
context 'and the conference has no recordings' do
before(:once) do
stub_request(:get, /getRecordings/).
with(query: bbb_fixtures[:get_recordings]).
to_return(:body => big_blue_button_mock_response('get_recordings', 'none'))
stub_request(:get, /getRecordings/)
.with(query: bbb_fixtures[:get_recordings])
.to_return(:body => big_blue_button_mock_response('get_recordings', 'none'))
@conference = create_big_blue_button_conference(bbb_fixtures[:get_recordings]['meetingID'])
end
@ -69,9 +68,9 @@ describe 'BigBlueButton conferences' do
context 'and the conference has recordings' do
before(:once) do
stub_request(:get, /getRecordings/).
with(query: bbb_fixtures[:get_recordings]).
to_return(:body => big_blue_button_mock_response('get_recordings', 'two'))
stub_request(:get, /getRecordings/)
.with(query: bbb_fixtures[:get_recordings])
.to_return(:body => big_blue_button_mock_response('get_recordings', 'two'))
@conference = create_big_blue_button_conference(bbb_fixtures[:get_recordings]['meetingID'])
end
@ -82,12 +81,12 @@ describe 'BigBlueButton conferences' do
context 'and the conference has one recording and it is deleted' do
before(:once) do
stub_request(:get, /deleteRecordings/).
with(query: bbb_fixtures[:delete_recordings]).
to_return(:body => big_blue_button_mock_response('delete_recordings'))
stub_request(:get, /getRecordings/).
with(query: bbb_fixtures[:get_recordings]).
to_return(:body => big_blue_button_mock_response('get_recordings', 'one'))
stub_request(:get, /deleteRecordings/)
.with(query: bbb_fixtures[:delete_recordings])
.to_return(:body => big_blue_button_mock_response('delete_recordings'))
stub_request(:get, /getRecordings/)
.with(query: bbb_fixtures[:get_recordings])
.to_return(:body => big_blue_button_mock_response('get_recordings', 'one'))
@conference = create_big_blue_button_conference(bbb_fixtures[:get_recordings]['meetingID'])
end
@ -100,9 +99,9 @@ describe 'BigBlueButton conferences' do
context 'and the conference has one recording with statistics' do
before(:once) do
stub_request(:get, /getRecordings/).
with(query: bbb_fixtures[:get_recordings]).
to_return(:body => big_blue_button_mock_response('get_recordings', 'one'))
stub_request(:get, /getRecordings/)
.with(query: bbb_fixtures[:get_recordings])
.to_return(:body => big_blue_button_mock_response('get_recordings', 'one'))
@conference = create_big_blue_button_conference(bbb_fixtures[:get_recordings]['meetingID'])
end
end
@ -123,6 +122,5 @@ describe 'BigBlueButton conferences' do
verify_conference_does_not_include_recordings_with_statistics
end
end
end
end

View File

@ -25,7 +25,6 @@ describe "content exports" do
include_context "in-process server selenium tests"
context "as a teacher" do
before (:each) do
course_with_teacher_logged_in
end

View File

@ -26,12 +26,12 @@ def visit_page
get "/courses/#{@course.id}/content_migrations"
end
def select_migration_type(type=nil)
def select_migration_type(type = nil)
type ||= @type
click_option('#chooseMigrationConverter', type, :value)
end
def select_migration_file(opts={})
def select_migration_file(opts = {})
filename = opts[:filename] || @filename
new_filename, fullpath, data = get_file(filename, opts[:data])
@ -39,7 +39,7 @@ def select_migration_file(opts={})
return new_filename
end
def fill_migration_form(opts={})
def fill_migration_form(opts = {})
select_migration_type('none') unless opts[:type] == 'none'
select_migration_type(opts[:type])
select_migration_file(opts)
@ -56,7 +56,7 @@ def submit
end
end
def run_migration(cm=nil)
def run_migration(cm = nil)
cm ||= @course.content_migrations.last
cm.reload
cm.skip_job_progress = false
@ -65,14 +65,14 @@ def run_migration(cm=nil)
worker_class.new(cm.id).perform
end
def import(cm=nil)
def import(cm = nil)
cm ||= @course.content_migrations.last
cm.reload
cm.set_default_settings
cm.import_content
end
def test_selective_content(source_course=nil)
def test_selective_content(source_course = nil)
visit_page
# Open selective dialog
@ -86,7 +86,6 @@ def test_selective_content(source_course=nil)
f(".selectContentDialog input[type=submit]").click
wait_for_ajaximations
source_course ? run_migration : import
visit_page
@ -98,7 +97,7 @@ end
describe "content migrations", :non_parallel do
include_context "in-process server selenium tests"
def test_selective_outcome(source_course=nil)
def test_selective_outcome(source_course = nil)
visit_page
# Open selective dialog
@ -131,8 +130,8 @@ describe "content migrations", :non_parallel do
expect(@course.created_learning_outcomes.count).to eq 2
outcome_links = subgroup1.child_outcome_links
expect(outcome_links.map(&:learning_outcome_content).map(&:short_description)).to match_array([
'non-root2', 'non-root3'
])
'non-root2', 'non-root3'
])
end
context "canvas cartridge importing" do
@ -250,7 +249,7 @@ describe "content migrations", :non_parallel do
submit
opts = @course.content_migrations.last.migration_settings["date_shift_options"]
expect(opts["shift_dates"]).to eq '1'
expect(opts["day_substitutions"]).to eq({"1" => "2", "5" => "4"})
expect(opts["day_substitutions"]).to eq({ "1" => "2", "5" => "4" })
expect(Date.parse(opts["old_start_date"])).to eq Date.new(2014, 7, 1)
expect(Date.parse(opts["old_end_date"])).to eq Date.new(2014, 7, 11)
expect(Date.parse(opts["new_start_date"])).to eq Date.new(2014, 8, 5)
@ -274,7 +273,7 @@ describe "content migrations", :non_parallel do
context "course copy" do
before do
#the "true" param is important, it forces the cache clear
# the "true" param is important, it forces the cache clear
# without it this spec group fails if
# you run it with the whole suite
# because of a cached default account
@ -285,8 +284,8 @@ describe "content migrations", :non_parallel do
data = File.read(File.dirname(__FILE__) + '/../../fixtures/migration/cc_full_test_smaller.zip')
cm = ContentMigration.new(:context => @copy_from, :migration_type => "common_cartridge_importer")
cm.migration_settings = {:import_immediately => true,
:migration_ids_to_import => {:copy => {:everything => true}}}
cm.migration_settings = { :import_immediately => true,
:migration_ids_to_import => { :copy => { :everything => true } } }
cm.skip_job_progress = true
cm.save!
@ -424,8 +423,8 @@ describe "content migrations", :non_parallel do
data = File.read(File.dirname(__FILE__) + '/../../fixtures/migration/cc_full_test.zip')
cm = ContentMigration.new(:context => @copy_from, :migration_type => "common_cartridge_importer")
cm.migration_settings = {:import_immediately => true,
:migration_ids_to_import => {:copy => {:everything => true}}}
cm.migration_settings = { :import_immediately => true,
:migration_ids_to_import => { :copy => { :everything => true } } }
cm.skip_job_progress = true
cm.save!
@ -541,10 +540,10 @@ describe "content migrations", :non_parallel do
opts = @course.content_migrations.last.migration_settings["date_shift_options"]
expect(opts["shift_dates"]).to eq '1'
expect(opts["day_substitutions"]).to eq({"1" => "2", "2" => "3"})
expect(opts["day_substitutions"]).to eq({ "1" => "2", "2" => "3" })
expected = {
"old_start_date" => "Jul 1, 2012", "old_end_date" => "Jul 11, 2012",
"new_start_date" => "Aug 5, 2012", "new_end_date" => "Aug 15, 2012"
"old_start_date" => "Jul 1, 2012", "old_end_date" => "Jul 11, 2012",
"new_start_date" => "Aug 5, 2012", "new_end_date" => "Aug 15, 2012"
}
expected.each do |k, v|
expect(Date.parse(opts[k].to_s)).to eq Date.parse(v)
@ -573,8 +572,8 @@ describe "content migrations", :non_parallel do
expect(opts["shift_dates"]).to eq '1'
expect(opts["day_substitutions"]).to eq({})
expected = {
"old_start_date" => "Jul 1, 2012", "old_end_date" => "Jul 11, 2012",
"new_start_date" => "Aug 5, 2012", "new_end_date" => "Aug 15, 2012"
"old_start_date" => "Jul 1, 2012", "old_end_date" => "Jul 11, 2012",
"new_start_date" => "Aug 5, 2012", "new_end_date" => "Aug 15, 2012"
}
expected.each do |k, v|
expect(Date.parse(opts[k].to_s)).to eq Date.parse(v)
@ -645,34 +644,34 @@ describe "content migrations", :non_parallel do
}
let(:import_tool) do
tool = import_course.context_external_tools.new({
name: "test lti import tool",
consumer_key: "key",
shared_secret: "secret",
url: "http://www.example.com/ims/lti",
name: "test lti import tool",
consumer_key: "key",
shared_secret: "secret",
url: "http://www.example.com/ims/lti",
})
tool.migration_selection = {
url: "http://#{HostUrl.default_host}/selection_test",
text: "LTI migration text",
selection_width: 500,
selection_height: 500,
icon_url: "/images/add.png",
url: "http://#{HostUrl.default_host}/selection_test",
text: "LTI migration text",
selection_width: 500,
selection_height: 500,
icon_url: "/images/add.png",
}
tool.save!
tool
end
let(:other_tool) do
tool = import_course.context_external_tools.new({
name: "other lti tool",
consumer_key: "key",
shared_secret: "secret",
url: "http://www.example.com/ims/lti",
name: "other lti tool",
consumer_key: "key",
shared_secret: "secret",
url: "http://www.example.com/ims/lti",
})
tool.resource_selection = {
url: "http://#{HostUrl.default_host}/selection_test",
text: "other resource text",
selection_width: 500,
selection_height: 500,
icon_url: "/images/add.png",
url: "http://#{HostUrl.default_host}/selection_test",
text: "other resource text",
selection_width: 500,
selection_height: 500,
icon_url: "/images/add.png",
}
tool.save!
tool

View File

@ -23,19 +23,19 @@ describe "content security policy" do
include_context "in-process server selenium tests"
context "with csp enabled" do
before(:once) do
@csp_account = Account.create!(name: 'csp account')
@csp_account.enable_feature!(:javascript_csp)
@csp_account.enable_csp!
@csp_course = @csp_account.courses.create!(name: 'csp course')
@csp_user = User.create!(name: 'csp user')
@csp_user.accept_terms
@csp_user.register!
@csp_pseudonym = @csp_account.pseudonyms.create!(user: @csp_user, unique_id: 'csp@example.com')
@csp_course.enroll_user(@csp_user, 'TeacherEnrollment', enrollment_state: 'active')
end
before(:once) do
@csp_account = Account.create!(name: 'csp account')
@csp_account.enable_feature!(:javascript_csp)
@csp_account.enable_csp!
@csp_course = @csp_account.courses.create!(name: 'csp course')
@csp_user = User.create!(name: 'csp user')
@csp_user.accept_terms
@csp_user.register!
@csp_pseudonym = @csp_account.pseudonyms.create!(user: @csp_user, unique_id: 'csp@example.com')
@csp_course.enroll_user(@csp_user, 'TeacherEnrollment', enrollment_state: 'active')
end
before(:each) {create_session(@csp_pseudonym)}
before(:each) { create_session(@csp_pseudonym) }
it "should display a flash alert for non-whitelisted iframe", ignore_js_errors: true do
@csp_course.wiki_pages.create!(title: 'Page1', body: "<iframe width=\"560\" height=\"315\""\
@ -59,6 +59,5 @@ describe "content security policy" do
expect_no_instui_flash_message
end
end
end

View File

@ -30,8 +30,8 @@ describe "context modules" do
course_with_teacher_logged_in
@tool = Account.default.context_external_tools.new(:name => "a", :domain => "google.com", :consumer_key => '12345', :shared_secret => 'secret')
@tool.module_index_menu = {:url => "http://www.example.com", :text => "Import Stuff"}
@tool.module_group_menu = {:url => "http://www.example.com", :text => "Import Stuff Here"}
@tool.module_index_menu = { :url => "http://www.example.com", :text => "Import Stuff" }
@tool.module_group_menu = { :url => "http://www.example.com", :text => "Import Stuff Here" }
@tool.save!
@module1 = @course.context_modules.create!(:name => "module1")
@module2 = @course.context_modules.create!(:name => "module2")
@ -48,17 +48,17 @@ describe "context modules" do
wait_for_ajaximations
expect(tool_dialog_header).to include_text("Import Stuff")
expect(tool_dialog_iframe['src']).to include("/courses/#{@course.id}/external_tools/#{@tool.id}")
query_params = Rack::Utils.parse_nested_query(URI.parse(tool_dialog_iframe['src']).query)
expect(query_params["launch_type"]).to eq "module_index_menu"
expect(query_params["com_instructure_course_allow_canvas_resource_selection"]).to eq "true"
expect(query_params["com_instructure_course_canvas_resource_type"]).to eq "module"
expect(query_params["com_instructure_course_accept_canvas_resource_types"]).to match_array([
"assignment", "audio", "discussion_topic", "document", "image", "module", "quiz", "page", "video"
])
"assignment", "audio", "discussion_topic", "document", "image", "module", "quiz", "page", "video"
])
expect(query_params["com_instructure_course_available_canvas_resources"].values).to eq [{
"course_id" => @course.id.to_s, "type" => "module"
}] # will replace with the modules on the variable expansion
}] # will replace with the modules on the variable expansion
end
it "should be able to launch the individual module menu tool via the tray", custom_timeout: 60 do
@ -69,18 +69,18 @@ describe "context modules" do
module_index_menu_tool_link("Import Stuff Here").click
wait_for_ajaximations
expect(tool_dialog_header).to include_text("Import Stuff Here")
expect(tool_dialog_iframe['src']).to include("/courses/#{@course.id}/external_tools/#{@tool.id}")
query_params = Rack::Utils.parse_nested_query(URI.parse(tool_dialog_iframe['src']).query)
expect(query_params["launch_type"]).to eq "module_group_menu"
expect(query_params["com_instructure_course_allow_canvas_resource_selection"]).to eq "false"
expect(query_params["com_instructure_course_canvas_resource_type"]).to eq "module"
expect(query_params["com_instructure_course_accept_canvas_resource_types"]).to match_array([
"assignment", "audio", "discussion_topic", "document", "image", "module", "quiz", "page", "video"
])
module_data = [@module2].map{|m| {"id" => m.id.to_s, "name" => m.name}} # just @module2
"assignment", "audio", "discussion_topic", "document", "image", "module", "quiz", "page", "video"
])
module_data = [@module2].map { |m| { "id" => m.id.to_s, "name" => m.name } } # just @module2
expect(query_params["com_instructure_course_available_canvas_resources"].values).to match_array(module_data)
end
end
end
end

Some files were not shown because too many files have changed in this diff Show More