spec: selenium upgrade spec fixes

Change-Id: Ibded76b3091c44b38328409e2f8803c4d4493227
Reviewed-on: https://gerrit.instructure.com/17746
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
This commit is contained in:
Kyle Rosenbaum 2013-02-14 16:04:45 -07:00 committed by Bryan Madsen
parent 956dd69432
commit 8c5dbf5d7f
38 changed files with 479 additions and 251 deletions

View File

@ -4,7 +4,7 @@ describe "account" do
it_should_behave_like "in-process server selenium tests"
before (:each) do
course_with_admin_logged_in
course_with_admin_logged_in
end
describe "authentication configs" do
@ -311,9 +311,10 @@ describe "account" do
element = ff('.ui-autocomplete li a').first
element.text.should == @course_name
element.click
driver.current_url.should include("/courses/#{@course.id}")
keep_trying_until do
driver.execute_script("$('.ui-autocomplete li a').hover().click()")
driver.current_url.should include("/courses/#{@course.id}")
end
end
it "should search for an existing user" do

View File

@ -131,6 +131,7 @@ describe "account admin manage groups" do
it "should add multiple groups and be sure they are all deleted" do
add_groups_in_category @courses_group_category
get "/accounts/#{@admin_account.id}/groups"
make_full_screen
delete = driver.find_element(:css, ".delete_category_link")
delete.click
confirm_dialog = driver.switch_to.alert
@ -143,13 +144,16 @@ describe "account admin manage groups" do
it "should edit an individual group" do
get "/accounts/#{@admin_account.id}/groups"
group = add_group_to_category @courses_group_category, "group 1"
group.should_not be_nil
driver.find_element(:id, "group_#{group.id}").click
wait_for_ajaximations
driver.find_element(:css, "#group_#{group.id} .edit_group_link").click
wait_for_ajaximations
name = "new group 1"
driver.find_element(:css, "#group_name").send_keys(name)
driver.find_element(:css, "#group_#{group.id} .btn").click
wait_for_ajaximations
new_group = @admin_account.groups.find_by_name(name)
group = @admin_account.groups.find_by_name(name)
group.should_not be_nil
end
@ -209,7 +213,9 @@ describe "account admin manage groups" do
it "should create a category and should be able to edit it" do
get "/accounts/#{@admin_account.id}/groups"
@admin_account.group_categories.last.name.should == "Existing Category"
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link").click
make_full_screen
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link .icon-edit").click
wait_for_ajaximations
form = driver.find_element(:id, "edit_category_form")
input_box = form.find_element(:css, "input[type=text]")
category_name = "New Category"
@ -222,9 +228,12 @@ describe "account admin manage groups" do
it "should create a category and should be able to check the Allow self sign-up box" do
get "/accounts/#{@admin_account.id}/groups"
@admin_account.group_categories.last.name.should == "Existing Category"
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link").click
make_full_screen
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link .icon-edit").click
wait_for_ajaximations
form = driver.find_element(:id, "edit_category_form")
form.find_element(:id, "category_enable_self_signup").click
wait_for_ajaximations
is_checked('#category_enable_self_signup').should be_true
submit_form(form)
wait_for_ajaximations
@ -234,11 +243,15 @@ describe "account admin manage groups" do
it "should create a category and should be able to check the Allow self sign-up box and the Require group members to be in the same section" do
get "/accounts/#{@admin_account.id}/groups"
@admin_account.group_categories.last.name.should == "Existing Category"
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link").click
make_full_screen
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link .icon-edit").click
wait_for_ajaximations
form = driver.find_element(:id, "edit_category_form")
form.find_element(:id, "category_enable_self_signup").click
wait_for_ajaximations
is_checked('#category_enable_self_signup').should be_true
form.find_element(:id, "category_restrict_self_signup").click
wait_for_ajaximations
is_checked('#category_restrict_self_signup').should be_true
submit_form(form)
wait_for_ajaximations
@ -249,9 +262,12 @@ describe "account admin manage groups" do
it "should click on the self signup help link " do
get "/accounts/#{@admin_account.id}/groups"
@admin_account.group_categories.last.name.should include "Existing Category"
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link").click
make_full_screen
driver.find_element(:css, "#category_#{@courses_group_category.id} .edit_category_link .icon-edit").click
wait_for_ajaximations
form = driver.find_element(:id, "edit_category_form")
form.find_element(:css, ".self_signup_help_link").click
wait_for_ajaximations
driver.find_element(:id, "self_signup_help_dialog").should be_displayed
end
end

View File

@ -7,8 +7,8 @@ describe "account admin question bank" do
before(:each) do
admin_logged_in
@question_bank = create_question_bank
@question = create_question
@outcome = create_outcome
@question = create_question
@outcome = create_outcome
get "/accounts/#{Account.default.id}/question_banks/#{@question_bank.id}"
end
@ -31,17 +31,17 @@ describe "account admin question bank" do
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
@ -67,15 +67,20 @@ describe "account admin question bank" do
multiple_choice_value = "multiple_choice_question"
question_text = "what is the answer to #{name}?"
f(".add_question_link").click
wait_for_ajaximations
question_form = f(".question_form")
question_form.find_element(:css, "[name='question_name']").send_keys(name)
replace_content(question_form.find_element(:css, "[name='question_points']"), points)
wait_for_ajaximations
click_option(".header .question_type", multiple_choice_value, :value)
wait_for_ajaximations
type_in_tiny(".question_content", question_text)
wait_for_ajaximations
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")
wait_for_ajaximations
end
submit_form(question_form)
wait_for_ajaximations
@ -91,8 +96,10 @@ describe "account admin question bank" do
driver.switch_to.alert.accept
wait_for_ajaximations
@question.reload
@question.workflow_state.should == "deleted"
f("#questions .question_name").should be_nil
keep_trying_until do
@question.workflow_state.should == "deleted"
fj("#questions .question_name").should be_nil
end
end
it "should edit a multiple choice question" do
@ -119,7 +126,9 @@ describe "account admin question bank" do
it "should move question to another bank" do
question_bank_2 = create_question_bank("bank 2")
f(".move_question_link").click
wait_for_ajaximations
f("#move_question_dialog #question_bank_#{question_bank_2.id}").click
wait_for_ajaximations
submit_dialog("#move_question_dialog", '.submit_button')
wait_for_ajaximations
question_bank_2.assessment_questions.find_by_name(@question.name).should be_present
@ -136,6 +145,7 @@ describe "account admin question bank" do
it "should edit bank details" do
f(".edit_bank_link").click
wait_for_ajaximations
question_bank_title = f("#assessment_question_bank_title")
new_title = "bank 2"
replace_content(question_bank_title, new_title)
@ -149,7 +159,7 @@ describe "account admin question bank" do
driver.switch_to.alert.accept
wait_for_ajaximations
@question_bank.reload
@question_bank.workflow_state.should == "deleted"
keep_trying_until { @question_bank.workflow_state.should == "deleted" }
end
context "moving multiple questions" do
@ -159,12 +169,13 @@ describe "account admin question bank" do
questions.push @question
question_count.times { |i| questions.push create_question("question #{question_number+i}") }
f(".move_questions_link").click
wait_for_ajax_requests
wait_for_ajaximations
question_list = ffj(".list_question:visible")
question_list.count.should == questions.count
question_list.each_with_index do |question, i|
question.should include_text questions[i].name
f("#list_question_#{questions[i].id}").click
wait_for_ajaximations
end
questions
end
@ -205,9 +216,9 @@ describe "account admin question bank" do
context "outcome alignment" do
def add_outcome_to_bank(outcome, mastery_percent = 60)
f('.add_outcome_link').click
wait_for_ajax_requests
wait_for_ajaximations
f('.outcome-link').click
wait_for_ajax_requests
wait_for_ajaximations
replace_content(f('#outcome_mastery_at'), mastery_percent)
fj('.btn-primary:visible').click
driver.switch_to.alert.accept

View File

@ -81,6 +81,7 @@ describe "managing developer keys" do
ff("#keys tbody tr").length.should == 10
f('#loading').should have_class('show_more')
f("#loading .show_all").click
wait_for_ajaximations
keep_trying_until do
f("#loading").should_not have_class('loading')
true

View File

@ -16,13 +16,14 @@ describe "Alerts" do
@alerts.length.should == 0
f('#tab-alerts-link').click
wait_for_ajaximations
f('.add_alert_link').click
wait_for_animations
wait_for_ajaximations
alert = f('.alert.new')
(add_criterion = alert.find_element(:css, '.add_criterion_link')).click
wait_for_animations
wait_for_ajaximations
alert.find_element(:css, '.add_recipient_link').click
wait_for_animations
wait_for_ajaximations
(submit = alert.find_element(:css, '.submit_button')).click
wait_for_ajaximations
keep_trying_until do
@ -35,7 +36,7 @@ describe "Alerts" do
wait_for_animations
(edit = alert.find_element(:css, '.edit_link')).click
add_criterion.click
wait_for_animations
wait_for_ajaximations
submit.click
wait_for_ajaximations
@ -47,12 +48,13 @@ describe "Alerts" do
@alerts.reload
@alerts.length.should == 1
wait_for_animations
wait_for_ajaximations
edit.click
alert.find_element(:css, '.criteria .delete_item_link').click
wait_for_animations
wait_for_ajaximations
keep_trying_until { ffj('.alert .criteria li').length == 1 }
submit.click
wait_for_ajaximations
keep_trying_until do
@alerts.first.criteria.reload
@ -62,7 +64,7 @@ describe "Alerts" do
@alerts.reload
@alerts.length.should == 1
wait_for_animations
wait_for_ajaximations
alert.find_element(:css, '.delete_link').click
wait_for_ajaximations
@ -79,7 +81,9 @@ describe "Alerts" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajaximations
f("#edit_alert_#{alert.id} .delete_link").click
wait_for_ajaximations
keep_trying_until { fj("#edit_alert_#{alert.id}").blank? }
@alerts.reload
@ -90,11 +94,11 @@ describe "Alerts" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajax_requests
wait_for_ajaximations
f('.add_alert_link').click
wait_for_animations
wait_for_ajaximations
f('.alert.new .delete_link').click
wait_for_animations
wait_for_ajaximations
keep_trying_until { ff(".alert.new").should be_empty }
@alerts.should be_empty
@ -104,10 +108,11 @@ describe "Alerts" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajaximations
f('.add_alert_link').click
wait_for_animations
wait_for_ajaximations
f('.alert.new .cancel_button').click
wait_for_animations
wait_for_ajaximations
keep_trying_until { ffj(".alert.new").should be_empty }
@alerts.should be_empty
end
@ -115,18 +120,22 @@ describe "Alerts" do
it "should validate the form" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajaximations
f('.add_alert_link').click
wait_for_ajaximations
alert = f('.alert.new')
alert.find_element(:css, 'input[name="repetition"][value="value"]').click
sleep 2 #need to wait for javascript to process
wait_for_ajaximations
keep_trying_until do
submit_form('#new_alert')
wait_for_animations
wait_for_ajaximations
ffj('.error_box').length == 4
end
# clicking "do not repeat" should remove the number of days error
alert.find_element(:css, 'input[name="repetition"][value="none"]').click
wait_for_ajaximations
keep_trying_until { ffj('.error_box').length == 3 }
# adding recipient and criterion make the errors go away
@ -144,14 +153,16 @@ describe "Alerts" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajaximations
f('.add_alert_link').click
wait_for_ajaximations
alert = f('.alert.new')
link = alert.find_element(:css, '.add_recipient_link')
keep_trying_until { ffj('.alert.new .add_recipients_line select option').length > 1 }
for i in 1..alert.find_elements(:css, '.add_recipients_line select option').length do
link.click
wait_for_animations
wait_for_ajaximations
end
f('.alert.new .add_recipient_link').should_not be_displayed
end
@ -161,13 +172,15 @@ describe "Alerts" do
get "/accounts/#{@context.id}/settings"
f('#tab-alerts-link').click
wait_for_ajaximations
alertElement = f("#edit_alert_#{alert.id}")
alertElement.find_element(:css, ".edit_link").click
wait_for_ajaximations
fj("#edit_alert_#{alert.id} .add_recipient_link:visible").should be_blank
# Deleting a recipient should add it to the dropdown (which is now visible)
alertElement.find_element(:css, '.recipients .delete_item_link').click
wait_for_animations
wait_for_ajaximations
fj("#edit_alert_#{alert.id} .add_recipient_link").should be_displayed
alertElement.find_elements(:css, '.add_recipients_line select option').length.should == 1
keep_trying_until { alertElement.find_elements(:css, '.recipients li').length == 2 }

View File

@ -8,14 +8,72 @@ describe "assignments" do
def manually_create_assignment(assignment_title = 'new assignment')
get "/courses/#{@course.id}/assignments"
f('.add_assignment_link').click
wait_for_ajaximations
replace_content(f('#assignment_title'), assignment_title)
expect_new_page_load { f('.more_options_link').click }
wait_for_ajaximations
end
def submit_assignment_form
expect_new_page_load { f('.btn-primary[type=submit]').click }
wait_for_ajaximations
end
def edit_assignment
expect_new_page_load { f('.edit_assignment_link').click }
wait_for_ajaximations
end
before(:each) do
course_with_teacher_logged_in
end
it "should edit an assignment" do
assignment_name = 'first test assignment'
due_date = Time.now.utc + 2.days
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
)
get "/courses/#{@course.id}/assignments"
expect_new_page_load { f("#assignment_#{@assignment.id} .title").click }
edit_assignment
f('#assignment_toggle_advanced_options').click
f('#assignment_group_id').should be_displayed
click_option('#assignment_group_id', second_group.name)
click_option('#assignment_grading_type', 'Letter Grade')
#check grading levels dialog
f('.edit_letter_grades_link').click
wait_for_ajaximations
f('#edit_letter_grades_form').should be_displayed
close_visible_dialog
#check peer reviews option
form = f("#edit_assignment_form")
form.find_element(:css, '#assignment_peer_reviews').click
wait_for_ajaximations
form.find_element(:css, '#assignment_automatic_peer_reviews').click
wait_for_ajaximations
f('#assignment_peer_review_count').send_keys('2')
driver.execute_script "$('#assignment_peer_reviews_assign_at + .ui-datepicker-trigger').click()"
wait_for_ajaximations
datepicker = datepicker_next
datepicker.find_element(:css, '.ui-datepicker-ok').click
wait_for_ajaximations
f('#assignment_name').send_keys(' edit')
#save changes
submit_assignment_form
f('title').should include_text(assignment_name + ' edit')
end
it "should display assignment on calendar and link to assignment" do
assignment_name = 'first assignment'
current_date = Time.now.utc
@ -27,19 +85,22 @@ describe "assignments" do
#click on assignment in calendar
if due_date.month > current_date.month
f('#content .next_month_link').click
wait_for_ajax_requests
wait_for_ajaximations
end
day_id = '#day_' + due_date.year.to_s() + '_' + due_date.strftime('%m') + '_' + due_date.strftime('%d')
day_div = f(day_id)
wait_for_ajaximations
sleep 1 # this is one of those cases where if we click too early, no subsequent clicks will work
day_div.find_element(:link, assignment_name).click
wait_for_animations
wait_for_ajaximations
details_dialog = f('#event_details').find_element(:xpath, '..')
details_dialog.should include_text(assignment_name)
details_dialog.find_element(:css, '.edit_event_link').click
wait_for_ajaximations
details_dialog = f('#edit_event').find_element(:xpath, '..')
details_dialog.find_element(:name, 'assignment[title]').should be_displayed
details_dialog.find_element(:css, '#edit_assignment_form .more_options_link').click
wait_for_ajaximations
f('#assignment_name')['value'].should include_text(assignment_name)
end
@ -52,21 +113,25 @@ describe "assignments" do
#create assignment
click_option('#right-side select.assignment_groups_select', 'second group')
f('.add_assignment_link').click
wait_for_ajaximations
f('#assignment_title').send_keys(assignment_name)
f('.ui-datepicker-trigger').click
wait_for_ajaximations
datepicker = datepicker_next
datepicker.find_element(:css, '.ui-datepicker-ok').click
wait_for_ajaximations
f('#assignment_points_possible').send_keys('5')
submit_form('#add_assignment_form')
#make sure assignment was added to correct assignment group
wait_for_animations
wait_for_ajaximations
first_group = f('#groups .assignment_group:nth-child(2)')
first_group.should include_text('second group')
first_group.should include_text(assignment_name)
#click on assignment link
f("#assignment_#{Assignment.last.id} .title").click
wait_for_ajaximations
f('h2.title').should include_text(assignment_name)
end
@ -75,6 +140,7 @@ describe "assignments" do
assignment_title = 'grading options assignment'
manually_create_assignment(assignment_title)
f('#assignment_toggle_advanced_options').click
wait_for_ajaximations
click_option('#assignment_grading_type', grading_option, :value)
submit_assignment_form
f('.title').should include_text(assignment_title)
@ -87,35 +153,39 @@ describe "assignments" do
expected_date = (Time.now - 1.month).strftime("%b #{middle_number}")
manually_create_assignment
f('#assignment_due_date_controls .ui-datepicker-trigger').click
wait_for_ajaximations
f('.ui-datepicker-prev').click
wait_for_ajaximations
fj("#ui-datepicker-div a:contains(#{middle_number})").click
expect_new_page_load { submit_form('#edit_assignment_form') }
wait_for_ajaximations
expect_new_page_load { f(".edit_assignment_link").click }
wait_for_ajaximations
f('#assignment_due_date').attribute(:value).should include_text(expected_date)
Assignment.find_by_title('new assignment').due_at.strftime('%b %d').should == expected_date
end
it "only allows an assignment editor to edit points and title if assignment " +
"if assignment has multiple due dates" do
"if assignment has multiple due dates" do
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
)
@assignment.any_instantiation.expects(:overridden_for).at_least_once.
returns @assignment
returns @assignment
@assignment.any_instantiation.expects(:multiple_due_dates?).at_least_once.
returns true
returns true
get "/courses/#{@course.id}/assignments"
wait_for_animations
driver.execute_script "$('.edit_assignment_link').first().hover().click()"
# Assert input element is hidden to the user, but still present in the
# form so the due date doesn't get changed to no due date.
fj('.add_assignment_form .input-append').attribute('style').
should contain 'display: none;'
should contain 'display: none;'
f('.vdd_no_edit').text.
should == I18n.t("#assignments.multiple_due_dates","Multiple Due Dates")
should == I18n.t("#assignments.multiple_due_dates", "Multiple Due Dates")
assignment_title = f("#assignment_title")
assignment_points_possible = f("#assignment_points_possible")
assignment_title.clear
@ -139,6 +209,7 @@ describe "assignments" do
AssignmentGroup.update_all({:updated_at => 1.hour.ago}, {:id => group.id})
first_stamp = group.reload.updated_at.to_i
f('.add_assignment_link').click
wait_for_ajaximations
expect_new_page_load { f('.more_options_link').click }
submit_assignment_form
@course.assignments.count.should == 1
@ -155,9 +226,12 @@ describe "assignments" do
f('.add_assignment_link').click
expect_new_page_load { f('.more_options_link').click }
f('#assignment_toggle_advanced_options').click
wait_for_ajaximations
f('#assignment_has_group_category').click
wait_for_ajaximations
click_option('#assignment_group_category_id', 'new', :value)
fj('.ui-dialog:visible .self_signup_help_link img').click
wait_for_ajaximations
f('#self_signup_help_dialog').should be_displayed
end
@ -174,7 +248,9 @@ describe "assignments" do
@assignment = @course.assignments.last
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
f('#assignment_toggle_advanced_options').click
wait_for_ajaximations
f('#assignment_has_group_category').click
wait_for_ajaximations
submit_dialog('#add_category_form')
wait_for_ajaximations
submit_assignment_form
@ -214,18 +290,22 @@ describe "assignments" do
#check grading levels dialog
f('.edit_letter_grades_link').click
wait_for_animations
wait_for_ajaximations
f('#edit_letter_grades_form').should be_displayed
close_visible_dialog
#check peer reviews option
form = f("#edit_assignment_form")
form.find_element(:css, '#assignment_peer_reviews').click
wait_for_ajaximations
form.find_element(:css, '#assignment_automatic_peer_reviews').click
wait_for_ajaximations
f('#assignment_peer_review_count').send_keys('2')
driver.execute_script "$('#assignment_peer_reviews_assign_at + .ui-datepicker-trigger').click()"
wait_for_ajaximations
datepicker = datepicker_next
datepicker.find_element(:css, '.ui-datepicker-ok').click
wait_for_ajaximations
f('#assignment_name').send_keys(' edit')
#save changes
@ -256,11 +336,59 @@ describe "assignments" do
ff("fieldset#assignment_peer_reviews_fields div").should == []
end
it "should show a more errors errorBox if any invalid fields are hidden" do
assignment_name = 'first test assignment'
@assignment = @course.assignments.create({
:name => assignment_name,
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
f('#assignment_toggle_advanced_options').click # show advanced options
click_option('#assignment_submission_type', "Online") # setup an error state (online with no types)
f('#assignment_toggle_advanced_options').click # hide advanced options
f('.btn-primary[type=submit]').click
wait_for_ajaximations
errorBoxes = driver.execute_script("return $('.errorBox').filter('[id!=error_box_template]').toArray();")
errorBoxes.size.should == 2 # the inivisible one and the 'advanced options' one
visBoxes, hidBoxes = errorBoxes.partition { |eb| eb.displayed? }
visBoxes.first.text.should == "There were errors on one or more advanced options"
f('#assignment_toggle_advanced_options').click
wait_for_ajaximations
errorBoxes = driver.execute_script("return $('.errorBox').filter('[id!=error_box_template]').toArray();")
errorBoxes.size.should == 1 # the more_options_link one has now been removed from the DOM
errorBoxes.first.text.should == 'Please choose at least one submission type'
errorBoxes.first.should be_displayed
end
it "should create an assignment with more options" do
enable_cache do
expected_text = "Assignment 1"
get "/courses/#{@course.id}/assignments"
group = @course.assignment_groups.first
AssignmentGroup.update_all({:updated_at => 1.hour.ago}, {:id => group.id})
first_stamp = group.reload.updated_at.to_i
f('.add_assignment_link').click
wait_for_ajaximations
expect_new_page_load { f('.more_options_link').click }
submit_assignment_form
@course.assignments.count.should == 1
get "/courses/#{@course.id}/assignments"
f('.no_assignments_message').should_not be_displayed
f('#groups').should include_text(expected_text)
group.reload
group.updated_at.to_i.should_not == first_stamp
end
end
context "frozen assignments" do
append_before(:each) do
@att_map = {
"assignment_group_id" => "true"
"assignment_group_id" => "true"
}
PluginSetting.stubs(:settings_for_plugin).returns(@att_map)
@ -295,14 +423,10 @@ describe "assignments" do
f('h2.title').should include_text(orig_title + ' edit')
end
it "should respect frozen attributes for teacher" do
run_assignment_edit do
f('#assignment_group_id').should have_attribute('disabled', 'true')
f('#assignment_peer_reviews').attribute('disabled').should be_nil
f('#assignment_description').attribute('disabled').should be_nil
click_option('#assignment_group_id', "other")
end
@asmnt.reload.assignment_group.name.should == "default"
it "should not allow assignment group to be deleted by teacher if assignment group id frozen" do
get "/courses/#{@course.id}/assignments"
fj("#group_#{@asmnt.assignment_group_id} .delete_group_link").should be_nil
fj("#assignment_#{@asmnt.id} .delete_assignment_link").should be_nil
end
it "should not be locked for admin" do
@ -318,48 +442,11 @@ describe "assignments" do
end
it "should not allow assignment group to be deleted by teacher if "+
"assignment group id frozen" do
"assignment group id frozen" do
get "/courses/#{@course.id}/assignments"
fj("#group_#{@asmnt.assignment_group_id} .delete_group_link").should be_nil
fj("#assignment_#{@asmnt.id} .delete_assignment_link").should be_nil
end
end
it "should show a more errors errorBox if any invalid fields are hidden" do
assignment_name = 'first test assignment'
@assignment = @course.assignments.create({
:name => assignment_name,
:assignment_group => @course.assignment_groups.create!(:name => "default")
})
get "/courses/#{@course.id}/assignments/#{@assignment.id}/edit"
f('#assignment_toggle_advanced_options').click # show advanced options
click_option('#assignment_submission_type', "Online") # setup an error state (online with no types)
f('#assignment_toggle_advanced_options').click # hide advanced options
f('.btn-primary[type=submit]').click
wait_for_ajaximations
errorBoxes = driver.execute_script("return $('.errorBox').filter('[id!=error_box_template]').toArray();")
errorBoxes.size.should == 2 # the inivisible one and the 'advanced options' one
visBoxes, hidBoxes = errorBoxes.partition{ |eb| eb.displayed? }
visBoxes.first.text.should == "There were errors on one or more advanced options"
f('#assignment_toggle_advanced_options').click
wait_for_animations
errorBoxes = driver.execute_script("return $('.errorBox').filter('[id!=error_box_template]').toArray();")
errorBoxes.size.should == 1 # the more_options_link one has now been removed from the DOM
errorBoxes.first.text.should == 'Please choose at least one submission type'
errorBoxes.first.should be_displayed
end
def submit_assignment_form
expect_new_page_load { f('.btn-primary[type=submit]').click }
wait_for_ajaximations
end
def edit_assignment
expect_new_page_load { f('.edit_assignment_link').click }
wait_for_ajaximations
end
end
end

4
spec/selenium/assignments_student_spec.rb Normal file → Executable file
View File

@ -202,11 +202,15 @@ describe "assignments" do
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
f('.submit_assignment_link').click
wait_for_ajaximations
assignment_form = f('#submit_online_text_entry_form')
wait_for_tiny(assignment_form)
wait_for_ajaximations
expect {
type_in_tiny('#submission_body', 'something to submit')
wait_for_ajaximations
submit_form(assignment_form)
wait_for_ajaximations
}.to change(Submission, :count).by(1)
end
end

View File

@ -216,8 +216,8 @@ describe "calendar2" do
f('.fc-event').click
fj('.popover-links-holder:visible').should_not be_nil
f('.event-details-links .edit_event_link').click
expect_new_page_load { f('#edit_calendar_event_form .more_options_link').click }
driver.execute_script("$('.edit_event_link').hover().click()")
expect_new_page_load { driver.execute_script("$('#edit_calendar_event_form .more_options_link').hover().click()") }
f('#breadcrumbs').text.should include 'Calendar Events'
end
@ -225,7 +225,9 @@ describe "calendar2" do
name = 'special assignment'
create_middle_day_assignment(name)
f('.fc-event.assignment').click
expect_new_page_load { f('.view_event_link').click }
wait_for_ajaximations
driver.execute_script("$('.view_event_link').hover().click()")
f('h2.title').text.should include(name)
end
@ -233,16 +235,18 @@ describe "calendar2" do
name = 'super big assignment'
create_middle_day_assignment(name)
f('.fc-event.assignment').click
f('.edit_event_link').click
expect_new_page_load { f('.more_options_link').click }
driver.execute_script("$('.edit_event_link').hover().click()")
expect_new_page_load { driver.execute_script("$('.more_options_link').hover().click()") }
f('#assignment_name').attribute(:value).should include(name)
end
it "should delete an event" do
create_middle_day_event('doomed event')
fj('.fc-event:visible').click
fj('.delete_event_link').click
fj('.ui-dialog .btn-primary').click
wait_for_ajaximations
driver.execute_script("$('.delete_event_link').hover().click()")
wait_for_ajaximations
driver.execute_script("$('.ui-dialog .btn-primary').hover().click()")
wait_for_ajaximations
fj('.fc-event:visible').should be_nil
# make sure it was actually deleted and not just removed from the interface
@ -254,8 +258,9 @@ describe "calendar2" do
it "should delete an assignment" do
create_middle_day_assignment
fj('.fc-event').click
fj('.delete_event_link').click
fj('.ui-dialog .btn-primary').click
driver.execute_script("$('.delete_event_link').hover().click()")
wait_for_ajaximations
driver.execute_script("$('.ui-dialog .btn-primary').hover().click()")
wait_for_ajaximations
fj('.fc-event').should be_nil
# make sure it was actually deleted and not just removed from the interface
@ -282,7 +287,9 @@ describe "calendar2" do
wait_for_ajaximations
fj('.fc-event').click
wait_for_ajaximations
fj('.message_students').click
driver.execute_script("$('.message_students').hover().click()")
wait_for_ajaximations
ff(".participant_list input").size.should == 1
set_value f('textarea[name="body"]'), 'hello'
@ -310,7 +317,7 @@ describe "calendar2" do
event1.click
wait_for_ajaximations
f('.popover-links-holder .edit_event_link').click
driver.execute_script("$('.edit_event_link').hover().click()")
wait_for_ajaximations
select = f('#edit_assignment_form .assignment_group')
@ -320,7 +327,7 @@ describe "calendar2" do
event2.click
wait_for_ajaximations
f('.popover-links-holder .edit_event_link').click
driver.execute_script("$('.edit_event_link').hover().click()")
wait_for_ajaximations
select = f('#edit_assignment_form .assignment_group')
first_selected_option(select).attribute(:value).to_i.should == group2.id
@ -336,7 +343,7 @@ describe "calendar2" do
get "/calendar2"
f('.fc-event').click
wait_for_ajaximations
f('.popover-links-holder .edit_event_link').click
driver.execute_script("$('.edit_event_link').hover().click()")
wait_for_ajaximations
original_more_options = f('.more_options_link')['href']
original_more_options.should_not match(/undefined/)
@ -349,7 +356,7 @@ describe "calendar2" do
fj('.fc-event').click
wait_for_ajaximations
fj('.popover-links-holder .edit_event_link').click
driver.execute_script("$('.edit_event_link').hover().click()")
wait_for_ajaximations
fj('.more_options_link')['href'].should match(original_more_options)
end
@ -358,7 +365,7 @@ describe "calendar2" do
create_middle_day_assignment("undate me")
f(".undated-events-link").click
f('.fc-event').click
f('.popover-links-holder .edit_event_link').click
driver.execute_script("$('.popover-links-holder .edit_event_link').hover().click()")
replace_content(f('.ui-dialog #assignment_due_at'), "")
submit_form('#edit_assignment_form')
wait_for_ajax_requests
@ -590,7 +597,8 @@ describe "calendar2" do
fj('.fc-event:visible').click
fj("#popover-0").should be_displayed
expect_new_page_load { fj('#popover-0 .view_event_link').click }
expect_new_page_load { driver.execute_script("$('#popover-0 .view_event_link').hover().click()") }
is_checked('#scheduler').should be_true
f('#appointment-group-list').should include_text(ag.title)
@ -628,7 +636,7 @@ describe "calendar2" do
# click the event in the calendar
fj('.fc-event').click
fj("#popover-0").should be_displayed
expect_new_page_load { fj('#popover-0 .view_event_link').click }
expect_new_page_load { driver.execute_script("$('.view_event_link').hover().click()") }
page_title = f('.title')
page_title.should be_displayed

View File

@ -29,8 +29,10 @@ describe "conversations" do
@me = @user
5.times { conversation(@me, user, :workflow_state => 'unread') }
get "/conversations/unread"
get_conversations.first.click
get_conversations.first.should have_class('unread') # not marked immediately
ce = get_conversations.first
ce.should have_class('unread') # not marked immediately
ce.click
wait_for_ajaximations
@me.conversations.unread.size.should == 5
keep_trying_until do
get_conversations.first.should_not have_class('unread')

View File

@ -14,11 +14,13 @@ describe "course settings" do
add_button = f('.add_users_link')
keep_trying_until { add_button.should be_displayed }
add_button.click
wait_for_ajaximations
click_option('#enrollment_type', type)
click_option('#course_section_id_holder > #course_section_id', section_name) if section_name
f('#user_list_boxes .user_list').send_keys(email)
f('.verify_syntax_button').click
wait_for_ajax_requests
wait_for_ajaximations
f('#user_list_parsed').should include_text(email)
f('.add_users_button').click
wait_for_ajax_requests
@ -27,15 +29,14 @@ describe "course settings" do
describe "course users" do
def select_from_auto_complete(text, input_id)
fj(".token_input input:visible").send_keys(text)
keep_trying_until do
driver.execute_script("return $('##{input_id}').data('token_input').selector.lastSearch") == text
end
keep_trying_until { driver.execute_script("return $('##{input_id}').data('token_input').selector.lastSearch") == text }
elements = driver.execute_script("return $('.autocomplete_menu:visible .list').last().find('ul').last().find('li').toArray();").map { |e|
[e, (e.find_element(:tag_name, :b).text rescue e.text)]
}
element = elements.detect { |e| e.last == text } or raise "menu item does not exist"
element.first.click
wait_for_ajaximations
end
def go_to_users_tab
@ -57,6 +58,7 @@ describe "course settings" do
f("#user_#{user.id} .admin-links")
end
f('button', cog).click
wait_for_ajaximations
cog
end
@ -128,6 +130,7 @@ describe "course settings" do
link = driver.find_element(:link, 'User Details')
href = link['href']
link.click
wait_for_ajaximations
wait_for_ajax_requests
# expect
driver.current_url.should include(href)
@ -188,7 +191,6 @@ describe "course settings" do
it "should handle deleted observees" do
custom_observer_role("obob")
students = []
obs = user_model(:name => "The Observer")
student_in_course(:name => "Student 1", :active_all => true, :role_name => 'custom stu')
@course.enroll_user(obs, 'ObserverEnrollment', :enrollment_state => 'active', :associated_user_id => @student.id, :role_name => 'obob')
@ -215,7 +217,6 @@ describe "course settings" do
it "should handle deleted observee enrollments" do
custom_observer_role("obob")
students = []
obs = user_model(:name => "The Observer")
student_in_course(:name => "Student 1", :active_all => true, :role_name => 'custom stu')
@course.enroll_user(obs, 'ObserverEnrollment', :enrollment_state => 'active', :associated_user_id => @student.id, :role_name => 'obob')

15
spec/selenium/eportfolios_spec.rb Normal file → Executable file
View File

@ -145,16 +145,20 @@ describe "eportfolios" do
it "should add a user file" do
f('.add_file_link').click
fj('.file_list:visible .sign:visible').click # my files
wait_for_ajaximations
fj('.file_list:visible .sign:visible').click
wait_for_ajaximations# my files
file = fj('li.file .text:visible')
file.should include_text @attachment.filename
wait_for_ajaximations
file.click
f('.upload_file_button').click
wait_for_ajaximations
download = fj('.eportfolio_download:visible')
download.should be_present
download.should include_text @attachment.filename
submit_form('.form_content')
wait_for_ajax_requests
wait_for_ajaximations
f('.section.read_only').should include_text @attachment.filename
refresh_page
f('.section.read_only').should include_text @attachment.filename
@ -169,7 +173,8 @@ describe "eportfolios" do
def add_html
submit_form(".form_content")
wait_for_ajax_requests
#driver.execute_script("$('.form_content .btn-primary').click()")
wait_for_ajaximations
f(".section_content b").text.should == "student"
entry_verifier ({:section_type => "html", :content => @html_content})
end
@ -201,7 +206,6 @@ describe "eportfolios" do
put_comment_in_html
end
it "should delete the html content" do
add_html
f(".edit_content_link").click
@ -273,7 +277,8 @@ describe "eportfolios file upload" do
filename, fullpath, data = get_file("testfile5.zip")
expect_new_page_load { f(".icon-arrow-right").click }
f(".edit_content_link").click
f(".add_file_link").click
wait_for_ajaximations
driver.execute_script "$('.add_file_link').click()"
fj(".file_upload:visible").send_keys(fullpath)
fj(".upload_file_button").click
wait_for_ajaximations

View File

@ -25,13 +25,12 @@ end
def add_file(file_fullpath)
attachment_field = keep_trying_until do
fj('#add_file_link').click # fj to avoid selenium caching
driver.execute_script "$('.add_file_link').click()"
wait_for_ajaximations
attachment_field = fj('#attachment_uploaded_data')
attachment_field.should be_displayed
attachment_field
end
wait_for_ajaximations
attachment_field.send_keys(file_fullpath)
wait_for_ajaximations
f('.add_file_form').submit
@ -39,6 +38,14 @@ def add_file(file_fullpath)
wait_for_js
end
def create_temp_file(filename)
path = "#{RAILS_ROOT}/tmp/#{filename}"
file = File.open!(path, 'w')
file.write filename
file.close
path
end
def get_file_elements
file_elements = keep_trying_until do
file_elements = ffj('#files_structure_list > .context > ul > .file > .name')
@ -50,9 +57,10 @@ end
def file_setup
sleep 5
@a_filename, a_fullpath, a_data = get_file("a_file.txt")
@b_filename, b_fullpath, b_data = get_file("b_file.txt")
@c_filename, c_fullpath, c_data = get_file("c_file.txt")
a_fullpath = create_temp_file(@a_filename = "a_file.txt")
b_fullpath = create_temp_file(@b_filename = "b_file.txt")
c_fullpath = create_temp_file(@c_filename = "c_file.txt")
add_file(a_fullpath)
add_file(c_fullpath)
@ -64,12 +72,14 @@ describe "common file behaviors" do
def add_file(file_fullpath)
attachment_field = keep_trying_until do
fj('#add_file_link').click # fj to avoid selenium caching
driver.execute_script "$('.add_file_link').click()"
wait_for_ajaximations
attachment_field = fj('#attachment_uploaded_data')
attachment_field.should be_displayed
attachment_field
end
attachment_field.send_keys(file_fullpath)
wait_for_ajaximations
f('.add_file_form').submit
wait_for_ajaximations
wait_for_js
@ -138,10 +148,15 @@ describe "common file behaviors" do
it "should ignore file name case when alphabetizing" do
sleep 5 # page does a weird load twice which is causing selenium failures so we sleep and wait for the page
amazing_filename, amazing_fullpath, amazing_data = get_file("amazing_file.txt")
dog_filename, dog_fullpath, dog_data = get_file("Dog_file.txt")
dog_fullpath = create_temp_file("Dog_file.txt")
amazing_fullpath = create_temp_file("amazing_file.txt")
file_paths = [dog_fullpath, amazing_fullpath]
file_paths.each { |name| add_file(name) }
file_paths.each do
|name| add_file(name)
wait_for_ajaximations
end
files = ff('#files_content .file')
files.first.should include_text('amazing')
files.last.should include_text('Dog')

6
spec/selenium/gradebook2_grade_edit_spec.rb Normal file → Executable file
View File

@ -92,7 +92,7 @@ describe "edititing grades" do
edit_grade(f('#gradebook_grid [row="0"] .l3'), 'A-')
wait_for_ajax_requests
f('#gradebook_grid [row="0"] .l3').text.should == 'A-'
f('#gradebook_grid [row="0"] .l3').should include_text('A-')
@assignment.reload.submissions.size.should == 1
sub = @assignment.submissions.first
sub.grade.should == 'A-'
@ -122,7 +122,7 @@ describe "edititing grades" do
first_cell.find_element(:css, '.grade')
end
set_value(grade_input, 3)
first_cell.send_keys(:tab)
grade_input.send_keys(:tab)
wait_for_ajax_requests
f('#gradebook_grid [row="0"] .l1').should have_class('editable')
end
@ -144,7 +144,7 @@ describe "edititing grades" do
a2.find_element(:css, '.grade')
end
set_value(grade_input, 3)
a1.send_keys(:tab)
grade_input.send_keys(:tab)
wait_for_ajaximations
f(assignment_1_sel)['class'].should_not include 'dropped'
f(assignment_2_sel)['class'].should include 'dropped'

View File

@ -256,7 +256,10 @@ describe "gradebook2" do
wait_for_ajaximations
#make sure it's on the other student's submission
comment = open_comment_dialog(3, 1).find_element(:css, '.comment')
comment = keep_trying_until do
open_comment_dialog(3, 1)
fj(".submission_details_dialog:visible .comment")
end
comment.should include_text(comment_text)
end
@ -333,7 +336,7 @@ describe "gradebook2" do
message_form.find_element(:css, '#body').send_keys(message_text)
submit_form(message_form)
wait_for_ajax_requests
}.to change {ConversationMessage.count(:conversation_id)}.by(1)
}.to change { ConversationMessage.count(:conversation_id) }.by(1)
end
it "should send messages when Scored more than X points" do
@ -346,7 +349,7 @@ describe "gradebook2" do
expect {
message_form = f('#message_assignment_recipients')
click_option('#message_assignment_recipients .message_types', 'Scored more than')
message_form.find_element(:css, '.cutoff_score').send_keys('3') # both assignments have score of 5
message_form.find_element(:css, '.cutoff_score').send_keys('3') # both assignments have score of 5
message_form.find_element(:css, '#body').send_keys(message_text)
submit_form(message_form)
wait_for_ajax_requests

View File

@ -64,12 +64,12 @@ shared_examples_for "grading scheme basic tests" do
it "should add a grading scheme item" do
data_count = @grading_standard.data.count
driver.action.move_to(grading_standard_rows[0]).perform
f('.insert_grading_standard_link').click
replace_content(ff('.editing_box .standard_name')[0], 'F')
grading_standard_rows[0].click
ff('.insert_grading_standard_link')[1].click
replace_content(ff('.editing_box .standard_name')[1], 'F')
save_and_reload_changes(@grading_standard)
@grading_standard.data.count.should == data_count + 1
@grading_standard.data[0][0].should == 'F'
@grading_standard.data[1][0].should == 'F'
end
it "should edit a grading scheme item" do

View File

@ -8,6 +8,7 @@ shared_examples_for "question bank basic tests" do
def add_question_bank(title = 'bank 1')
question_bank_title = keep_trying_until do
f(".add_bank_link").click
wait_for_ajaximations
question_bank_title = f("#assessment_question_bank_title")
question_bank_title.should be_displayed
question_bank_title
@ -25,6 +26,7 @@ shared_examples_for "question bank basic tests" do
it "should verify question bank is found by navigating to bookmark" do
question_bank = add_question_bank
expect_new_page_load { f(".see_bookmarked_banks").click }
wait_for_ajaximations
f("#question_bank_#{question_bank.id}").should include_text question_bank.title
end
@ -32,7 +34,7 @@ shared_examples_for "question bank basic tests" do
question_bank = add_question_bank
fj(".bookmark_bank_link img:visible").should have_attribute(:alt, "Bookmark")
fj(".bookmark_bank_link:visible").click
wait_for_ajax_requests
wait_for_ajaximations
fj(".bookmark_bank_link img:visible").should have_attribute(:alt, "Bookmark_gray")
question_bank.reload
question_bank.bookmarked_for?(User.last).should be_false
@ -42,8 +44,9 @@ shared_examples_for "question bank basic tests" do
new_title = "bank 2"
question_bank = add_question_bank
f("#questions .edit_bank_link").click
wait_for_ajaximations
f("#assessment_question_bank_title").send_keys(new_title, :return)
wait_for_ajax_requests
wait_for_ajaximations
question_bank.reload
question_bank.title.should == new_title
f("#questions .title").should include_text new_title
@ -55,7 +58,9 @@ shared_examples_for "question bank basic tests" do
driver.switch_to.alert.accept
wait_for_ajaximations
question_bank.reload
question_bank.workflow_state.should == "deleted"
f("#questions .title").should be_nil
keep_trying_until do
question_bank.workflow_state.should == "deleted"
f("#questions .title").should be_nil
end
end
end

View File

@ -24,9 +24,9 @@ shared_examples_for "discussion and announcement main page tests" do
def refresh_and_filter(filter_type, filter, expected_text, expected_results = 1)
refresh_page # in order to get the new topic information
wait_for_ajax_requests
wait_for_ajaximations
keep_trying_until { ff('.toggleSelected').count.should == what_to_create.count }
filter_type == :css ? f(filter).click : replace_content(f('#searchTerm'), filter)
filter_type == :css ? driver.execute_script("$('#{filter}').click()") : replace_content(f('#searchTerm'), filter)
ff('.discussionTopicIndexList .discussion-topic').count.should == expected_results
expected_results > 1 ? ff('.discussionTopicIndexList .discussion-topic').each { |topic| topic.should include_text(expected_text) } : (f('.discussionTopicIndexList .discussion-topic').should include_text(expected_text))
end

View File

@ -90,7 +90,7 @@ shared_examples_for "gradebook2 selenium tests" do
# the dialog fetches the comments async after it displays and then innerHTMLs the whole
# thing again once it has fetched them from the server, completely replacing it
wait_for_ajax_requests
find_with_jquery '.submission_details_dialog:visible'
fj('.submission_details_dialog:visible')
end
def final_score_for_row(row)

View File

@ -81,14 +81,13 @@ shared_examples_for "manage groups selenium tests" do
end
def add_group_to_category(context, name)
fj(".add_group_link:visible").click
f("#group_name").send_keys(name)
driver.execute_script("$('.add_group_link:visible').click()")
wait_for_ajaximations
replace_content(f("#group_name"), name)
wait_for_ajaximations
submit_form("#edit_group_form")
wait_for_ajaximations
group = context.groups.find_by_name(name)
group.should_not be_nil
group
context.groups.find_by_name(name)
end
def add_groups_in_category (category, i=3)

View File

@ -12,15 +12,15 @@ shared_examples_for "quizzes selenium tests" do
answers = question.find_elements(:css, ".form_answers > .answer")
answers.length.should == 4
replace_content(answers[0].find_element(:css, ".select_answer input"), "Correct Answer")
set_feedback_content(answers[0].find_element(:css, ".answer_comments"), "Good job!")
set_answer_comment(0, "Good job!")
replace_content(answers[1].find_element(:css, ".select_answer input"), "Wrong Answer #1")
set_feedback_content(answers[1].find_element(:css, ".answer_comments"), "Bad job :(")
set_answer_comment(1, "Bad job :(")
replace_content(answers[2].find_element(:css, ".select_answer input"), "Second Wrong Answer")
replace_content(answers[3].find_element(:css, ".select_answer input"), "Wrongest Answer")
set_feedback_content(question.find_element(:css, "div.text .question_correct_comment"), "Good job on the question!")
set_feedback_content(question.find_element(:css, "div.text .question_incorrect_comment"), "You know what they say - study long study wrong.")
set_feedback_content(question.find_element(:css, "div.text .question_neutral_comment"), "Pass or fail, you're a winner!")
set_question_comment(".question_correct_comment", "Good job on the question!")
set_question_comment(".question_incorrect_comment", "You know what they say - study long study wrong.")
set_question_comment(".question_neutral_comment", "Pass or fail you are a winner!")
submit_form(question)
wait_for_ajaximations
@ -37,8 +37,7 @@ shared_examples_for "quizzes selenium tests" do
answers = question.find_elements(:css, ".form_answers > .answer")
answers.length.should == 2
answers[1].find_element(:css, ".select_answer_link").click # false - get it?
answers[1].find_element(:css, ".comment_focus").click
answers[1].find_element(:css, ".answer_comments textarea").send_keys("Good job!")
set_answer_comment(1, "Good job!")
submit_form(question)
wait_for_ajaximations
@ -65,10 +64,11 @@ shared_examples_for "quizzes selenium tests" do
@points_total += points.to_i
@question_count += 1
click_new_question_button
wait_for_ajaximations
question = fj('.question_form:visible')
replace_content(question.find_element(:css, "input[name='question_points']"), points)
submit_form(question)
wait_for_ajax_requests
wait_for_ajaximations
questions = ffj(".question_holder:visible")
questions.length.should == @question_count
click_settings_tab
@ -115,10 +115,9 @@ shared_examples_for "quizzes selenium tests" do
expect_new_page_load {
f('.new-quiz-link').click
}
click_questions_tab
click_new_question_button
wait_for_animations
wait_for_ajaximations
Quiz.last
end
@ -138,10 +137,16 @@ shared_examples_for "quizzes selenium tests" do
driver.switch_to.alert.accept
end
def set_feedback_content(el, text)
el.find_element(:css, ".comment_focus").click
el.find_element(:css, "textarea").should be_displayed
el.find_element(:css, "textarea").send_keys(text)
def set_answer_comment(answer_num, text)
driver.execute_script("$('.question_form:visible .form_answers .answer:eq(#{answer_num}) .comment_focus').click()")
wait_for_ajaximations
driver.execute_script("$('.question_form:visible .form_answers .answer:eq(#{answer_num}) .answer_comment_box').val('#{text}')\;")
end
def set_question_comment(selector, text)
driver.execute_script("$('.question_form:visible #{selector} .comment_focus').click()")
wait_for_ajaximations
driver.execute_script("$('.question_form:visible #{selector} .comments').val('#{text}')\;")
end
def hover_first_question
@ -334,6 +339,4 @@ shared_examples_for "quizzes selenium tests" do
target = "#group_top_#{group_id} + *"
js_drag_and_drop source, target
end
end

View File

@ -271,28 +271,30 @@ describe "manage groups students" do
it "should add multiple groups and be sure they are all deleted" do
add_groups_in_category @courses_group_category
get "/courses/#{@course.id}/groups"
delete = f(".delete_category_link")
delete.click
driver.execute_script("$('.delete_category_link').click()")
confirm_dialog = driver.switch_to.alert
confirm_dialog.accept
wait_for_ajaximations
ff(".left_side .group").should be_empty
@course.group_categories.all.count.should == 0
end
it "should edit an individual group" do
get "/courses/#{@course.id}/groups"
group = add_group_to_category @courses_group_category, "group 1"
group = add_group_to_category(@courses_group_category, "group 1")
group.should_not be_nil
f("#group_#{group.id}").click
wait_for_ajaximations
f("#group_#{group.id} .edit_group_link").click
wait_for_ajaximations
name = "new group 1"
f("#group_name").send_keys(name)
submit_form("#edit_group_form")
wait_for_ajaximations
new_group = @course.groups.find_by_name(name)
group = @course.groups.find_by_name(name)
group.should_not be_nil
end
it "should delete an individual group" do
get "/courses/#{@course.id}/groups"
group = add_group_to_category @courses_group_category, "group 1"

2
spec/selenium/people_spec.rb Normal file → Executable file
View File

@ -99,7 +99,9 @@ describe "people" do
it "should add a teacher, ta, student, and observer" do
expect_new_page_load { driver.find_element(:link, 'Manage Users').click }
wait_for_ajaximations
add_users_button = f('.add_users_link')
wait_for_ajaximations
add_users_button.click
add_user('Teachers', @test_teacher.name, 'ul.user_list.teacher_enrollments')
add_user("Students", @student_2.name, 'ul.user_list.student_enrollments')

View File

@ -13,12 +13,15 @@ describe "question bank" do
keep_trying_until do
ffj('.display_question:visible').length.should == 60
driver.execute_script("$('.display_question .links a').css('left', '0')")
wait_for_ajaximations
driver.execute_script("window.confirm = function(msg) { return true; };")
wait_for_ajaximations
fj(".display_question:visible:last .delete_question_link").click
wait_for_ajaximations
ffj('.display_question:visible').length.should == 59
end
@bank.reload
wait_for_ajaximations
@bank.assessment_questions.select { |aq| !aq.deleted? }.length.should == 59
end
end

View File

@ -54,6 +54,7 @@ describe "One Question at a Time Quizzes" do
fj("a:contains('OQAAT quiz')").click
wait_for_ajaximations
fj("a:contains('Resume Quiz')").click
wait_for_ajaximations
end
def navigate_directly_to_first_question
@ -72,6 +73,7 @@ describe "One Question at a Time Quizzes" do
expect_new_page_load {
fj("button:contains('Begin'):visible").click
}
wait_for_ajaximations
end
def it_should_be_on_first_question
@ -105,7 +107,7 @@ describe "One Question at a Time Quizzes" do
expect_new_page_load {
fj("#question_list a:contains('Question 1')").click
}
wait_for_ajaximations
it_should_be_on_first_question
end
@ -113,12 +115,14 @@ describe "One Question at a Time Quizzes" do
expect_new_page_load {
fj("button:contains('Next')").click
}
wait_for_ajaximations
end
def click_previous_button
expect_new_page_load {
fj("button:contains('Previous')").click
}
wait_for_ajaximations
end
def it_should_not_show_previous_button
@ -159,10 +163,12 @@ describe "One Question at a Time Quizzes" do
def answer_the_question_correctly
fj(".answers label:contains('A')").click
wait_for_ajaximations
end
def answer_the_question_incorrectly
fj(".answers label:contains('B')").click
wait_for_ajaximations
end
def it_should_show_two_correct_answers

View File

@ -12,8 +12,7 @@ describe "quizzes question banks" do
get "/courses/#{@course.id}/question_banks/#{bank.id}"
f('.add_question_link').click
wait_for_animations
wait_for_ajaximations
expect { create_multiple_choice_question }.to change(AssessmentQuestion, :count).by(1)
end
@ -29,6 +28,7 @@ describe "quizzes question banks" do
click_questions_tab
keep_trying_until {
find_questions_link.click
wait_for_ajaximations
f(".select_all_link")
}.click
submit_dialog("div#find_question_dialog", '.submit_button')
@ -47,13 +47,14 @@ describe "quizzes question banks" do
get "/courses/#{@course.id}/quizzes/#{quiz.id}/edit"
click_questions_tab
keep_trying_until {
keep_trying_until do
f('.find_question_link').click
f('#find_question_dialog').should be_displayed
wait_for_ajaximations
f('#find_question_dialog').should be_displayed
f(".select_all_link").should be_displayed
}
end
f(".select_all_link").click
wait_for_ajaximations
submit_dialog("div#find_question_dialog", '.submit_button')
wait_for_ajaximations
click_settings_tab
@ -61,6 +62,7 @@ describe "quizzes question banks" do
click_questions_tab
f(".add_question_group_link").click
wait_for_ajaximations
f('.find_bank_link').click
keep_trying_until {
fj("#find_bank_dialog .bank:visible")
@ -83,13 +85,15 @@ describe "quizzes question banks" do
get "/courses/#{@course.id}/quizzes/#{quiz.id}/edit"
click_questions_tab
keep_trying_until {
keep_trying_until do
f('.find_question_link').click
wait_for_ajaximations
f('#find_question_dialog').should be_displayed
wait_for_ajaximations
f(".select_all_link").should be_displayed
}
end
f(".select_all_link").click
wait_for_ajaximations
submit_dialog("#find_question_dialog", '.submit_button')
wait_for_ajaximations
click_settings_tab
@ -97,7 +101,9 @@ describe "quizzes question banks" do
click_questions_tab
f(".add_question_group_link").click
wait_for_ajaximations
f(".find_bank_link").click
wait_for_ajaximations
keep_trying_until {
fj("#find_bank_dialog .bank:visible")
}.click
@ -123,19 +129,20 @@ describe "quizzes question banks" do
get "/courses/#{@course.id}/quizzes/#{quiz.id}/edit"
click_questions_tab
keep_trying_until {
keep_trying_until do
f('.find_question_link').click
f('#find_question_dialog').should be_displayed
wait_for_ajaximations
f('#find_question_dialog').should be_displayed
f(".select_all_link").should be_displayed
}
end
ffj("#find_question_dialog .bank:visible").size.should == 1
close_visible_dialog
keep_trying_until {
keep_trying_until do
f('.add_question_group_link').click
wait_for_ajaximations
f('.find_bank_link').should be_displayed
}
end
f(".find_bank_link").click
wait_for_ajaximations
ffj("#find_bank_dialog .bank:visible").size.should == 1
@ -146,6 +153,7 @@ describe "quizzes question banks" do
click_questions_tab
f('.add_question_group_link').click
wait_for_ajaximations
group_form = f('#group_top_new .quiz_group_form')
group_form.find_element(:name, 'quiz_group[name]').send_keys('new group')
replace_content(group_form.find_element(:name, 'quiz_group[question_points]'), '2')

View File

@ -28,7 +28,7 @@ describe "quizzes question creation" do
question_data[:question_type].should == "multiple_choice_question"
question_data[:correct_comments].should == "Good job on the question!"
question_data[:incorrect_comments].should == "You know what they say - study long study wrong."
question_data[:neutral_comments].should == "Pass or fail, you're a winner!"
question_data[:neutral_comments].should == "Pass or fail you are a winner!"
end

View File

@ -34,30 +34,37 @@ describe "student interactions report" do
ths = ff(".report th")
trs = ff(".report tbody tr")
ths[0].click
wait_for_ajaximations
ths[0].should have_class("headerSortDown")
ff(".report tbody tr").should == [trs[0], trs[1]]
ths[0].click
wait_for_ajaximations
ths[0].should have_class("headerSortUp")
ff(".report tbody tr").should == [trs[1], trs[0]]
ths[2].click
wait_for_ajaximations
ths[2].should have_class("headerSortDown")
ff(".report tbody tr").should == [trs[0], trs[1]]
ths[2].click
wait_for_ajaximations
ths[2].should have_class("headerSortUp")
ff(".report tbody tr").should == [trs[1], trs[0]]
ths[3].click
wait_for_ajaximations
ths[3].should have_class("headerSortDown")
ff(".report tbody tr").should == [trs[0], trs[1]]
ths[3].click
wait_for_ajaximations
ths[3].should have_class("headerSortUp")
ff(".report tbody tr").should == [trs[1], trs[0]]
ths[5].click
wait_for_ajaximations
ths[5].should_not have_class("header")
end
end

View File

@ -11,6 +11,7 @@ describe "scheduler" do
before (:each) do
#set_native_events("false")
course_with_student_logged_in
make_full_screen
end
#after(:all) do

View File

@ -125,19 +125,21 @@ describe "submissions" do
@assignment.update_attributes(:submission_types => "online_text_entry")
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
f('.submit_assignment_link').click
wait_for_ajaximations
assignment_form = f('#submit_online_text_entry_form')
wait_for_tiny(assignment_form)
submit_form(assignment_form)
wait_for_ajaximations
# it should not actually submit and pop up an error message
f('.error_box').should be_displayed
Submission.count.should == 0
# now make sure it works
expect {
type_in_tiny('#submission_body', 'now it is not blank')
submit_form(assignment_form)
}.to change(Submission, :count).by(1)
type_in_tiny('#submission_body', 'now it is not blank')
submit_form(assignment_form)
wait_for_ajaximations
Submission.count.should == 1
end
it "should not allow a submission with only comments" do

View File

@ -183,6 +183,7 @@ describe "quizzes questions" do
start_quiz_question
question = fj(".question_form:visible")
click_option('.question_form:visible .question_type', 'Numerical Answer')
wait_for_ajaximations
type_in_tiny '.question:visible textarea.question_content', 'This is a numerical question.'
@ -193,11 +194,20 @@ describe "quizzes questions" do
JS
answers[0].find_element(:name, 'answer_error_margin').send_keys('0')
submit_form(question)
wait_for_ajax_requests
wait_for_ajaximations
expect_new_page_load { f('.save_quiz_button').click }
expect_new_page_load { f('.publish_quiz_button').click }
expect_new_page_load { driver.find_element(:link, 'Take the Quiz').click }
expect_new_page_load do
f('.save_quiz_button').click
wait_for_ajaximations
end
expect_new_page_load do
f('.publish_quiz_button').click
wait_for_ajaximations
end
expect_new_page_load do
driver.find_element(:link, 'Take the Quiz').click
wait_for_ajaximations
end
input = f('input[type=text]')
input.click

View File

@ -31,18 +31,19 @@ describe "quizzes" do
it "should allow a teacher to create a quiz from the quizzes tab directly" do
get "/courses/#{@course.id}/quizzes"
expect_new_page_load { f(".new-quiz-link").click }
expect_new_page_load {
click_save_settings_button
expect_new_page_load do
click_save_settings_button
wait_for_ajax_requests
}
end
f('#quiz_title').should include_text "Unnamed Quiz"
end
it "should create and preview a new quiz" do
get "/courses/#{@course.id}/quizzes"
expect_new_page_load {
expect_new_page_load do
f('.new-quiz-link').click
}
wait_for_ajaximations
end
#check url
driver.current_url.should match %r{/courses/\d+/quizzes/(\d+)\/edit}
driver.current_url =~ %r{/courses/\d+/quizzes/(\d+)\/edit}
@ -62,14 +63,14 @@ describe "quizzes" do
click_questions_tab
click_new_question_button
submit_form('.question_form')
wait_for_ajax_requests
wait_for_ajaximations
#save the quiz
expect_new_page_load {
click_save_settings_button
wait_for_ajax_requests
expect_new_page_load {
click_save_settings_button
wait_for_ajaximations
}
wait_for_ajax_requests
wait_for_ajaximations
#check quiz preview
f('#preview_quiz_button').click
@ -103,7 +104,7 @@ describe "quizzes" do
q.save!
get "/courses/#{@course.id}/quizzes/#{q.id}/edit"
wait_for_ajax_requests
wait_for_ajaximations
test_text = "changed description"
keep_trying_until { f('#quiz_description_ifr').should be_displayed }
@ -112,7 +113,7 @@ describe "quizzes" do
f('#tinymce').text.include?(test_text).should be_true
end
click_save_settings_button
wait_for_ajax_requests
wait_for_ajaximations
get "/courses/#{@course.id}/quizzes/#{q.id}"
@ -267,10 +268,10 @@ describe "quizzes" do
it "should flag a quiz question while taking a quiz as a teacher" do
quiz_with_new_questions
expect_new_page_load {
click_save_settings_button
expect_new_page_load do
click_save_settings_button
wait_for_ajax_requests
}
end
f('.publish_quiz_button').click
wait_for_ajax_requests
@ -318,14 +319,14 @@ describe "quizzes" do
input.click
input.send_keys('asdf')
wait_for_ajaximations
error_displayed?.should be_true
input.send_keys(:tab)
keep_trying_until { !error_displayed? }
# gets cleared out since it's not valid
input[:value].should be_blank
input.click
input.send_keys('1')
wait_for_ajaximations
error_displayed?.should be_false
input.send_keys(:tab)
input.should have_attribute(:value, "1.0000")
@ -532,7 +533,6 @@ describe "quizzes" do
it "should delete a quiz" do
quiz_with_submission
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
expect_new_page_load do
f('.al-trigger').click
f('.delete_quiz_link').click
@ -549,10 +549,10 @@ describe "quizzes" do
wait_for_ajaximations
fill_assignment_overrides
replace_content(f('#quiz_title'), 'VDD Quiz')
expect_new_page_load {
click_save_settings_button
expect_new_page_load do
click_save_settings_button
wait_for_ajax_requests
}
end
compare_assignment_times(Quiz.find_by_title('VDD Quiz'))
end
@ -575,25 +575,25 @@ describe "quizzes" do
select_first_override_section(default_section.name)
first_due_at_element.clear
first_due_at_element.
send_keys(default_section_due.strftime('%b %-d, %y'))
send_keys(default_section_due.strftime('%b %-d, %y'))
add_override
select_last_override_section(other_section.name)
last_due_at_element.
send_keys(other_section_due.strftime('%b %-d, %y'))
expect_new_page_load {
click_save_settings_button
send_keys(other_section_due.strftime('%b %-d, %y'))
expect_new_page_load do
click_save_settings_button
wait_for_ajax_requests
}
end
overrides = @quiz.reload.assignment_overrides
overrides.count.should == 2
default_override = overrides.detect{ |o| o.set_id == default_section.id }
default_override = overrides.detect { |o| o.set_id == default_section.id }
default_override.due_at.strftime('%b %-d, %y').
should == default_section_due.to_date.strftime('%b %-d, %y')
other_override = overrides.detect{ |o| o.set_id == other_section.id }
should == default_section_due.to_date.strftime('%b %-d, %y')
other_override = overrides.detect { |o| o.set_id == other_section.id }
other_override.due_at.strftime('%b %-d, %y').
should == other_section_due.to_date.strftime('%b %-d, %y')
should == other_section_due.to_date.strftime('%b %-d, %y')
end
end
end

View File

@ -29,7 +29,7 @@ describe "quizzes students" do
f("#question_#{q[:id]}_answer_#{q[:answers][0][:id]}").click
f("#submit_quiz_button").click
wait_for_ajaximations
quiz_sub = @fake_student.reload.submissions.find_by_assignment_id(quiz.assignment.id)
quiz_sub.should be_present
quiz_sub.workflow_state.should == "graded"

View File

@ -87,10 +87,13 @@ describe "course rubrics" do
get "/courses/#{@course.id}/rubrics/#{@rubric.id}"
f('.edit_rubric_link').click
wait_for_ajaximations
f('.rubric.editing tr.criterion .delete_criterion_link').click
wait_for_ajaximations
f('.rubric.editing .find_outcome_link').click
wait_for_ajaximations
f('.outcome-link').click
wait_for_ajax_requests
wait_for_ajaximations
f('.ui-dialog .btn-primary').click
accept_alert
wait_for_ajaximations
@ -98,7 +101,7 @@ describe "course rubrics" do
ff('tr.learning_outcome_criterion td.rating .description').map(&:text).should == @outcome.data[:rubric_criterion][:ratings].map { |c| c[:description] }
ff('tr.learning_outcome_criterion td.rating .points').map(&:text).should == @outcome.data[:rubric_criterion][:ratings].map { |c| c[:points].to_s }
submit_form('#edit_rubric_form')
wait_for_ajax_requests
wait_for_ajaximations
rubric = Rubric.last(:order => :id)
rubric.data.first[:ratings].map { |r| r[:description] }.should == @outcome.data[:rubric_criterion][:ratings].map { |c| c[:description] }
rubric.data.first[:ratings].map { |r| r[:points] }.should == @outcome.data[:rubric_criterion][:ratings].map { |c| c[:points] }

View File

@ -13,10 +13,6 @@ describe "scheduler" do
make_full_screen
end
#after(:all) do
# set_native_events("false")
#end
def open_edit_appointment_slot_dialog
fj('.fc-event').click
driver.execute_script("$('.edit_event_link').trigger('click')")

4
spec/selenium/teacher_user_lists_spec.rb Normal file → Executable file
View File

@ -20,10 +20,11 @@ describe "user" do
eolist
if (ff('#enrollment_type').length > 0)
click_option("#enrollment_type", enrollment_type, :value)
wait_for_ajaximations
end
f("textarea.user_list").send_keys(user_list)
f("button.verify_syntax_button").click
wait_for_ajax_requests
wait_for_ajaximations
f("button.add_users_button").click
wait_for_ajaximations
unique_ids = ["user1@example.com", "bob@thesagatfamily.name", "A124123"]
@ -65,6 +66,7 @@ eolist
course_with_teacher_logged_in(:active_all => true)
get "/courses/#{@course.id}/details"
f("#tab-users-link").click
wait_for_ajaximations
f("#tab-users a.add_users_link").click
end

View File

@ -80,7 +80,7 @@ describe "Wiki pages and Tiny WYSIWYG editor" do
click_option("#wiki_page_editing_roles", permission)
#form id is set like this because the id iterator is in the form but im not sure how to grab it directly before committed to the DB with the save
submit_form("#edit_wiki_page_#{p.id + 1}")
wait_for_ajaximations
@course.wiki.wiki_pages.last.editing_roles.should == validations[i]
end
end

View File

@ -255,7 +255,6 @@ describe "Wiki pages and Tiny WYSIWYG editor features" do
equation_text = '\\text{yay math stuff:}\\:\\frac{d}{dx}\\sqrt{x}=\\frac{d}{dx}x^{\\frac{1}{2}}=\\frac{1}{2}x^{-\\frac{1}{2}}=\\frac{1}{2\\sqrt{x}}\\text{that. is. so. cool.}'
get "/courses/#{@course.id}/wiki"
f('#wiki_page_body_instructure_equation').click
wait_for_animations
f('.mathquill-editor').should be_displayed
@ -264,7 +263,7 @@ describe "Wiki pages and Tiny WYSIWYG editor features" do
textarea.send_keys(:backspace)
end
# "paste" some latex
# "paste" some text
driver.execute_script "$('.mathquill-editor .textarea textarea').val('\\\\text{yay math stuff:}\\\\:\\\\frac{d}{dx}\\\\sqrt{x}=').trigger('paste')"
# make sure it renders correctly (inclding the medium space)
f('.mathquill-editor').text.should include "yay math stuff: \nd\n\dx\n"
@ -275,14 +274,15 @@ describe "Wiki pages and Tiny WYSIWYG editor features" do
textarea.send_keys "x^1/2"
textarea.send_keys :arrow_right
textarea.send_keys :arrow_right
f('.mathquill-editor .mathquill-toolbar a[title="="]').click
textarea.send_keys "="
textarea.send_keys "1/2"
textarea.send_keys :arrow_right
textarea.send_keys "x^-1/2"
textarea.send_keys :arrow_right
textarea.send_keys :arrow_right
textarea.send_keys "=1/2"
f('.mathquill-editor .mathquill-toolbar a[title="\\\\sqrt"]').click
textarea.send_keys "\\sqrt"
textarea.send_keys :space
textarea.send_keys "x"
textarea.send_keys :arrow_right
textarea.send_keys :arrow_right

View File

@ -15,6 +15,7 @@ describe "users" do
get "/users/#{@user.id}"
pseudonym_form = f('#edit_pseudonym_form')
f(".add_pseudonym_link").click
wait_for_ajaximations
pseudonym_form.find_element(:css, "#pseudonym_unique_id").send_keys('new_user')
pseudonym_form.find_element(:css, "#pseudonym_password").send_keys('qwerty1')
pseudonym_form.find_element(:css, "#pseudonym_password_confirmation").send_keys('qwerty1')
@ -139,7 +140,7 @@ describe "users" do
user_names[0].should include_text(@student_2.name)
user_names[1].should include_text(@student_1.name)
f('#switch_user_positions').click
wait_for_ajax_requests
wait_for_ajaximations
user_names = ff('.result td')
user_names[0].should include_text(@student_1.name)
user_names[1].should include_text(@student_2.name)
@ -153,7 +154,9 @@ describe "users" do
it "should cancel a merge and validate both users still exist" do
setup_user_merge(@student_2, @student_1)
expect_new_page_load { f('#prepare_to_merge').click }
wait_for_ajaximations
expect_new_page_load { f('.button-secondary').click }
wait_for_ajaximations
f('#courses_menu_item').should be_displayed
@student_1.workflow_state.should == 'registered'
@student_2.workflow_state.should == 'registered'
@ -164,6 +167,7 @@ describe "users" do
f('.static_message').should be_false
f('#manual_user_id').send_keys(@student_1.id)
expect_new_page_load { f('button[type="submit"]').click }
wait_for_ajaximations
f('.static_message').text.should =~ /You can't merge an account with itself./
end
@ -172,6 +176,7 @@ describe "users" do
f('.static_message').should be_false
f('#manual_user_id').send_keys("azxcvbytre34567uijmm23456yhj")
expect_new_page_load { f('button[type="submit"]').click }
wait_for_ajaximations
f('.static_message').text.should =~ /No active user with that ID was found./
end
@ -205,6 +210,7 @@ describe "users" do
f('#student_password').send_keys('asdfasdf')
f('#student_password_confirmation').send_keys('asdfasdf')
form.find_element(:css, 'input[name="user[terms_of_use]"]').click
wait_for_ajaximations
expect_new_page_load { form.submit }
# confirm the user is authenticated into the dashboard
@ -215,12 +221,14 @@ describe "users" do
it "should register a student without a join code" do
get '/register'
f('#signup_student').click
wait_for_ajaximations
f('.registration-dialog .signup_link').click
wait_for_ajaximations
form = fj('.ui-dialog:visible form')
f('#student_higher_ed_name').send_keys('student!')
f('#student_higher_ed_email').send_keys('student@example.com')
wait_for_ajaximations
form.find_element(:css, 'input[name="user[terms_of_use]"]').click
expect_new_page_load { form.submit }
@ -232,11 +240,13 @@ describe "users" do
it "should register a teacher" do
get '/register'
f('#signup_teacher').click
wait_for_ajaximations
form = fj('.ui-dialog:visible form')
f('#teacher_name').send_keys('teacher!')
f('#teacher_email').send_keys('teacher@example.com')
form.find_element(:css, 'input[name="user[terms_of_use]"]').click
wait_for_ajaximations
expect_new_page_load { form.submit }
# confirm the user is authenticated into the dashboard
@ -249,6 +259,7 @@ describe "users" do
get '/register'
f('#signup_parent').click
wait_for_ajaximations
form = fj('.ui-dialog:visible form')
f('#parent_name').send_keys('parent!')
@ -256,6 +267,7 @@ describe "users" do
f('#parent_child_username').send_keys(@pseudonym.unique_id)
f('#parent_child_password').send_keys('lolwut')
form.find_element(:css, 'input[name="user[terms_of_use]"]').click
wait_for_ajaximations
expect_new_page_load { form.submit }
# confirm the user is authenticated into the dashboard