spec: add modules to selenium helper files

Test Plan:
 - Pass Jenkins

Change-Id: I4cff1ce650f1b4ef2eb8b515f641c8fcaa0dacd1
Reviewed-on: https://gerrit.instructure.com/67174
Tested-by: Jenkins
Reviewed-by: Pedro Fajardo <pfajardo@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Robert Lamb <rlamb@instructure.com>
Product-Review: Robert Lamb <rlamb@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
This commit is contained in:
Michael Hargiss 2015-11-13 16:41:06 -07:00 committed by Robert Lamb
parent 85c1a75c8b
commit 2e4a5a798e
83 changed files with 1761 additions and 1641 deletions

View File

@ -5,11 +5,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/outcome_common')
describe "account admin outcomes" do
include_context "in-process server selenium tests"
include OutcomeCommon
let(:outcome_url) { "/accounts/#{Account.default.id}/outcomes" }
let(:who_to_login) { 'admin' }
let(:account) { Account.default }
describe "course outcomes" do
before (:each) do
before(:each) do
RoleOverride.create!(:context => account, :permission => 'manage_courses',
:role => admin_role, :enabled => false) # should not manage_courses permission
course_with_admin_logged_in

View File

@ -3,11 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/grading_schemes_c
describe "account admin grading schemes" do
include_context "in-process server selenium tests"
include GradingSchemesCommon
let(:account) { Account.default }
let(:url) { "/accounts/#{Account.default.id}/grading_standards" }
before (:each) do
before(:each) do
course_with_admin_logged_in
get url
end
@ -31,7 +32,7 @@ describe "account admin grading schemes" do
describe "grading scheme items" do
before (:each) do
before(:each) do
create_simple_standard_and_edit(account, url)
end
@ -63,6 +64,7 @@ end
describe "course grading schemes as account admin" do
include_context "in-process server selenium tests"
include GradingSchemesCommon
before(:once) do
course_with_admin_logged_in

View File

@ -3,6 +3,7 @@ require 'thread'
describe "account admin manage groups" do
include_context "in-process server selenium tests"
include ManageGroupsCommon
def add_account_category (account, name)
f(".add_category_link").click
@ -15,7 +16,7 @@ describe "account admin manage groups" do
category
end
before (:each) do
before(:each) do
skip
#course_with_admin_logged_in
#@admin_account = Account.default
@ -45,7 +46,7 @@ describe "account admin manage groups" do
end
context "single category" do
before (:each) do
before(:each) do
@courses_group_category = @admin_account.group_categories.create(:name => "Existing Category")
groups_student_enrollment 1
end

View File

@ -3,12 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/rubrics_common')
describe "account shared rubric specs" do
include_context "in-process server selenium tests"
include RubricsCommon
let(:rubric_url) { "/accounts/#{Account.default.id}/rubrics" }
let(:who_to_login) { 'admin' }
let(:account) { Account.default }
before (:each) do
before(:each) do
resize_screen_to_normal
course_with_admin_logged_in
end
@ -24,7 +25,6 @@ describe "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

View File

@ -5,6 +5,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/outcome_common')
describe "account admin outcomes" do
include_examples "in-process server selenium tests"
include OutcomeCommon
let(:outcome_url) { "/accounts/#{Account.default.id}/outcomes" }
let(:who_to_login) { 'admin' }
let(:account) { Account.default }

View File

@ -1,9 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/shared_user_methods')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/users_common')
require File.expand_path(File.dirname(__FILE__) + '/../helpers/basic/users_specs')
describe "admin courses tab" do
include_context "in-process server selenium tests"
include UsersCommon
context "add user basic" do
describe "shared users specs" do
@ -16,7 +17,7 @@ describe "admin courses tab" do
context "add users" do
before (:each) do
before(:each) do
course_with_admin_logged_in
get "/accounts/#{Account.default.id}/users"
end

View File

@ -3,11 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../helpers/grading_scheme
describe "sub account grading schemes" do
include_context "in-process server selenium tests"
include GradingSchemesCommon
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:url) { "/accounts/#{account.id}/grading_standards" }
before (:each) do
before(:each) do
course_with_admin_logged_in
get url
end
@ -36,7 +37,7 @@ describe "sub account grading schemes" do
end
it 'should disable other grading schemes from being edited', priority: "2", test_id: 307626 do
2.times do
2.times do
simple_grading_standard(account)
end
get url
@ -45,7 +46,7 @@ describe "sub account grading schemes" do
end
it 'should allow all available grading schemes to be edited on page load', priority: "2", test_id: 310145 do
2.times do
2.times do
simple_grading_standard(account)
end
get url

View File

@ -3,13 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../../helpers/outcome_common
describe "sub account outcomes" do
include_context "in-process server selenium tests"
include OutcomeCommon
describe "account outcome specs" do
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:outcome_url) { "/accounts/#{account.id}/outcomes" }
let(:who_to_login) { 'admin' }
before (:each) do
before(:each) do
course_with_admin_logged_in
end

View File

@ -3,11 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../helpers/rubrics_common
describe "sub account shared rubric specs" do
include_context "in-process server selenium tests"
include RubricsCommon
let(:account) { Account.create(:name => 'sub account from default account', :parent_account => Account.default) }
let(:rubric_url) { "/accounts/#{account.id}/rubrics" }
let(:who_to_login) { 'admin' }
before (:each) do
before(:each) do
resize_screen_to_normal
course_with_admin_logged_in
end

View File

@ -6,6 +6,7 @@ describe "discussion assignments" do
include_context "in-process server selenium tests"
include DiscussionsCommon
include FilesCommon
include AssignmentsCommon
before(:each) do
@domain_root_account = Account.default

View File

@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe "assignments" do
include_context "in-process server selenium tests"
include AssignmentsCommon
def point_validation
assignment_name = 'first test assignment'

View File

@ -3,12 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe "assignment groups" do
include_context "in-process server selenium tests"
include AssignmentsCommon
def get_assignment_groups
ff('.assignment_group')
end
before (:each) do
before(:each) do
@domain_root_account = Account.default
course_with_teacher_logged_in
@course.require_assignment_group
@ -231,7 +232,7 @@ describe "assignment groups" do
a = ag.reload.assignments.last
expect(a.name).to eq "Do this"
expect(a.due_at).to eq time
expect(a.points_possible).to eq 13
expect(a.points_possible).to eq 13
# Checks Assignments Index page UI for correct values.
expect(ff("#assignment_group_#{ag.id} .ig-title").last.text).to match "#{assignment_name}"

View File

@ -8,6 +8,8 @@ describe 'assignments' do
include_context 'in-process server selenium tests'
include QuizzesCommon
include FilesCommon
include AssignmentsCommon
include SubmissionsCommon
before do
course_with_teacher_logged_in

View File

@ -2,9 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe "quizzes assignments" do
include_context "in-process server selenium tests"
include AssignmentsCommon
before (:each) do
before(:each) do
@domain_root_account = Account.default
course_with_teacher_logged_in
end

View File

@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/rubrics_common')
describe "assignment rubrics" do
include_context "in-process server selenium tests"
include RubricsCommon
context "assignment rubrics as a teacher" do
before(:each) do

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/public_courses_context')
require File.expand_path(File.dirname(__FILE__) + '/helpers/files_common')
@ -6,6 +6,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/files_common')
describe "assignments" do
include_context "in-process server selenium tests"
include FilesCommon
include AssignmentsCommon
# note: due date testing can be found in assignments_overrides_spec

View File

@ -3,9 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe "assignments" do
include_context "in-process server selenium tests"
include AssignmentsCommon
context "as observer" do
before :each do
before(:each) do
@course = course(:active_all => true)
@student = user(:active_all => true, :active_state => 'active')
@observer = user(:active_all => true, :active_state => 'active')
@ -18,7 +19,7 @@ describe "assignments" do
end
context "when not linked to student" do
before :each do
before(:each) do
@course.enroll_user(@observer, 'ObserverEnrollment', :section => @section2, :enrollment_state => 'active')
end
@ -44,7 +45,7 @@ describe "assignments" do
end
context "when linked to student" do
before :each do
before(:each) do
@student_enrollment = @course.enroll_user(@student, 'StudentEnrollment', :enrollment_state => 'active', :section => @section2)
@observer_enrollment = @course.enroll_user(@observer, 'ObserverEnrollment', :enrollment_state => 'active', :section => @section2)
@observer_enrollment.update_attribute(:associated_user_id, @student.id)
@ -59,7 +60,7 @@ describe "assignments" do
end
context "overridden lock_at" do
before :each do
before(:each) do
setup_sections_and_overrides_all_future
@course.enroll_user(@student, 'StudentEnrollment', :section => @section2, :enrollment_state => 'active')
end

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/google_drive_common'
describe "assignments" do
include_context "in-process server selenium tests"
include GoogleDriveCommon
include AssignmentsCommon
context "as a student" do

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe 'submissions' do
include_context 'in-process server selenium tests'
include FilesCommon
include AssignmentsCommon
context 'create assignment as a teacher' do
before do

View File

@ -7,6 +7,7 @@ describe "submissions" do
include_context "in-process server selenium tests"
include FilesCommon
include Gradebook2Common
include SubmissionsCommon
context 'as a student' do

View File

@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe 'submissions' do
include_context 'in-process server selenium tests'
include AssignmentsCommon
before do
course_with_teacher_logged_in

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/submissions_common')
describe "submissions" do
include_context "in-process server selenium tests"
include FilesCommon
include SubmissionsCommon
context 'as a teacher' do

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/scheduler_common'
describe "scheduler" do
include_context "in-process server selenium tests"
include Calendar2Common
include SchedulerCommon
context "as a student" do

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/scheduler_common'
describe "scheduler" do
include_context "in-process server selenium tests"
include Calendar2Common
include SchedulerCommon
context "as a teacher" do

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/scheduler_common'
describe "scheduler" do
include_context "in-process server selenium tests"
include Calendar2Common
include SchedulerCommon
context "as a teacher" do

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/differentiated_as
describe "interaction with differentiated assignments" do
include_context "in-process server selenium tests"
include DifferentiatedAssignments
include AssignmentsCommon
context "Student" do
before :each do

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/differentiated_as
describe "interaction with differentiated assignments on the dashboard and calendar" do
include_context "in-process server selenium tests"
include DifferentiatedAssignments
include AssignmentsCommon
context "Student" do
before :each do

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/differentiated_as
describe "interaction with differentiated discussions" do
include_context "in-process server selenium tests"
include DifferentiatedAssignments
include AssignmentsCommon
context "Student" do
before :each do

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/differentiated_as
describe "interaction with differentiated assignments/quizzes/discusssions in modules" do
include_context "in-process server selenium tests"
include DifferentiatedAssignments
include AssignmentsCommon
def expect_module_to_have_items(module_item)
expect(f("#context_module_#{module_item.id}")).to include_text(@da_assignment.title)

View File

@ -4,9 +4,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/differentiated_as
describe "interaction with differentiated quizzes" do
include_context "in-process server selenium tests"
include DifferentiatedAssignments
include AssignmentsCommon
context "Student" do
before :each do
before(:each) do
course_with_student_logged_in
da_setup
@da_quiz = create_da_quiz
@ -97,7 +98,7 @@ describe "interaction with differentiated quizzes" do
end
end
context "Observer with student" do
before :each do
before(:each) do
observer_setup
da_setup
@da_quiz = create_da_quiz

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/discussions_common')
describe "discussion assignments" do
include_context "in-process server selenium tests"
include DiscussionsCommon
include AssignmentsCommon
before :once do
course_with_teacher(:active_all => true)

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/discussions_commo
describe "discussion availability" do
include_examples "in-process server selenium tests"
include DiscussionsCommon
include AssignmentsCommon
before :each do
course_with_teacher_logged_in.course

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/groups_common')
describe 'Excuse an Assignment' do
include_context "in-process server selenium tests"
include Gradebook2Common
include GroupsCommon
before do |example|
unless example.metadata[:group]

View File

@ -4,6 +4,7 @@ require_relative '../../helpers/groups_common'
describe "gradebook2" do
include_context "in-process server selenium tests"
include Gradebook2Common
include GroupsCommon
describe "multiple grading periods" do
let!(:enable_mgp) do

View File

@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/grading_schemes_comm
describe "grading standards" do
include_context "in-process server selenium tests"
include GradingSchemesCommon
context "without Multiple Grading Periods" do

View File

@ -14,6 +14,8 @@ describe "groups" do
include CourseCommon
include DiscussionsCommon
include FilesCommon
include GroupsCommon
include WikiAndTinyCommon
setup_group_page_urls

View File

@ -14,6 +14,8 @@ describe "groups" do
include CourseCommon
include DiscussionsCommon
include FilesCommon
include GroupsCommon
include WikiAndTinyCommon
setup_group_page_urls

View File

@ -3,6 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/groups_common')
describe "student groups" do
include_context "in-process server selenium tests"
include GroupsCommon
let(:group_name){ 'Windfury' }
let(:group_category_name){ 'cat1' }

View File

@ -3,6 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/groups_common')
describe "student groups" do
include_context "in-process server selenium tests"
include GroupsCommon
let(:group_name){ 'Windfury' }
let(:group_category_name){ 'cat1' }

View File

@ -3,9 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/groups_common')
describe "new groups" do
include_context "in-process server selenium tests"
include GroupsCommon
context "as a teacher" do
before (:each) do
before(:each) do
course_with_teacher_logged_in
end

View File

@ -1,211 +1,224 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/groups_common')
def build_assignment_with_type(type, opts={})
if opts[:assignment_group_id]
assignment_group_id = opts[:assignment_group_id]
else
assignment_group = @course.assignment_groups.first!
assignment_group_id = assignment_group.id
module AssignmentsCommon
include GroupsCommon
def build_assignment_with_type(type, opts={})
if opts[:assignment_group_id]
assignment_group_id = opts[:assignment_group_id]
else
assignment_group = @course.assignment_groups.first!
assignment_group_id = assignment_group.id
end
f("#assignment_group_#{assignment_group_id} .add_assignment").click
click_option(f("#ag_#{assignment_group_id}_assignment_type"), type)
if opts[:name]
f("#ag_#{assignment_group_id}_assignment_name").clear
f("#ag_#{assignment_group_id}_assignment_name").send_keys opts[:name]
end
if opts[:points]
f("#ag_#{assignment_group_id}_assignment_points").clear
f("#ag_#{assignment_group_id}_assignment_points").send_keys opts[:points]
end
if opts[:due_at]
f("#ag_#{assignment_group_id}_assignment_due_at").clear
f("#ag_#{assignment_group_id}_assignment_due_at").send_keys opts[:due_at]
end
if opts[:submit]
fj(".create_assignment:visible").click
wait_for_ajaximations
end
if opts[:more_options]
fj('.more_options:visible').click
wait_for_ajaximations
end
end
f("#assignment_group_#{assignment_group_id} .add_assignment").click
click_option(f("#ag_#{assignment_group_id}_assignment_type"), type)
def edit_assignment(assignment_id, opts={})
f("#assignment_#{assignment_id} .al-trigger").click
f("#assignment_#{assignment_id} .edit_assignment").click
if opts[:name]
f("#ag_#{assignment_group_id}_assignment_name").clear
f("#ag_#{assignment_group_id}_assignment_name").send_keys opts[:name]
if opts[:name]
f("#assign_#{assignment_id}_assignment_name").clear
f("#assign_#{assignment_id}_assignment_name").send_keys opts[:name]
end
if opts[:points]
f("#assign_#{assignment_id}_assignment_points").clear
f("#assign_#{assignment_id}_assignment_points").send_keys opts[:points]
end
if opts[:due_at]
f("#assign_#{assignment_id}_assignment_due_at").clear
f("#assign_#{assignment_id}_assignment_due_at").send_keys opts[:due_at]
end
if opts[:submit]
fj(".create_assignment:visible").click
wait_for_ajaximations
end
if opts[:more_options]
fj('.more_options:visible').click
wait_for_ajaximations
end
end
if opts[:points]
f("#ag_#{assignment_group_id}_assignment_points").clear
f("#ag_#{assignment_group_id}_assignment_points").send_keys opts[:points]
end
if opts[:due_at]
f("#ag_#{assignment_group_id}_assignment_due_at").clear
f("#ag_#{assignment_group_id}_assignment_due_at").send_keys opts[:due_at]
end
if opts[:submit]
fj(".create_assignment:visible").click
def edit_assignment_group(assignment_group_id)
f("#assignment_group_#{assignment_group_id} .al-trigger").click
f("#assignment_group_#{assignment_group_id} .edit_group").click
wait_for_ajaximations
end
if opts[:more_options]
fj('.more_options:visible').click
def delete_assignment_group(assignment_group_id, opts={})
f("#assignment_group_#{assignment_group_id} .al-trigger").click
f("#assignment_group_#{assignment_group_id} .delete_group").click
unless opts[:no_accept]
accept_alert
wait_for_ajaximations
end
end
def submit_assignment_form
expect_new_page_load { f('.btn-primary[type=submit]').click }
wait_for_ajaximations
end
end
def edit_assignment(assignment_id, opts={})
f("#assignment_#{assignment_id} .al-trigger").click
f("#assignment_#{assignment_id} .edit_assignment").click
if opts[:name]
f("#assign_#{assignment_id}_assignment_name").clear
f("#assign_#{assignment_id}_assignment_name").send_keys opts[:name]
def stub_freezer_plugin(frozen_atts = nil)
frozen_atts ||= {
"assignment_group_id" => "true"
}
PluginSetting.stubs(:settings_for_plugin).returns(frozen_atts)
end
if opts[:points]
f("#assign_#{assignment_id}_assignment_points").clear
f("#assign_#{assignment_id}_assignment_points").send_keys opts[:points]
end
if opts[:due_at]
f("#assign_#{assignment_id}_assignment_due_at").clear
f("#assign_#{assignment_id}_assignment_due_at").send_keys opts[:due_at]
end
if opts[:submit]
fj(".create_assignment:visible").click
wait_for_ajaximations
end
if opts[:more_options]
fj('.more_options:visible').click
wait_for_ajaximations
end
end
def edit_assignment_group(assignment_group_id)
f("#assignment_group_#{assignment_group_id} .al-trigger").click
f("#assignment_group_#{assignment_group_id} .edit_group").click
wait_for_ajaximations
end
def delete_assignment_group(assignment_group_id, opts={})
f("#assignment_group_#{assignment_group_id} .al-trigger").click
f("#assignment_group_#{assignment_group_id} .delete_group").click
unless opts[:no_accept]
accept_alert
wait_for_ajaximations
end
end
def submit_assignment_form
expect_new_page_load { f('.btn-primary[type=submit]').click }
wait_for_ajaximations
end
def stub_freezer_plugin(frozen_atts = nil)
frozen_atts ||= {
"assignment_group_id" => "true"
}
PluginSetting.stubs(:settings_for_plugin).returns(frozen_atts)
end
def frozen_assignment(group)
group ||= @course.assignment_groups.first
assign = @course.assignments.create!(
def frozen_assignment(group)
group ||= @course.assignment_groups.first
assign = @course.assignments.create!(
:name => "frozen",
:due_at => Time.now.utc + 2.days,
:due_at => Time.zone.now.utc + 2.days,
:assignment_group => group,
:freeze_on_copy => true
)
assign.copied = true
assign.save!
assign
end
)
assign.copied = true
assign.save!
assign
end
def run_assignment_edit(assignment)
get "/courses/#{@course.id}/assignments/#{assignment.id}/edit"
def run_assignment_edit(assignment)
get "/courses/#{@course.id}/assignments/#{assignment.id}/edit"
yield
yield
submit_assignment_form
end
submit_assignment_form
end
def manually_create_assignment(assignment_title = 'new assignment')
get "/courses/#{@course.id}/assignments"
expect_new_page_load { f('.new_assignment').click }
replace_content(f('#assignment_name'), assignment_title)
end
def manually_create_assignment(assignment_title = 'new assignment')
get "/courses/#{@course.id}/assignments"
expect_new_page_load { f('.new_assignment').click }
replace_content(f('#assignment_name'), assignment_title)
end
def click_away_accept_alert
f('#section-tabs .home').click
driver.switch_to.alert.accept
end
def click_away_accept_alert
f('#section-tabs .home').click
driver.switch_to.alert.accept
end
def setup_sections_and_overrides_all_future
# All in the future by default
@unlock_at = Time.now.utc + 6.days
@due_at = Time.now.utc + 10.days
@lock_at = Time.now.utc + 11.days
def setup_sections_and_overrides_all_future
# All in the future by default
@unlock_at = Time.zone.now.utc + 6.days
@due_at = Time.zone.now.utc + 10.days
@lock_at = Time.zone.now.utc + 11.days
@assignment.due_at = @due_at
@assignment.unlock_at = @unlock_at
@assignment.lock_at = @lock_at
@assignment.save!
# 2 course sections, student in second section.
@section1 = @course.course_sections.create!(:name => 'Section A')
@section2 = @course.course_sections.create!(:name => 'Section B')
@course.student_enrollments.scoped.delete_all # get rid of existing student enrollments, mess up section enrollment
# Overridden lock dates for 2nd section - different dates, but still in future
@override = assignment_override_model(:assignment => @assignment, :set => @section2,
:lock_at => @lock_at + 12.days,
:unlock_at => Time.now.utc + 3.days)
end
@assignment.due_at = @due_at
@assignment.unlock_at = @unlock_at
@assignment.lock_at = @lock_at
@assignment.save!
# 2 course sections, student in second section.
@section1 = @course.course_sections.create!(:name => 'Section A')
@section2 = @course.course_sections.create!(:name => 'Section B')
@course.student_enrollments.scoped.delete_all # get rid of existing student enrollments, mess up section enrollment
# Overridden lock dates for 2nd section - different dates, but still in future
@override = assignment_override_model(
:assignment => @assignment,
:set => @section2,
:lock_at => @lock_at + 12.days,
:unlock_at => Time.zone.now.utc + 3.days
)
end
def create_assignment_for_group(submission_type, grade_group_students_individually = false)
group_test_setup(2,1,2)
add_user_to_group(@students.first,@testgroup[0])
@assignment = @course.assignments.create!(title: 'assignment 1', name: 'assignment 1', due_at: Time.now.utc + 2.days,
points_possible: 50, submission_types: submission_type, group_category:@group_category[0],
grade_group_students_individually: grade_group_students_individually)
end
def create_assignment_for_group(submission_type, grade_group_students_individually = false)
group_test_setup(2,1,2)
add_user_to_group(@students.first,@testgroup[0])
@assignment = @course.assignments.create!(
title: 'assignment 1',
name: 'assignment 1',
due_at: Time.zone.now.utc + 2.days,
points_possible: 50,
submission_types: submission_type,
group_category: @group_category[0],
grade_group_students_individually: grade_group_students_individually
)
end
def create_assignment_with_group_category
get "/courses/#{@course.id}/assignments/new"
def create_assignment_with_group_category
get "/courses/#{@course.id}/assignments/new"
f('#assignment_name').send_keys('my title')
driver.execute_script 'tinyMCE.activeEditor.setContent("text")'
f('#assignment_name').send_keys('my title')
driver.execute_script 'tinyMCE.activeEditor.setContent("text")'
f('#assignment_text_entry').click
f('#has_group_category').click
f('#assignment_group_category_id').click
f('#assignment_group_category_id').send_keys :arrow_up
f('#assignment_group_category_id').send_keys :return
end
f('#assignment_text_entry').click
f('#has_group_category').click
f('#assignment_group_category_id').click
f('#assignment_group_category_id').send_keys :arrow_up
f('#assignment_group_category_id').send_keys :return
end
def create_file_list
{
name: '/',
folders: [
{
name: 'TestFolder',
files: [
{
name: 'nested.mydoc'
}
]
}
],
files: [
{
name: 'test.mydoc'
}
]
}
end
def create_file_list
{
name: '/',
folders: [
{
name: 'TestFolder',
files: [
{
name: 'nested.mydoc'
}
]
}
],
files: [
{
name: 'test.mydoc'
}
]
}
end
def create_post_grades_tool(opts = {})
post_grades_tool = @course.context_external_tools.create!(
def create_post_grades_tool(opts = {})
post_grades_tool = @course.context_external_tools.create!(
name: opts[:name] || 'test tool',
domain: 'example.com',
url: 'http://example.com/lti',
consumer_key: 'key',
shared_secret: 'secret',
settings: {
post_grades: {
url: 'http://example.com/lti/post_grades'
}
post_grades: {
url: 'http://example.com/lti/post_grades'
}
}
)
post_grades_tool.context_external_tool_placements.create!(placement_type: 'post_grades')
post_grades_tool
end
)
post_grades_tool.context_external_tool_placements.create!(placement_type: 'post_grades')
post_grades_tool
end
def click_cog_to_edit
ffj('.al-trigger')[1].click
wait_for_ajaximations
fj('.edit_assignment').click
wait_for_ajaximations
end
def click_cog_to_edit
ffj('.al-trigger')[1].click
wait_for_ajaximations
fj('.edit_assignment').click
wait_for_ajaximations
end
def create_assignment_with_type(type, title = 'My Title')
@assignment = @course.assignments.create!(title: title, grading_type: type, points_possible: 20)
@assignment
def create_assignment_with_type(type, title = 'My Title')
@assignment = @course.assignments.create!(title: title, grading_type: type, points_possible: 20)
@assignment
end
end

View File

@ -1,7 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../..//helpers/shared_user_methods')
require File.expand_path(File.dirname(__FILE__) + '/../..//helpers/users_common')
shared_examples_for "users basic tests" do
include_context "in-process server selenium tests"
include UsersCommon
it "should add a new user" do
skip('newly added user in sub account does not show up') if account != Account.default

View File

@ -1,110 +1,112 @@
def save_and_reload_changes(grading_standard)
f('.save_button').click
wait_for_ajaximations
grading_standard.reload
end
def simple_grading_standard(context)
@standard = context.grading_standards.create!(
:title => "My Grading Standard",
:standard_data => {
"scheme_0" => {:name => "A", :value => "90"},
"scheme_1" => {:name => "B", :value => "80"},
"scheme_2" => {:name => "C", :value => "70"}
})
end
def should_add_a_grading_scheme(options = {name: "new grading standard"})
new_standard_name = options[:name]
f('.add_standard_link').click
expect(f('.add_standard_link')).to have_class('disabled')
replace_content(f('.scheme_name'), new_standard_name)
f('.save_button').click
wait_for_ajax_requests
@new_grading_standard = GradingStandard.last
expect(@new_grading_standard.title).to eq new_standard_name
expect(f("#grading_standard_#{@new_grading_standard.id}")).to be_displayed
end
def should_edit_a_grading_scheme(context, url)
edit_name = 'edited grading scheme'
simple_grading_standard(context)
grading_standard = GradingStandard.last
get url
f('.edit_grading_standard_link').click
replace_content(f('.scheme_name'), edit_name)
save_and_reload_changes(grading_standard)
expect(grading_standard.title).to eq edit_name
expect(fj(".title span:eq(1)").text).to eq edit_name #fj to avoid selenium caching
end
def should_delete_a_grading_scheme(context, url)
simple_grading_standard(context)
get url
f('.delete_grading_standard_link').click
driver.switch_to.alert.accept
wait_for_ajaximations
expect(GradingStandard.last.workflow_state).to eq 'deleted'
end
def create_simple_standard_and_edit(context, url)
simple_grading_standard(context)
@grading_standard = GradingStandard.last
get url
f('.edit_grading_standard_link').click
end
def should_add_a_grading_scheme_item
data_count = @grading_standard.data.count
grading_standard_row = f('.grading_standard_row')
driver.action.move_to(grading_standard_row).perform
f('.insert_grading_standard_link').click
replace_content(ff('.standard_name')[1], 'Z')
replace_content(ff('.standard_value')[1], '88')
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data.count).to eq data_count + 1
expect(@grading_standard.data[1][0]).to eq 'Z'
# TODO: check for change in upper limit of next row item
end
def grading_standard_rows
ff('.grading_standard_row')
end
def should_edit_a_grading_scheme_item
replace_content(grading_standard_rows[0].find_element(:css, '.standard_name'), 'F')
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data[0][0]).to eq 'F'
# TODO: check that changing lower limit changes upper limit of next row item
end
def should_not_update_invalid_grading_scheme_input
replace_content(grading_standard_rows[1].find_element(:css, '.standard_value'), '90')
save_and_reload_changes(@grading_standard)
expect(f("#invalid_standard_message_#{@grading_standard.id}")).to be_displayed
expect(@grading_standard.data[1][1]).to eq 0.8
end
def should_delete_a_grading_scheme_item
data_count = @grading_standard.data.count
grading_standard_rows[0].find_element(:css, '.delete_row_link').click
wait_for_ajaximations
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data.count).to eq data_count - 1
expect(@grading_standard.data[0][0]).to eq 'B'
# TODO: check that changing upped limit of next row item changes to lower limit of line above
end
def should_contain_a_tab_for_grading_schemes_and_periods(url)
@course.root_account.allow_feature!(:multiple_grading_periods)
@course.account.enable_feature!(:multiple_grading_periods)
get url
expect(f(".grading_periods_tab")).to be_displayed
f(".grading_periods_tab").click
expect(f(".new-grading-period")).to be_displayed
expect(f(".grading_standards_tab")).to be_displayed
f(".grading_standards_tab").click
expect(f(".add_standard_link")).to be_displayed
module GradingSchemesCommon
def save_and_reload_changes(grading_standard)
f('.save_button').click
wait_for_ajaximations
grading_standard.reload
end
def simple_grading_standard(context)
@standard = context.grading_standards.create!(
:title => "My Grading Standard",
:standard_data => {
"scheme_0" => {:name => "A", :value => "90"},
"scheme_1" => {:name => "B", :value => "80"},
"scheme_2" => {:name => "C", :value => "70"}
})
end
def should_add_a_grading_scheme(options = {name: "new grading standard"})
new_standard_name = options[:name]
f('.add_standard_link').click
expect(f('.add_standard_link')).to have_class('disabled')
replace_content(f('.scheme_name'), new_standard_name)
f('.save_button').click
wait_for_ajax_requests
@new_grading_standard = GradingStandard.last
expect(@new_grading_standard.title).to eq new_standard_name
expect(f("#grading_standard_#{@new_grading_standard.id}")).to be_displayed
end
def should_edit_a_grading_scheme(context, url)
edit_name = 'edited grading scheme'
simple_grading_standard(context)
grading_standard = GradingStandard.last
get url
f('.edit_grading_standard_link').click
replace_content(f('.scheme_name'), edit_name)
save_and_reload_changes(grading_standard)
expect(grading_standard.title).to eq edit_name
expect(fj(".title span:eq(1)").text).to eq edit_name # fj to avoid selenium caching
end
def should_delete_a_grading_scheme(context, url)
simple_grading_standard(context)
get url
f('.delete_grading_standard_link').click
driver.switch_to.alert.accept
wait_for_ajaximations
expect(GradingStandard.last.workflow_state).to eq 'deleted'
end
def create_simple_standard_and_edit(context, url)
simple_grading_standard(context)
@grading_standard = GradingStandard.last
get url
f('.edit_grading_standard_link').click
end
def should_add_a_grading_scheme_item
data_count = @grading_standard.data.count
grading_standard_row = f('.grading_standard_row')
driver.action.move_to(grading_standard_row).perform
f('.insert_grading_standard_link').click
replace_content(ff('.standard_name')[1], 'Z')
replace_content(ff('.standard_value')[1], '88')
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data.count).to eq data_count + 1
expect(@grading_standard.data[1][0]).to eq 'Z'
# TODO: check for change in upper limit of next row item
end
def grading_standard_rows
ff('.grading_standard_row')
end
def should_edit_a_grading_scheme_item
replace_content(grading_standard_rows[0].find_element(:css, '.standard_name'), 'F')
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data[0][0]).to eq 'F'
# TODO: check that changing lower limit changes upper limit of next row item
end
def should_not_update_invalid_grading_scheme_input
replace_content(grading_standard_rows[1].find_element(:css, '.standard_value'), '90')
save_and_reload_changes(@grading_standard)
expect(f("#invalid_standard_message_#{@grading_standard.id}")).to be_displayed
expect(@grading_standard.data[1][1]).to eq 0.8
end
def should_delete_a_grading_scheme_item
data_count = @grading_standard.data.count
grading_standard_rows[0].find_element(:css, '.delete_row_link').click
wait_for_ajaximations
save_and_reload_changes(@grading_standard)
expect(@grading_standard.data.count).to eq data_count - 1
expect(@grading_standard.data[0][0]).to eq 'B'
# TODO: check that changing upped limit of next row item changes to lower limit of line above
end
def should_contain_a_tab_for_grading_schemes_and_periods(url)
@course.root_account.allow_feature!(:multiple_grading_periods)
@course.account.enable_feature!(:multiple_grading_periods)
get url
expect(f(".grading_periods_tab")).to be_displayed
f(".grading_periods_tab").click
expect(f(".new-grading-period")).to be_displayed
expect(f(".grading_standards_tab")).to be_displayed
f(".grading_standards_tab").click
expect(f(".add_standard_link")).to be_displayed
end
end

View File

@ -1,5 +1,15 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
def setup_group_page_urls
let(:url) {"/groups/#{@testgroup.first.id}"}
let(:announcements_page) {url + '/announcements'}
let(:people_page) {url + '/users'}
let(:discussions_page) {url + '/discussion_topics'}
let(:pages_page) {url + '/pages'}
let(:files_page) {url + '/files'}
let(:conferences_page) {url + '/conferences'}
end
# ======================================================================================================================
# Shared Examples
# ======================================================================================================================
@ -235,14 +245,15 @@ end
# ======================================================================================================================
# Helper Methods
# ======================================================================================================================
def pick_test_id(context, id1, id2)
case context
when 'student'
id1
id1
when 'teacher'
id2
id2
else
raise('Error: Invalid context!')
raise('Error: Invalid context!')
end
end
@ -257,366 +268,357 @@ def pick_priority(context, p1, p2)
end
end
def seed_students(count)
@students = []
count.times do |n|
@students << User.create!(:name => "Test Student #{n+1}")
@course.enroll_student(@students.last).accept!
end
end
# Creates group sets equal to groupset_count and groups within each group set equal to groups_per_set
def seed_groups(groupset_count, groups_per_set)
@group_category = []
@testgroup = []
groupset_count.times do |n|
@group_category << @course.group_categories.create!(:name => "Test Group Set #{n+1}")
groups_per_set.times do |i|
@testgroup << @course.groups.create!(:name => "Test Group #{i+1}", :group_category => @group_category[n])
module GroupsCommon
def seed_students(count)
@students = []
count.times do |n|
@students << User.create!(:name => "Test Student #{n+1}")
@course.enroll_student(@students.last).accept!
end
end
end
# Sets up groups and users for testing. Default is 1 user, 1 groupset, and 1 group per groupset.
def group_test_setup(user_count = 1, groupset_count = 1, groups_per_set = 1)
seed_students(user_count)
seed_groups(groupset_count, groups_per_set)
end
# Creates group sets equal to groupset_count and groups within each group set equal to groups_per_set
def seed_groups(groupset_count, groups_per_set)
@group_category = []
@testgroup = []
groupset_count.times do |n|
@group_category << @course.group_categories.create!(:name => "Test Group Set #{n+1}")
def add_user_to_group(user,group,is_leader = false)
group.add_user user
group.leader = user if is_leader
group.save!
end
groups_per_set.times do |i|
@testgroup << @course.groups.create!(:name => "Test Group #{i+1}", :group_category => @group_category[n])
end
end
end
# Adds all given users to group, can use arrays or a single variable
def add_users_to_group(students, group)
count = students.size
count.times do |n|
group.add_user students[n]
# Sets up groups and users for testing. Default is 1 user, 1 groupset, and 1 group per groupset.
def group_test_setup(user_count = 1, groupset_count = 1, groups_per_set = 1)
seed_students(user_count)
seed_groups(groupset_count, groups_per_set)
end
def add_user_to_group(user,group,is_leader = false)
group.add_user user
group.leader = user if is_leader
group.save!
end
end
def create_default_student_group(group_name = "Windfury")
fj("#groupName").send_keys(group_name.to_s)
fj('button.confirm-dialog-confirm-btn').click
wait_for_ajaximations
end
def create_group_and_add_all_students(group_name = "Windfury")
fj("#groupName").send_keys(group_name.to_s)
students = ffj(".checkbox")
students.each do |student|
student.click
end
fj('button.confirm-dialog-confirm-btn').click
wait_for_ajaximations
end
def create_category(params={})
default_params = {
category_name:'category1',
has_max_membership:false,
member_limit:0,
}
params = default_params.merge(params)
category1 = @course.group_categories.create!(name: params[:category_name])
category1.configure_self_signup(true, false)
if params[:has_max_membership]
category1.update_attribute(:group_limit,params[:member_limit])
# Adds all given users to group, can use arrays or a single variable
def add_users_to_group(students, group)
count = students.size
count.times do |n|
group.add_user students[n]
group.save!
end
end
category1
end
def create_default_student_group(group_name = "Windfury")
fj("#groupName").send_keys(group_name.to_s)
fj('button.confirm-dialog-confirm-btn').click
wait_for_ajaximations
end
def create_group(params={})
default_params = {
group_name:'Windfury',
enroll_student_count:0,
add_self_to_group:true,
def create_group_and_add_all_students(group_name = "Windfury")
fj("#groupName").send_keys(group_name.to_s)
students = ffj(".checkbox")
students.each(&:click)
fj('button.confirm-dialog-confirm-btn').click
wait_for_ajaximations
end
def create_category(params={})
default_params = {
category_name:'category1',
is_leader:'true',
has_max_membership:false,
member_limit: 0,
group_category: nil,
}
params = default_params.merge(params)
member_limit:0,
}
params = default_params.merge(params)
# Sets up a group category for the group if one isn't passed in
params[:group_category] = create_category(category_name:params[:category_name]) if params[:group_category].nil?
category1 = @course.group_categories.create!(name: params[:category_name])
category1.configure_self_signup(true, false)
if params[:has_max_membership]
category1.update_attribute(:group_limit,params[:member_limit])
end
group = @course.groups.create!(
name:params[:group_name],
group_category:params[:group_category])
if params[:has_max_membership]
group.update_attribute(:max_membership,params[:member_limit])
category1
end
if params[:add_self_to_group] == true
add_user_to_group(@student, group, params[:is_leader])
def create_group(params={})
default_params = {
group_name:'Windfury',
enroll_student_count:0,
add_self_to_group:true,
category_name:'category1',
is_leader:'true',
has_max_membership:false,
member_limit: 0,
group_category: nil,
}
params = default_params.merge(params)
# Sets up a group category for the group if one isn't passed in
params[:group_category] = create_category(category_name:params[:category_name]) if params[:group_category].nil?
group = @course.groups.create!(
name: params[:group_name],
group_category: params[:group_category]
)
if params[:has_max_membership]
group.update_attribute(:max_membership,params[:member_limit])
end
if params[:add_self_to_group] == true
add_user_to_group(@student, group, params[:is_leader])
end
seed_students(params[:enroll_student_count]) if params[:enroll_student_count] > 0
end
seed_students(params[:enroll_student_count]) if params[:enroll_student_count] > 0
end
def create_student_group_as_a_teacher(group_name = "Windfury", enroll_student_count = 0)
@student = User.create!(:name => "Test Student 1")
@course.enroll_student(@student).accept!
group = @course.groups.create!(:name => group_name)
add_user_to_group(@student, group, false)
enroll_student_count.times do |n|
@student = User.create!(:name => "Test Student #{n+2}")
def create_student_group_as_a_teacher(group_name = "Windfury", enroll_student_count = 0)
@student = User.create!(:name => "Test Student 1")
@course.enroll_student(@student).accept!
group = @course.groups.create!(:name => group_name)
add_user_to_group(@student, group, false)
enroll_student_count.times do |n|
@student = User.create!(:name => "Test Student #{n+2}")
@course.enroll_student(@student).accept!
add_user_to_group(@student, group, false)
end
group
end
group
end
def manually_create_group(params={})
default_params = {
group_name:'Test Group',
has_max_membership:false,
member_limit:0,
}
params = default_params.merge(params)
def manually_create_group(params={})
default_params = {
group_name:'Test Group',
has_max_membership:false,
member_limit:0,
}
params = default_params.merge(params)
f('.btn.add-group').click
wait_for_ajaximations
f('#group_name').send_keys(params[:group_name])
if params[:has_max_membership]
f('#group_max_membership').send_keys(params[:member_limit])
f('.btn.add-group').click
wait_for_ajaximations
f('#group_name').send_keys(params[:group_name])
if params[:has_max_membership]
f('#group_max_membership').send_keys(params[:member_limit])
wait_for_ajaximations
end
f('#groupEditSaveButton').click
wait_for_ajaximations
end
f('#groupEditSaveButton').click
wait_for_ajaximations
end
# Used to set group_limit field manually. Assumes you are on Edit Group Set page and self-sign up is checked
def manually_set_groupset_limit(member_limit = "2")
replace_content(fj('input[name="group_limit"]:visible'), member_limit)
fj('.btn.btn-primary[type=submit]').click
wait_for_ajaximations
end
def manually_fill_limited_group(member_limit ="2",student_count = 0)
student_count.times do |n|
# Finds all student add buttons and updates the through each iteration
studs = ff('.assign-to-group')
studs.first.click
# Used to set group_limit field manually. Assumes you are on Edit Group Set page and self-sign up is checked
def manually_set_groupset_limit(member_limit = "2")
replace_content(fj('input[name="group_limit"]:visible'), member_limit)
fj('.btn.btn-primary[type=submit]').click
wait_for_ajaximations
end
def manually_fill_limited_group(member_limit ="2",student_count = 0)
student_count.times do |n|
# Finds all student add buttons and updates the through each iteration
studs = ff('.assign-to-group')
studs.first.click
wait_for_ajaximations
f('.set-group').click
expect(f('.group-summary')).to include_text("#{n+1} / #{member_limit} students")
end
expect(f('.show-group-full')).to be_displayed
end
# Used to enable self-signup on an already created group set by opening Edit Group Set
def manually_enable_self_signup
f('.icon-settings').click
wait_for_ajaximations
f('.edit-category').click
wait_for_ajaximations
f('.self-signup-toggle').click
end
def open_clone_group_set_option
f('.icon-settings').click
wait_for_ajaximations
f('.clone-category').click
wait_for_ajaximations
end
def set_cloned_groupset_name(groupset_name="Test Group Set Clone",page_reload=false)
replace_content(f('#cloned_category_name'), groupset_name)
if page_reload
expect_new_page_load {f('#clone_category_submit_button').click}
else
f('#clone_category_submit_button').click
wait_for_ajaximations
end
end
def select_randomly_assign_students_option
f('.icon-settings').click
wait_for_ajaximations
f('.randomly-assign-members').click
wait_for_ajaximations
f('.randomly-assign-members-confirm').click
wait_for_ajaximations
end
def select_change_groups_option
(ff('#option_change_groups').last).click
(ff('#clone_category_submit_button').last).click
wait_for_ajaximations
end
def move_unassigned_student_to_group(group=0)
f('.assign-to-group').click
wait_for_ajaximations
ff('.set-group')[group].click
wait_for_ajaximations
end
# Moves student from one group to another group. Assumes student can be seen by toggling group's collapse arrow.
def move_student_to_group(group_destination, student=0)
ff('.group-user-actions')[student].click
wait_for_ajaximations
ff('.edit-group-assignment')[student].click
wait_for_ajaximations
click_option('.single-select', "#{@testgroup[group_destination].name}")
f('.set-group').click
expect(f('.group-summary')).to include_text("#{n+1} / #{member_limit} students")
end
expect(f('.show-group-full')).to be_displayed
end
# Used to enable self-signup on an already created group set by opening Edit Group Set
def manually_enable_self_signup
f('.icon-settings').click
wait_for_ajaximations
f('.edit-category').click
wait_for_ajaximations
f('.self-signup-toggle').click
end
def open_clone_group_set_option
f('.icon-settings').click
wait_for_ajaximations
f('.clone-category').click
wait_for_ajaximations
end
def set_cloned_groupset_name(groupset_name="Test Group Set Clone",page_reload=false)
replace_content(f('#cloned_category_name'), groupset_name)
if page_reload
expect_new_page_load {f('#clone_category_submit_button').click}
else
f('#clone_category_submit_button').click
wait_for_ajaximations
end
end
def select_randomly_assign_students_option
f('.icon-settings').click
wait_for_ajaximations
f('.randomly-assign-members').click
wait_for_ajaximations
f('.randomly-assign-members-confirm').click
wait_for_ajaximations
end
def select_change_groups_option
(ff('#option_change_groups').last).click
(ff('#clone_category_submit_button').last).click
wait_for_ajaximations
end
def move_unassigned_student_to_group(group=0)
f('.assign-to-group').click
wait_for_ajaximations
ff('.set-group')[group].click
wait_for_ajaximations
end
# Moves student from one group to another group. Assumes student can be seen by toggling group's collapse arrow.
def move_student_to_group(group_destination, student=0)
ff('.group-user-actions')[student].click
wait_for_ajaximations
ff('.edit-group-assignment')[student].click
wait_for_ajaximations
click_option('.single-select', "#{@testgroup[group_destination].name}")
f('.set-group').click
wait_for_ajaximations
end
# Assumes student can be seen by toggling group's collapse arrow
def remove_student_from_group(student=0)
ff('.group-user-actions')[student].click
wait_for_ajaximations
ff('.remove-from-group')[student].click
wait_for_ajaximations
end
def toggle_group_collapse_arrow
f('.toggle-group').click
wait_for_ajaximations
end
def manually_delete_group
f('.group-actions .icon-settings').click
wait_for_ajaximations
f('.delete-group').click
driver.switch_to.alert.accept
wait_for_animations
end
def delete_group
f(".icon-settings").click
wait_for_animations
fln('Delete').click
driver.switch_to.alert.accept
wait_for_animations
end
# Only use to add group_set if no group sets already exist
def click_add_group_set
f('#add-group-set').click
wait_for_ajaximations
end
def save_group_set
f('#newGroupSubmitButton').click
wait_for_ajaximations
end
def create_and_submit_assignment_from_group(student)
category = @group_category[0]
assignment = @course.assignments.create({
:name => "test assignment",
:group_category => category})
assignment.submit_homework(student)
end
def create_group_announcement_manually(title,text)
expect_new_page_load { f('.btn-primary').click }
replace_content(f('input[name=title]'), title)
type_in_tiny('textarea[name=message]', text)
expect_new_page_load { submit_form('.form-actions') }
end
# Checks that a group member can click a specified page entry on the index page and see its show page
# Expects @page is defined and index is defined as which wiki page is desired to click on. First page entry is default
def verify_member_sees_group_page(index = 0)
get pages_page
expect_new_page_load { ff('.wiki-page-link')[index].click }
expect expect(f('.page-title')).to include_text("#{@page.title}")
end
# context test. if true, allows you to test files both in and out of group context,
# otherwise it adds two files to the group
def add_test_files(context_test = true)
if context_test
second_file_context = @course
else
second_file_context = @testgroup.first
# Assumes student can be seen by toggling group's collapse arrow
def remove_student_from_group(student=0)
ff('.group-user-actions')[student].click
wait_for_ajaximations
ff('.remove-from-group')[student].click
wait_for_ajaximations
end
add_file(fixture_file_upload('files/example.pdf', 'application/pdf'),
@testgroup.first, "example.pdf")
add_file(fixture_file_upload('files/a_file.txt', 'text/plain'),
second_file_context, "a_file.txt")
end
def toggle_group_collapse_arrow
f('.toggle-group').click
wait_for_ajaximations
end
def expand_files_on_content_pane
fj('.ui-state-default.ui-corner-top:contains("Files")').click
wait_for_ajaximations
f('.sign.plus').click
wait_for_ajaximations
end
def manually_delete_group
f('.group-actions .icon-settings').click
wait_for_ajaximations
f('.delete-group').click
def move_file_to_folder(file_name,destination_name)
move(file_name, 1, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{file_name} moved to #{destination_name}\nClose"
# Click folder
ff('.media-body').first.click
wait_for_ajaximations
expect(fln(file_name)).to be_displayed
end
driver.switch_to.alert.accept
wait_for_animations
end
# For files page, creates a folder and then adds a folder within it
def create_folder_structure
@top_folder = 'Top Folder'
@inner_folder = 'Inner Folder'
add_folder(@top_folder)
ff('.media-body')[0].click
wait_for_ajaximations
add_folder(@inner_folder)
wait_for_ajaximations
end
def delete_group
f(".icon-settings").click
wait_for_animations
# Moves a folder to the top level file structure
def move_folder(folder_name)
move(folder_name, 0, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{folder_name} moved to files\nClose"
expect(ff('.treeLabel span')[2].text).to eq folder_name
end
fln('Delete').click
def verify_no_course_user_access(path)
# User.create! creates a course user, who won't be able to access the page
user_session(User.create!(name: 'course student'))
get path
expect(f('.ui-state-error')).to be_displayed
end
driver.switch_to.alert.accept
wait_for_animations
end
def setup_group_page_urls
let(:url) {"/groups/#{@testgroup.first.id}"}
let(:announcements_page) {url + '/announcements'}
let(:people_page) {url + '/users'}
let(:discussions_page) {url + '/discussion_topics'}
let(:pages_page) {url + '/pages'}
let(:files_page) {url + '/files'}
let(:conferences_page) {url + '/conferences'}
end
# Only use to add group_set if no group sets already exist
def click_add_group_set
f('#add-group-set').click
wait_for_ajaximations
end
def edit_group_announcement
get announcements_page
expect_new_page_load { ff('li.discussion-topic').first.click }
click_edit_btn
# edit also verifies it has been edited
edit('I edited it','My test message')
end
def save_group_set
f('#newGroupSubmitButton').click
wait_for_ajaximations
end
def create_and_submit_assignment_from_group(student)
category = @group_category[0]
assignment = @course.assignments.create({
:name => "test assignment",
:group_category => category})
assignment.submit_homework(student)
end
def create_group_announcement_manually(title,text)
expect_new_page_load { f('.btn-primary').click }
replace_content(f('input[name=title]'), title)
type_in_tiny('textarea[name=message]', text)
expect_new_page_load { submit_form('.form-actions') }
end
# Checks that a group member can click a specified page entry on the index page and see its show page
# Expects @page is defined and index is defined as which wiki page is desired to click on. First page entry is default
def verify_member_sees_group_page(index = 0)
get pages_page
expect_new_page_load { ff('.wiki-page-link')[index].click }
expect expect(f('.page-title')).to include_text("#{@page.title}")
end
# context test. if true, allows you to test files both in and out of group context,
# otherwise it adds two files to the group
def add_test_files(context_test = true)
if context_test
second_file_context = @course
else
second_file_context = @testgroup.first
end
add_file(fixture_file_upload('files/example.pdf', 'application/pdf'),
@testgroup.first, "example.pdf")
add_file(fixture_file_upload('files/a_file.txt', 'text/plain'),
second_file_context, "a_file.txt")
end
def expand_files_on_content_pane
fj('.ui-state-default.ui-corner-top:contains("Files")').click
wait_for_ajaximations
f('.sign.plus').click
wait_for_ajaximations
end
def move_file_to_folder(file_name,destination_name)
move(file_name, 1, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{file_name} moved to #{destination_name}\nClose"
# Click folder
ff('.media-body').first.click
wait_for_ajaximations
expect(fln(file_name)).to be_displayed
end
# For files page, creates a folder and then adds a folder within it
def create_folder_structure
@top_folder = 'Top Folder'
@inner_folder = 'Inner Folder'
add_folder(@top_folder)
ff('.media-body')[0].click
wait_for_ajaximations
add_folder(@inner_folder)
wait_for_ajaximations
end
# Moves a folder to the top level file structure
def move_folder(folder_name)
move(folder_name, 0, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{folder_name} moved to files\nClose"
expect(ff('.treeLabel span')[2].text).to eq folder_name
end
def verify_no_course_user_access(path)
# User.create! creates a course user, who won't be able to access the page
user_session(User.create!(name: 'course student'))
get path
expect(f('.ui-state-error')).to be_displayed
end
def edit_group_announcement
get announcements_page
expect_new_page_load { ff('li.discussion-topic').first.click }
click_edit_btn
# edit also verifies it has been edited
edit('I edited it','My test message')
end
end

View File

@ -1,5 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
module ManageGroupsCommon
def add_category(course, name, opts={})
keep_trying_until do
f(".add_category_link").click
@ -121,3 +122,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
fj("#{group_selector} .toggle-group").click
wait_for_ajax_requests
end
end

View File

@ -23,7 +23,8 @@ module NotificationsCommon
NotificationPolicy.create!(
notification: n,
communication_channel: user.communication_channel,
frequency: params[:frequency])
frequency: params[:frequency]
)
end
end

View File

@ -1,469 +1,474 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
module OutcomeCommon
#when 'teacher'; course_with_teacher_logged_in
#when 'student'; course_with_student_logged_in
#when 'admin'; course_with_admin_logged_in
# when 'teacher'; course_with_teacher_logged_in
# when 'student'; course_with_student_logged_in
# when 'admin'; course_with_admin_logged_in
def import_account_level_outcomes
keep_trying_until do
f(".btn-primary").click
expect(driver.switch_to.alert).not_to be nil
driver.switch_to.alert.accept
wait_for_ajaximations
true
end
end
def traverse_nested_outcomes(outcome)
#pass an array with each group or outcome in sequence
outcome.each do |title|
expect(ffj(".outcome-level:last .outcome-group .ellipsis")[0]).to have_attribute("title", title)
f(".ellipsis[title='#{title}']").click
wait_for_ajaximations
end
end
def goto_state_outcomes(outcome_url = "/accounts/#{Account.default.id}/outcomes")
get outcome_url
wait_for_ajaximations
f('.find_outcome').click
wait_for_ajaximations
ff(".outcome-level .outcome-group").last.click
wait_for_ajaximations
end
def state_outcome_setup
@cm.export_content
run_jobs
@cm.reload
expect(@cm.old_warnings_format).to eq []
expect(@cm.migration_settings[:last_error]).to be_nil
expect(@cm.workflow_state).to eq 'imported'
end
def context_outcome(context, num_of_outcomes)
num_of_outcomes.times do |o|
@outcome_group ||= context.root_outcome_group
@outcome = context.created_learning_outcomes.create!(:title => "outcome #{o}")
@outcome.rubric_criterion = valid_outcome_data
@outcome.save!
@outcome_group.add_outcome(@outcome)
@outcome_group.save!
end
end
def create_bulk_outcomes_groups(context, num_of_groups, num_of_outcomes)
@root = context.root_outcome_group
num_of_groups.times do |g|
@group = context.learning_outcome_groups.create!(:title => "group #{g}")
num_of_outcomes.times do |o|
@outcome = context.created_learning_outcomes.create!(:title => "outcome #{o}")
@group.add_outcome(@outcome)
def import_account_level_outcomes
keep_trying_until do
f(".btn-primary").click
expect(driver.switch_to.alert).not_to be nil
driver.switch_to.alert.accept
wait_for_ajaximations
true
end
@root.adopt_outcome_group(@group)
end
end
def valid_outcome_data
{
:mastery_points => 3,
:ratings => [
def traverse_nested_outcomes(outcome)
# pass an array with each group or outcome in sequence
outcome.each do |title|
expect(ffj(".outcome-level:last .outcome-group .ellipsis")[0]).to have_attribute("title", title)
f(".ellipsis[title='#{title}']").click
wait_for_ajaximations
end
end
def goto_state_outcomes(outcome_url = "/accounts/#{Account.default.id}/outcomes")
get outcome_url
wait_for_ajaximations
f('.find_outcome').click
wait_for_ajaximations
ff(".outcome-level .outcome-group").last.click
wait_for_ajaximations
end
def state_outcome_setup
@cm.export_content
run_jobs
@cm.reload
expect(@cm.old_warnings_format).to eq []
expect(@cm.migration_settings[:last_error]).to be_nil
expect(@cm.workflow_state).to eq 'imported'
end
def context_outcome(context, num_of_outcomes)
num_of_outcomes.times do |o|
@outcome_group ||= context.root_outcome_group
@outcome = context.created_learning_outcomes.create!(:title => "outcome #{o}")
@outcome.rubric_criterion = valid_outcome_data
@outcome.save!
@outcome_group.add_outcome(@outcome)
@outcome_group.save!
end
end
def create_bulk_outcomes_groups(context, num_of_groups, num_of_outcomes)
@root = context.root_outcome_group
num_of_groups.times do |g|
@group = context.learning_outcome_groups.create!(:title => "group #{g}")
num_of_outcomes.times do |o|
@outcome = context.created_learning_outcomes.create!(:title => "outcome #{o}")
@group.add_outcome(@outcome)
end
@root.adopt_outcome_group(@group)
end
end
def valid_outcome_data
{
:mastery_points => 3,
:ratings => [
{:points => 3, :description => "Rockin"},
{:points => 0, :description => "Lame"}
]
}
end
def state_outcome
state_outcome = [
'NGA Center/CCSSO',
'Common Core State Standards',
'College- and Career-Readiness Standards and K-12 Mathematics',
'First Grade',
'1.DD - zééééééééééééééééééééééééééééééééééééééééééééééééé',
'Something else'
]
}
end
state_outcome
end
def state_outcome
state_outcome = ['NGA Center/CCSSO', 'Common Core State Standards',
'College- and Career-Readiness Standards and K-12 Mathematics', 'First Grade',
'1.DD - zééééééééééééééééééééééééééééééééééééééééééééééééé', 'Something else']
state_outcome
end
def course_bulk_outcome_groups_course(num_of_groups, num_of_outcomes)
create_bulk_outcomes_groups(@course, num_of_groups, num_of_outcomes)
end
def course_bulk_outcome_groups_course(num_of_groups, num_of_outcomes)
create_bulk_outcomes_groups(@course, num_of_groups, num_of_outcomes)
end
def course_bulk_outcome_groups_account(num_of_groups, num_of_outcomes)
create_bulk_outcomes_groups(@account, num_of_groups, num_of_outcomes)
end
def course_bulk_outcome_groups_account(num_of_groups, num_of_outcomes)
create_bulk_outcomes_groups(@account, num_of_groups, num_of_outcomes)
end
def course_outcome(num_of_outcomes)
context_outcome(@course, num_of_outcomes)
end
def course_outcome(num_of_outcomes)
context_outcome(@course, num_of_outcomes)
end
def account_outcome(num_of_outcomes)
context_outcome(@account, num_of_outcomes)
end
def account_outcome(num_of_outcomes)
context_outcome(@account, num_of_outcomes)
end
def should_create_a_learning_outcome_with_a_new_rating_root_level
get outcome_url
def should_create_a_learning_outcome_with_a_new_rating_root_level
get outcome_url
## when
# create outcome
f('.add_outcome_link').click
outcome_name = 'first new outcome'
outcome_description = 'new learning outcome'
replace_content f('.outcomes-content input[name=title]'), outcome_name
type_in_tiny '.outcomes-content textarea[name=description]', outcome_description
# add a new rating
f('.insert_rating').click
f('input[name="ratings[1][description]"]').send_keys('almost exceeds')
f('input[name="ratings[1][points]"]').send_keys('4')
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should show up in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li.outcome-link').
detect { |li| li.text == outcome_name }).not_to be_nil
# should show outcome in main content window
# title
expect(f(".outcomes-content .title").text).to eq outcome_name
# description
expect(f(".outcomes-content .description").text).to eq outcome_description
# ratings
ratings = ffj('table.criterion .rating')
expect(ratings.size).to eq 4
expect(ratings.map { |r| r.text }).to eq ["Exceeds Expectations\n5 Points",
"almost exceeds\n4 Points",
"Meets Expectations\n3 Points",
"Does Not Meet Expectations\n0 Points"]
expect(f('table.criterion .total').text).to eq "Total Points\n5 Points"
# db
expect(LearningOutcome.where(short_description: outcome_name).first).to be_present
end
def should_create_a_learning_outcome_nested
get outcome_url
wait_for_ajaximations
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
# create outcome
f('.add_outcome_link').click
wait_for_ajaximations
outcome_name = 'first new outcome'
replace_content(f('.outcomes-content input[name=title]'), outcome_name)
# submit
f('.submit_button').click
wait_for_ajaximations
refresh_page
#select group
f('.outcome-group').click
wait_for_ajaximations
#select nested outcome
f('.outcome-link').click
wait_for_ajaximations
## expect
# should show up in nested directory browser
expect(ffj('.outcomes-sidebar .outcome-level:eq(1) li.outcome-link').
detect { |li| li.text == outcome_name }).not_to be_nil
# should show outcome in main content window
expect(f(".outcomes-content .title").text).to eq outcome_name
# db
expect(LearningOutcome.where(short_description: outcome_name).first).to be_present
end
def should_edit_a_learning_outcome_and_delete_a_rating
edited_title = 'edit outcome'
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li').click
wait_for_ajaximations
driver.execute_script("$('.edit_button').click()")
## when
# edit title
replace_content f('.outcomes-content input[name=title]'), edited_title
# delete a rating
f('.edit_rating').click
f('.delete_rating_link').click
# edit a rating
f('.edit_rating').click
replace_content f('input[name="ratings[0][points]"]'), '1'
replace_content f('input[name="mastery_points"]'), '1'
# submit
driver.execute_script "$('.submit_button').click()"
wait_for_ajaximations
## expect
# should be edited in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == edited_title }).not_to be_nil
# title
expect(f(".outcomes-content .title").text).to eq edited_title
# ratings
ratings = ffj('table.criterion .rating')
expect(ratings.size).to eq 1
expect(ratings.map { |r| r.text }).to eq ["Lame\n1 Points"]
expect(f('table.criterion .total').text).to eq "Total Points\n1 Points"
# db
expect(LearningOutcome.where(short_description: edited_title).first).to be_present
end
def should_delete_a_learning_outcome
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li').click
wait_for_ajaximations
## when
# delete the outcome
driver.execute_script("$('.delete_button').click()")
driver.switch_to.alert.accept
wait_for_ajaximations
## expect
# should not be showing on page
expect(ffj('.outcomes-sidebar .outcome-level:first li')).to be_empty
expect(f('.outcomes-content .title').text).to eq 'Setting up Outcomes'
# db
expect(LearningOutcome.where(id: @outcome).first.workflow_state).to eq 'deleted'
refresh_page # to make sure it was correctly deleted
ff('.learning_outcome').each { |outcome_element| expect(outcome_element).not_to be_displayed }
end
def should_validate_mastery_points
get outcome_url
f('.add_outcome_link').click
# Must have title for correct validation message to appear.
replace_content(f('.outcomes-content input[name=title]'), 'Outcome Mastery')
## when
# not in ratings
replace_content f('input[name="mastery_points"]'), '-1'
# submit
f('.submit_button').click
wait_for_ajaximations
## expect
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("Must be greater than or equal to 0")
end
def should_validate_calculation_method_dropdown
get outcome_url
f('.add_outcome_link').click
# create array of drop down options
drop_down = get_options('#calculation_method').map(&:text)
expected_array = ['Decaying Average', 'n Number of Times', 'Most Recent Score', 'Highest Score']
# expect
expect(drop_down.length).to eq(4)
expect(drop_down).to match_array(expected_array)
end
def should_validate_decaying_average_below_range
get outcome_url
f('.add_outcome_link').click
below_range = 0
replace_content(f('.outcomes-content input[name=title]'), 'Decaying Average')
click_option('#calculation_method', "Decaying Average")
# enter invalid number below range
replace_content(f('input[name=calculation_int]'), below_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{below_range}' is not a valid value")
end
def should_validate_decaying_average_above_range
get outcome_url
f('.add_outcome_link').click
above_range = 100
replace_content(f('.outcomes-content input[name=title]'), 'Decaying Average')
click_option('#calculation_method', "Decaying Average")
# enter second invalid number above range
replace_content(f('input[name=calculation_int]'), above_range)
wait_for_ajaximations
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{above_range}' is not a valid value")
end
def should_validate_n_mastery_below_range
get outcome_url
f('.add_outcome_link').click
below_range = 1
replace_content(f('.outcomes-content input[name=title]'), 'n Number of Times')
click_option('#calculation_method', "n Number of Times")
# enter invalid number below range
replace_content(f('input[name=calculation_int]'), below_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{below_range}' is not a valid value")
end
def should_validate_n_mastery_above_range
get outcome_url
f('.add_outcome_link').click
above_range = 6
replace_content(f('.outcomes-content input[name=title]'), 'n Number of Times')
click_option('#calculation_method', "n Number of Times")
# enter invalid number above range
replace_content(f('input[name=calculation_int]'), above_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{above_range}' is not a valid value")
end
def should_validate_short_description_presence
get outcome_url
wait_for_ajaximations
f('.add_outcome_link').click
# Submit outcome with an empty title
f('.outcome_title').clear
f('.submit_button').click
wait_for_ajaximations
scroll_page_to_top
driver.execute_script("$('.outcomes-content').scrollTo(0, 0)")
wait_for_ajaximations
keep_trying_until {
expect(fj('.error_text div').text).to eq "Cannot be blank"
}
end
def should_validate_short_description_length
get outcome_url
wait_for_ajaximations
f('.add_outcome_link').click
content = ('Wee taco banana hello 255 characters exceeded' * 10)
replace_content f('.outcome_title'), (content)
f('.submit_button').click
wait_for_ajaximations
expect(fj('.error_text')).to be_present
end
def should_create_an_outcome_group_root_level
get outcome_url
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should show up in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == group_title }).not_to be_nil
# should show outcome in main content window
# title
expect(f(".outcomes-content .title").text).to eq group_title
# db
expect(LearningOutcomeGroup.where(title: group_title).first).to be_present
end
def should_create_an_outcome_group_nested
get outcome_url
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
# create nested group
f('.add_outcome_group').click
nested_group_title = 'my nested group'
replace_content f('.outcomes-content input[name=title]'), nested_group_title
# submit
driver.execute_script("$('.submit_button').click()")
if !f('.submit_button').nil?
## when
# create outcome
f('.add_outcome_link').click
outcome_name = 'first new outcome'
outcome_description = 'new learning outcome'
replace_content f('.outcomes-content input[name=title]'), outcome_name
type_in_tiny '.outcomes-content textarea[name=description]', outcome_description
# add a new rating
f('.insert_rating').click
f('input[name="ratings[1][description]"]').send_keys('almost exceeds')
f('input[name="ratings[1][points]"]').send_keys('4')
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should show up in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li.outcome-link').
detect { |li| li.text == outcome_name }).not_to be_nil
# should show outcome in main content window
# title
expect(f(".outcomes-content .title").text).to eq outcome_name
# description
expect(f(".outcomes-content .description").text).to eq outcome_description
# ratings
ratings = ffj('table.criterion .rating')
expect(ratings.size).to eq 4
expect(ratings.map(&:text)).to eq [
"Exceeds Expectations\n5 Points",
"almost exceeds\n4 Points",
"Meets Expectations\n3 Points",
"Does Not Meet Expectations\n0 Points"
]
expect(f('table.criterion .total').text).to eq "Total Points\n5 Points"
# db
expect(LearningOutcome.where(short_description: outcome_name).first).to be_present
end
refresh_page
#select group
fj('.outcome-level:eq(0) .outcome-group').click
wait_for_ajaximations
def should_create_a_learning_outcome_nested
get outcome_url
wait_for_ajaximations
#select nested group
fj('.outcome-level:eq(1) .outcome-group').click
wait_for_ajaximations
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should show up in nested directory browser
expect(ffj('.outcomes-sidebar .outcome-level:eq(1) li.outcome-group').
detect { |li| li.text == nested_group_title }).not_to be_nil
# should show group in main content window
expect(f(".outcomes-content .title").text).to eq nested_group_title
# db
expect(LearningOutcomeGroup.where(title: nested_group_title).first).to be_present
end
# create outcome
f('.add_outcome_link').click
wait_for_ajaximations
outcome_name = 'first new outcome'
replace_content(f('.outcomes-content input[name=title]'), outcome_name)
def should_edit_an_outcome_group
edited_title = 'edited group'
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_group_model
get outcome_url
# submit
f('.submit_button').click
wait_for_ajaximations
refresh_page
# select group
f('.outcome-group').click
wait_for_ajaximations
# select nested outcome
f('.outcome-link').click
wait_for_ajaximations
fj('.outcomes-sidebar .outcome-level:first li.outcome-group').click
wait_for_ajaximations
## expect
# should show up in nested directory browser
expect(ffj('.outcomes-sidebar .outcome-level:eq(1) li.outcome-link').
detect { |li| li.text == outcome_name }).not_to be_nil
# should show outcome in main content window
expect(f(".outcomes-content .title").text).to eq outcome_name
# db
expect(LearningOutcome.where(short_description: outcome_name).first).to be_present
end
keep_trying_until do
def should_edit_a_learning_outcome_and_delete_a_rating
edited_title = 'edit outcome'
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li').click
wait_for_ajaximations
driver.execute_script("$('.edit_button').click()")
expect(fj('.outcomes-content input[name=title]')).to be_displayed
## when
# edit title
replace_content f('.outcomes-content input[name=title]'), edited_title
# delete a rating
f('.edit_rating').click
f('.delete_rating_link').click
# edit a rating
f('.edit_rating').click
replace_content f('input[name="ratings[0][points]"]'), '1'
replace_content f('input[name="mastery_points"]'), '1'
# submit
driver.execute_script "$('.submit_button').click()"
wait_for_ajaximations
## expect
# should be edited in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == edited_title }).not_to be_nil
# title
expect(f(".outcomes-content .title").text).to eq edited_title
# ratings
ratings = ffj('table.criterion .rating')
expect(ratings.size).to eq 1
expect(ratings.map(&:text)).to eq ["Lame\n1 Points"]
expect(f('table.criterion .total').text).to eq "Total Points\n1 Points"
# db
expect(LearningOutcome.where(short_description: edited_title).first).to be_present
end
replace_content f('.outcomes-content input[name=title]'), edited_title
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
def should_delete_a_learning_outcome
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li').click
wait_for_ajaximations
## expect
# should be edited in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == edited_title }).not_to be_nil
# title
expect(f(".outcomes-content .title").text).to eq edited_title
# db
expect(LearningOutcomeGroup.where(title: edited_title).first).to be_present
end
## when
# delete the outcome
driver.execute_script("$('.delete_button').click()")
driver.switch_to.alert.accept
wait_for_ajaximations
def should_delete_an_outcome_group
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_group_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li.outcome-group').click
wait_for_ajaximations
## when
# delete the outcome
## expect
# should not be showing on page
expect(ffj('.outcomes-sidebar .outcome-level:first li')).to be_empty
expect(f('.outcomes-content .title').text).to eq 'Setting up Outcomes'
# db
expect(LearningOutcome.where(id: @outcome).first.workflow_state).to eq 'deleted'
refresh_page # to make sure it was correctly deleted
ff('.learning_outcome').each { |outcome_element| expect(outcome_element).not_to be_displayed }
end
driver.execute_script("$('.delete_button').click()")
driver.switch_to.alert.accept
wait_for_ajaximations
def should_validate_mastery_points
get outcome_url
f('.add_outcome_link').click
# Must have title for correct validation message to appear.
replace_content(f('.outcomes-content input[name=title]'), 'Outcome Mastery')
## when
# not in ratings
replace_content f('input[name="mastery_points"]'), '-1'
# submit
f('.submit_button').click
wait_for_ajaximations
## expect
# should not be showing on page
expect(ffj('.outcomes-sidebar .outcome-level:first li')).to be_empty
expect(fj('.outcomes-content .title').text).to eq "Setting up Outcomes"
# db
expect(LearningOutcomeGroup.where(id: @outcome_group).first.workflow_state).to eq 'deleted'
refresh_page # to make sure it was correctly deleted
ffj('.learning_outcome').each { |outcome_element| expect(outcome_element).not_to be_displayed }
end
## expect
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("Must be greater than or equal to 0")
end
def should_validate_calculation_method_dropdown
get outcome_url
f('.add_outcome_link').click
# create array of drop down options
drop_down = get_options('#calculation_method').map(&:text)
expected_array = ['Decaying Average', 'n Number of Times', 'Most Recent Score', 'Highest Score']
# expect
expect(drop_down.length).to eq(4)
expect(drop_down).to match_array(expected_array)
end
def should_validate_decaying_average_below_range
get outcome_url
f('.add_outcome_link').click
below_range = 0
replace_content(f('.outcomes-content input[name=title]'), 'Decaying Average')
click_option('#calculation_method', "Decaying Average")
# enter invalid number below range
replace_content(f('input[name=calculation_int]'), below_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{below_range}' is not a valid value")
end
def should_validate_decaying_average_above_range
get outcome_url
f('.add_outcome_link').click
above_range = 100
replace_content(f('.outcomes-content input[name=title]'), 'Decaying Average')
click_option('#calculation_method', "Decaying Average")
# enter second invalid number above range
replace_content(f('input[name=calculation_int]'), above_range)
wait_for_ajaximations
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{above_range}' is not a valid value")
end
def should_validate_n_mastery_below_range
get outcome_url
f('.add_outcome_link').click
below_range = 1
replace_content(f('.outcomes-content input[name=title]'), 'n Number of Times')
click_option('#calculation_method', "n Number of Times")
# enter invalid number below range
replace_content(f('input[name=calculation_int]'), below_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{below_range}' is not a valid value")
end
def should_validate_n_mastery_above_range
get outcome_url
f('.add_outcome_link').click
above_range = 6
replace_content(f('.outcomes-content input[name=title]'), 'n Number of Times')
click_option('#calculation_method', "n Number of Times")
# enter invalid number above range
replace_content(f('input[name=calculation_int]'), above_range)
f('.submit_button').click
wait_for_ajaximations
expect(f('.error_box')).to be_present
expect(fj('.error_text div').text).to include("'#{above_range}' is not a valid value")
end
def should_validate_short_description_presence
get outcome_url
wait_for_ajaximations
f('.add_outcome_link').click
# Submit outcome with an empty title
f('.outcome_title').clear
f('.submit_button').click
wait_for_ajaximations
scroll_page_to_top
driver.execute_script("$('.outcomes-content').scrollTo(0, 0)")
wait_for_ajaximations
keep_trying_until { expect(fj('.error_text div').text).to eq "Cannot be blank" }
end
def should_validate_short_description_length
get outcome_url
wait_for_ajaximations
f('.add_outcome_link').click
content = ('Wee taco banana hello 255 characters exceeded' * 10)
replace_content f('.outcome_title'), (content)
f('.submit_button').click
wait_for_ajaximations
expect(fj('.error_text')).to be_present
end
def should_create_an_outcome_group_root_level
get outcome_url
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should show up in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == group_title }).not_to be_nil
# should show outcome in main content window
# title
expect(f(".outcomes-content .title").text).to eq group_title
# db
expect(LearningOutcomeGroup.where(title: group_title).first).to be_present
end
def should_create_an_outcome_group_nested
get outcome_url
## when
# create group
f('.add_outcome_group').click
group_title = 'my group'
replace_content f('.outcomes-content input[name=title]'), group_title
# submit
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
# create nested group
f('.add_outcome_group').click
nested_group_title = 'my nested group'
replace_content f('.outcomes-content input[name=title]'), nested_group_title
# submit
driver.execute_script("$('.submit_button').click()")
driver.execute_script("$('.submit_button').click()") unless f('.submit_button').nil?
refresh_page
# select group
fj('.outcome-level:eq(0) .outcome-group').click
wait_for_ajaximations
# select nested group
fj('.outcome-level:eq(1) .outcome-group').click
wait_for_ajaximations
## expect
# should show up in nested directory browser
expect(ffj('.outcomes-sidebar .outcome-level:eq(1) li.outcome-group').
detect { |li| li.text == nested_group_title }).not_to be_nil
# should show group in main content window
expect(f(".outcomes-content .title").text).to eq nested_group_title
# db
expect(LearningOutcomeGroup.where(title: nested_group_title).first).to be_present
end
def should_edit_an_outcome_group
edited_title = 'edited group'
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_group_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li.outcome-group').click
wait_for_ajaximations
keep_trying_until do
driver.execute_script("$('.edit_button').click()")
expect(fj('.outcomes-content input[name=title]')).to be_displayed
end
replace_content f('.outcomes-content input[name=title]'), edited_title
driver.execute_script("$('.submit_button').click()")
wait_for_ajaximations
## expect
# should be edited in directory browser
expect(ffj('.outcomes-sidebar .outcome-level:first li').detect { |li| li.text == edited_title }).not_to be_nil
# title
expect(f(".outcomes-content .title").text).to eq edited_title
# db
expect(LearningOutcomeGroup.where(title: edited_title).first).to be_present
end
def should_delete_an_outcome_group
who_to_login == 'teacher' ? @context = @course : @context = account
outcome_group_model
get outcome_url
fj('.outcomes-sidebar .outcome-level:first li.outcome-group').click
wait_for_ajaximations
## when
# delete the outcome
driver.execute_script("$('.delete_button').click()")
driver.switch_to.alert.accept
wait_for_ajaximations
## expect
# should not be showing on page
expect(ffj('.outcomes-sidebar .outcome-level:first li')).to be_empty
expect(fj('.outcomes-content .title').text).to eq "Setting up Outcomes"
# db
expect(LearningOutcomeGroup.where(id: @outcome_group).first.workflow_state).to eq 'deleted'
refresh_page # to make sure it was correctly deleted
ffj('.learning_outcome').each { |outcome_element| expect(outcome_element).not_to be_displayed }
end
end

View File

@ -1,6 +1,6 @@
require_relative "quizzes_common"
shared_context "quiz question selenium tests" do
module QuizQuestionsCommon
include QuizzesCommon
def create_oqaat_quiz(opts={})
@ -36,13 +36,17 @@ shared_context "quiz question selenium tests" do
def take_the_quiz
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
fj("a:contains('Take the Quiz')").click
wait_for_ajaximations
# sleep because display is updated on timer, not ajax callback
sleep 1
end
def preview_the_quiz
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
f("#preview_quiz_button").click
wait_for_ajaximations
# sleep because display is updated on timer, not ajax callback
sleep 1
end
def navigate_away_and_resume_quiz
@ -232,4 +236,4 @@ shared_context "quiz question selenium tests" do
submit_finished_quiz
keep_trying_until { it_should_show_two_correct_answers }
end
end
end

View File

@ -1,113 +1,115 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
def create_rubric_with_criterion_points(points)
get rubric_url
module RubricsCommon
def create_rubric_with_criterion_points(points)
get rubric_url
f("#right-side-wrapper .add_rubric_link").click
criterion_points = f("#criterion_1 .criterion_points")
set_value(criterion_points, points.to_s)
criterion_points.send_keys(:return)
submit_form('#edit_rubric_form')
wait_for_ajaximations
end
def assignment_with_rubric(points, title = 'new rubric')
@assignment = create_assignment_with_points(points)
rubric_model(title: title, data:
[{
description: "Some criterion",
points: points,
id: 'crit1',
ratings:
[{description: "Good", points: points, id: 'rat1', criterion_id: 'crit1'}]
}], description: 'new rubric description')
@association = @rubric.associate_with(@assignment, @course, purpose: 'grading', use_for_grading: false)
end
def edit_rubric_after_updating
fj(".rubric .edit_rubric_link:visible").click
driver.find_element(:tag_name, "body").click
end
# should be in editing mode before calling
def split_ratings(idx)
rating = ffj(".rubric .criterion:visible .rating")[idx]
driver.action.move_to(rating).perform
driver.execute_script <<-JS
var $rating = $('.rubric .criterion:visible .rating:eq(#{idx})');
$rating.addClass('add_column add_right');
$rating.prev().addClass('add_left');
$rating.click();
JS
end
def should_delete_a_rubric
create_rubric_with_criterion_points "5"
f('.delete_rubric_link').click
driver.switch_to.alert.accept
wait_for_ajaximations
keep_trying_until do
expect(Rubric.last.workflow_state).to eq 'deleted'
ff('#rubrics .rubric').each { |rubric| expect(rubric).not_to be_displayed }
f("#right-side-wrapper .add_rubric_link").click
criterion_points = f("#criterion_1 .criterion_points")
set_value(criterion_points, points.to_s)
criterion_points.send_keys(:return)
submit_form('#edit_rubric_form')
wait_for_ajaximations
end
end
def should_edit_a_rubric
edit_title = 'edited rubric'
create_rubric_with_criterion_points "5"
rubric = Rubric.last
f('.edit_rubric_link').click
replace_content(ff("#rubric_#{rubric.id} .rubric_title input")[1], edit_title)
submit_form(ff("#rubric_#{rubric.id} #edit_rubric_form")[1])
wait_for_ajaximations
keep_trying_until do
rubric.reload
expect(rubric.title).to eq edit_title
expect(f('.rubric_title .title').text).to eq edit_title
def assignment_with_rubric(points, title = 'new rubric')
@assignment = create_assignment_with_points(points)
rubric_model(title: title, data:
[{
description: "Some criterion",
points: points,
id: 'crit1',
ratings:
[{description: "Good", points: points, id: 'rat1', criterion_id: 'crit1'}]
}], description: 'new rubric description')
@association = @rubric.associate_with(@assignment, @course, purpose: 'grading', use_for_grading: false)
end
end
def should_allow_fractional_points
create_rubric_with_criterion_points "5.5"
expect(fj(".rubric .criterion:visible .display_criterion_points").text).to eq '5.5'
expect(fj(".rubric .criterion:visible .rating .points").text).to eq '5.5'
end
def edit_rubric_after_updating
fj(".rubric .edit_rubric_link:visible").click
driver.find_element(:tag_name, "body").click
end
def should_round_to_2_decimal_places
create_rubric_with_criterion_points "5.249"
expect(fj(".rubric .criterion:visible .display_criterion_points").text).to eq '5.25'
end
# should be in editing mode before calling
def split_ratings(idx)
rating = ffj(".rubric .criterion:visible .rating")[idx]
driver.action.move_to(rating).perform
def should_round_to_an_integer_when_splitting
create_rubric_with_criterion_points "5.5"
edit_rubric_after_updating
driver.execute_script <<-JS
var $rating = $('.rubric .criterion:visible .rating:eq(#{idx})');
$rating.addClass('add_column add_right');
$rating.prev().addClass('add_left');
$rating.click();
JS
end
split_ratings(1)
def should_delete_a_rubric
create_rubric_with_criterion_points "5"
f('.delete_rubric_link').click
driver.switch_to.alert.accept
wait_for_ajaximations
keep_trying_until do
expect(Rubric.last.workflow_state).to eq 'deleted'
ff('#rubrics .rubric').each { |rubric| expect(rubric).not_to be_displayed }
end
end
expect(ffj(".rubric .criterion:visible .rating .points")[1].text).to eq '3'
end
def should_edit_a_rubric
edit_title = 'edited rubric'
create_rubric_with_criterion_points "5"
rubric = Rubric.last
f('.edit_rubric_link').click
replace_content(ff("#rubric_#{rubric.id} .rubric_title input")[1], edit_title)
submit_form(ff("#rubric_#{rubric.id} #edit_rubric_form")[1])
wait_for_ajaximations
keep_trying_until do
rubric.reload
expect(rubric.title).to eq edit_title
expect(f('.rubric_title .title').text).to eq edit_title
end
end
def should_pick_the_lower_value_when_splitting_without_room_for_an_integer
create_rubric_with_criterion_points "0.5"
edit_rubric_after_updating
def should_allow_fractional_points
create_rubric_with_criterion_points "5.5"
expect(fj(".rubric .criterion:visible .display_criterion_points").text).to eq '5.5'
expect(fj(".rubric .criterion:visible .rating .points").text).to eq '5.5'
end
split_ratings(1)
def should_round_to_2_decimal_places
create_rubric_with_criterion_points "5.249"
expect(fj(".rubric .criterion:visible .display_criterion_points").text).to eq '5.25'
end
expect(ffj(".rubric .criterion:visible .rating .points").count).to eq 3
expect(ffj(".rubric .criterion:visible .rating .points")[1].text).to eq '0'
end
def should_round_to_an_integer_when_splitting
create_rubric_with_criterion_points "5.5"
edit_rubric_after_updating
def import_outcome
f('#right-side .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_ajaximations
f('.ui-dialog .btn-primary').click
accept_alert
wait_for_ajaximations
end
split_ratings(1)
expect(ffj(".rubric .criterion:visible .rating .points")[1].text).to eq '3'
end
def should_pick_the_lower_value_when_splitting_without_room_for_an_integer
create_rubric_with_criterion_points "0.5"
edit_rubric_after_updating
split_ratings(1)
expect(ffj(".rubric .criterion:visible .rating .points").count).to eq 3
expect(ffj(".rubric .criterion:visible .rating .points")[1].text).to eq '0'
end
def import_outcome
f('#right-side .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_ajaximations
f('.ui-dialog .btn-primary').click
accept_alert
wait_for_ajaximations
end
end

View File

@ -1,5 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
module SchedulerCommon
def fill_out_appointment_group_form(new_appointment_text, opts = {})
f('.create_link').click
edit_form = f('#edit_appointment_form')
@ -96,4 +97,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
click_al_option('.edit_link')
wait_for_ajaximations
end
end

View File

@ -1,30 +0,0 @@
def add_user (opts={})
f(".add_user_link").click
name = opts[:name] ? opts[:name] : "user1"
email = opts[:email] ? opts[:email] : "user1@test.com"
sortable_name = opts[:sortable_name] ? opts[:sortable_name] : name
confirmation = opts[:confirmation] ? opts[:confirmation] : 1
short_name = opts[:short_name] ? opts[:short_name] : name
if (!short_name.eql? name)
replace_content f("#user_short_name"), short_name
end
if (!sortable_name.eql? name)
replace_content f("#user_sortable_name"), sortable_name
end
expect(is_checked("#pseudonym_send_confirmation")).to be_truthy
if (confirmation == 0)
f("#pseudonym_send_confirmation").click
expect(is_checked("#pseudonym_send_confirmation")).to be_falsey
end
f("#add_user_form #user_name").send_keys name
f("#pseudonym_unique_id").send_keys email
submit_form("#add_user_form")
wait_for_ajax_requests
user = User.where(:name => name).first
expect(user).to be_present
expect(user.sortable_name).to eq sortable_name
expect(user.short_name).to eq short_name
expect(user.email).to eq email
user
end

View File

@ -1,29 +1,30 @@
def getpseudonym(user_sis_id)
pseudo = Pseudonym.where(sis_user_id: user_sis_id).first
expect(pseudo).not_to be_nil
pseudo
end
module SisGradePassbackCommon
def getpseudonym(user_sis_id)
pseudo = Pseudonym.where(sis_user_id: user_sis_id).first
expect(pseudo).not_to be_nil
pseudo
end
def getuser(user_sis_id)
user = getpseudonym(user_sis_id).user
expect(user).not_to be_nil
user
end
def getuser(user_sis_id)
user = getpseudonym(user_sis_id).user
expect(user).not_to be_nil
user
end
def getsection(section_sis_id)
section = CourseSection.where(sis_source_id: section_sis_id).first
expect(section).not_to be_nil
section
end
def getsection(section_sis_id)
section = CourseSection.where(sis_source_id: section_sis_id).first
expect(section).not_to be_nil
section
end
def getenroll(user_sis_id, section_sis_id)
e = Enrollment.where(user_id: getuser(user_sis_id).id, course_section_id: getsection(section_sis_id).id).first
expect(e).not_to be_nil
e
end
def getenroll(user_sis_id, section_sis_id)
e = Enrollment.where(user_id: getuser(user_sis_id).id, course_section_id: getsection(section_sis_id).id).first
expect(e).not_to be_nil
e
end
def grade_passback_setup(wait_for_success)
process_csv_data_cleanly(
def grade_passback_setup(wait_for_success)
process_csv_data_cleanly(
"user_id,login_id,password,first_name,last_name,email,status",
"T1,Teacher1,,T,1,t1@example.com,active",
"S1,Student1,,S,1,s1@example.com,active",
@ -31,20 +32,23 @@ def grade_passback_setup(wait_for_success)
"S3,Student3,,S,3,s3@example.com,active",
"S4,Student4,,S,4,s4@example.com,active",
"S5,Student5,,S,5,s5@example.com,active",
"S6,Student6,,S,6,s6@example.com,active")
process_csv_data_cleanly(
"S6,Student6,,S,6,s6@example.com,active"
)
process_csv_data_cleanly(
"course_id,short_name,long_name,account_id,term_id,status",
"C1,C1,C1,,,active")
@course = Course.where(sis_source_id: "C1").first
@course.assignment_groups.create(:name => "Assignments")
@teacher = getuser("T1")
process_csv_data_cleanly(
"C1,C1,C1,,,active"
)
@course = Course.where(sis_source_id: "C1").first
@course.assignment_groups.create(:name => "Assignments")
@teacher = getuser("T1")
process_csv_data_cleanly(
"section_id,course_id,name,status,start_date,end_date",
"S1,C1,S1,active,,",
"S2,C1,S2,active,,",
"S3,C1,S3,active,,",
"S4,C1,S4,active,,")
process_csv_data_cleanly(
"S4,C1,S4,active,,"
)
process_csv_data_cleanly(
"course_id,user_id,role,section_id,status",
",T1,teacher,S1,active",
",S1,student,S1,active",
@ -52,78 +56,79 @@ def grade_passback_setup(wait_for_success)
",S3,student,S2,active",
",S4,student,S1,active",
",S5,student,S3,active",
",S6,student,S4,active")
a1 = @course.assignments.create!(:title => "A1", :points_possible => 10)
a2 = @course.assignments.create!(:title => "A2", :points_possible => 10)
",S6,student,S4,active"
)
a1 = @course.assignments.create!(:title => "A1", :points_possible => 10)
a2 = @course.assignments.create!(:title => "A2", :points_possible => 10)
a1.grade_student(getuser("S1"), { :grade => "6", :grader => @teacher })
a1.grade_student(getuser("S2"), { :grade => "6", :grader => @teacher })
a1.grade_student(getuser("S3"), { :grade => "7", :grader => @teacher })
a1.grade_student(getuser("S5"), { :grade => "7", :grader => @teacher })
a1.grade_student(getuser("S6"), { :grade => "8", :grader => @teacher })
a2.grade_student(getuser("S1"), { :grade => "8", :grader => @teacher })
a2.grade_student(getuser("S2"), { :grade => "9", :grader => @teacher })
a2.grade_student(getuser("S3"), { :grade => "9", :grader => @teacher })
a2.grade_student(getuser("S5"), { :grade => "10", :grader => @teacher })
a2.grade_student(getuser("S6"), { :grade => "10", :grader => @teacher })
a1.grade_student(getuser("S1"), { :grade => "6", :grader => @teacher })
a1.grade_student(getuser("S2"), { :grade => "6", :grader => @teacher })
a1.grade_student(getuser("S3"), { :grade => "7", :grader => @teacher })
a1.grade_student(getuser("S5"), { :grade => "7", :grader => @teacher })
a1.grade_student(getuser("S6"), { :grade => "8", :grader => @teacher })
a2.grade_student(getuser("S1"), { :grade => "8", :grader => @teacher })
a2.grade_student(getuser("S2"), { :grade => "9", :grader => @teacher })
a2.grade_student(getuser("S3"), { :grade => "9", :grader => @teacher })
a2.grade_student(getuser("S5"), { :grade => "10", :grader => @teacher })
a2.grade_student(getuser("S6"), { :grade => "10", :grader => @teacher })
@stud5, @stud6, @sec4 = nil, nil, nil
Pseudonym.where(sis_user_id: "S5").first.tap do |p|
@stud5 = p
p.sis_user_id = nil
p.save
end
@stud5, @stud6, @sec4 = nil, nil, nil
Pseudonym.where(sis_user_id: "S5").first.tap do |p|
@stud5 = p
p.sis_user_id = nil
p.save
end
Pseudonym.where(sis_user_id: "S6").first.tap do |p|
@stud6 = p
p.sis_user_id = nil
p.save
end
Pseudonym.where(sis_user_id: "S6").first.tap do |p|
@stud6 = p
p.sis_user_id = nil
p.save
end
getsection("S4").tap do |s|
@sec4 = s
s.sis_source_id = nil
s.save
end
getsection("S4").tap do |s|
@sec4 = s
s.sis_source_id = nil
s.save
end
@course.grading_standard_enabled = true
@course.save!
GradeCalculator.recompute_final_score(["S1", "S2", "S3", "S4"].map{ |x| getuser(x).id}, @course.id)
@course.reload
@course.grading_standard_enabled = true
@course.save!
GradeCalculator.recompute_final_score(["S1", "S2", "S3", "S4"].map{ |x| getuser(x).id}, @course.id)
@course.reload
@plugin = Canvas::Plugin.find!('grade_export')
@ps = PluginSetting.new(:name => @plugin.id, :settings => @plugin.default_settings)
@ps.posted_settings = @plugin.default_settings.merge({
:format_type => "instructure_csv",
:wait_for_success => wait_for_success ? "yes" : "no",
:publish_endpoint => "http://localhost/endpoint"
})
@ps.save!
@plugin = Canvas::Plugin.find!('grade_export')
@ps = PluginSetting.new(:name => @plugin.id, :settings => @plugin.default_settings)
@ps.posted_settings = @plugin.default_settings.merge({
:format_type => "instructure_csv",
:wait_for_success => wait_for_success ? "yes" : "no",
:publish_endpoint => "http://localhost/endpoint"
})
@ps.save!
@course.offer!
user_session(@teacher)
@course.offer!
user_session(@teacher)
@course.grading_standard_id = 0
@course.save!
@course.grading_standard_id = 0
@course.save!
get "/courses/#{@course.id}/settings"
f("#tab-grade-publishing-link").click
wait_for_ajaximations
get "/courses/#{@course.id}/settings"
f("#tab-grade-publishing-link").click
wait_for_ajaximations
expect(f("#publish_grades_messages").text).to eq "Unpublished - 6"
driver.execute_script "window.confirm = function(msg) { return true; }"
expect(f("#publish_grades_messages").text).to eq "Unpublished - 6"
driver.execute_script "window.confirm = function(msg) { return true; }"
csv =
"publisher_id,publisher_sis_id,section_id,section_sis_id,student_id," +
"student_sis_id,enrollment_id,enrollment_status,score,grade\n" +
"#{@teacher.id},T1,#{getsection('S1').id},S1,#{getpseudonym('S1').user.id},S1,#{getenroll("S1", "S1").id},active,70,C-\n" +
"#{@teacher.id},T1,#{getsection('S2').id},S2,#{getpseudonym('S2').user.id},S2,#{getenroll("S2", "S2").id},active,75,C\n" +
"#{@teacher.id},T1,#{getsection('S2').id},S2,#{getpseudonym('S3').user.id},S3,#{getenroll("S3", "S2").id},active,80,B-\n" +
"#{@teacher.id},T1,#{getsection('S1').id},S1,#{getpseudonym('S4').user.id},S4,#{getenroll("S4", "S1").id},active,0,F\n" +
"#{@teacher.id},T1,#{getsection('S3').id},S3,#{@stud5.id},,#{Enrollment.where(user_id: @stud5.user.id, course_section_id: getsection("S3").first.id).id},active,85,B\n" +
csv = "publisher_id,publisher_sis_id,section_id,section_sis_id,student_id," \
"student_sis_id,enrollment_id,enrollment_status,score,grade\n" \
"#{@teacher.id},T1,#{getsection('S1').id},S1,#{getpseudonym('S1').user.id},S1,#{getenroll('S1', 'S1').id},active,70,C-\n" \
"#{@teacher.id},T1,#{getsection('S2').id},S2,#{getpseudonym('S2').user.id},S2,#{getenroll('S2', 'S2').id},active,75,C\n" \
"#{@teacher.id},T1,#{getsection('S2').id},S2,#{getpseudonym('S3').user.id},S3,#{getenroll('S3', 'S2').id},active,80,B-\n" \
"#{@teacher.id},T1,#{getsection('S1').id},S1,#{getpseudonym('S4').user.id},S4,#{getenroll('S4', 'S1').id},active,0,F\n" \
"#{@teacher.id},T1,#{getsection('S3').id},S3,#{@stud5.id},,#{Enrollment.where(user_id: @stud5.user.id, course_section_id: getsection('S3').first.id).id},active,85,B\n" \
"#{@teacher.id},T1,#{@sec4.id},,#{@stud6.id},,#{Enrollment.where(user_id: @stud6.user.id, course_section_id: @sec4.id).first.id},active,90,A-\n"
SSLCommon.expects(:post_data).with("http://localhost/endpoint", csv, "text/csv", {})
f("#publish_grades_link").click
wait_for_ajaximations
expect(f("#publish_grades_messages").text).to eq(wait_for_success ? "Publishing - 6" : "Published - 6")
SSLCommon.expects(:post_data).with("http://localhost/endpoint", csv, "text/csv", {})
f("#publish_grades_link").click
wait_for_ajaximations
expect(f("#publish_grades_messages").text).to eq(wait_for_success ? "Publishing - 6" : "Published - 6")
end
end

View File

@ -1,68 +1,70 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
def student_submission(options = {})
submission_model({:assignment => @assignment, :body => "first student submission text"}.merge(options))
end
def goto_section(section_id)
f("#combo_box_container .ui-selectmenu-icon").click
driver.execute_script("$('#section-menu-link').trigger('mouseenter')")
f("#section-menu .section_#{section_id}").click
wait_for_ajaximations
end
def set_turnitin_asset(asset, asset_data)
@submission.turnitin_data ||= {}
@submission.turnitin_data[asset.asset_string] = asset_data
@submission.turnitin_data_changed!
@submission.save!
end
def create_and_enroll_students(num_to_create)
@students = []
num_to_create.times do |i|
s = User.create!(:name => "student #{i}")
@course.enroll_student(s)
@students << s
module SpeedGraderCommon
def student_submission(options = {})
submission_model({:assignment => @assignment, :body => "first student submission text"}.merge(options))
end
@students
end
def add_attachment_student_assignment(file, student, path)
attachment = student.attachments.new
attachment.uploaded_data = Rack::Test::UploadedFile.new(path, Attachment.mimetype(path))
attachment.save!
@assignment.submit_homework(student, :submission_type => :online_upload, :attachments => [attachment])
end
def goto_section(section_id)
f("#combo_box_container .ui-selectmenu-icon").click
driver.execute_script("$('#section-menu-link').trigger('mouseenter')")
f("#section-menu .section_#{section_id}").click
wait_for_ajaximations
end
def submit_and_grade_homework(student, grade)
@assignment.submit_homework(student)
@assignment.grade_student(student, :grade => grade)
end
def set_turnitin_asset(asset, asset_data)
@submission.turnitin_data ||= {}
@submission.turnitin_data[asset.asset_string] = asset_data
@submission.turnitin_data_changed!
@submission.save!
end
# Creates a dummy rubric and scores its criteria as specified in the parameters (passed as strings)
def setup_and_grade_rubric(score1, score2)
student_submission
@association.save!
def create_and_enroll_students(num_to_create)
@students = []
num_to_create.times do |i|
s = User.create!(:name => "student #{i}")
@course.enroll_student(s)
@students << s
end
@students
end
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
wait_for_ajaximations
def add_attachment_student_assignment(_file, student, path)
attachment = student.attachments.new
attachment.uploaded_data = Rack::Test::UploadedFile.new(path, Attachment.mimetype(path))
attachment.save!
@assignment.submit_homework(student, :submission_type => :online_upload, :attachments => [attachment])
end
f('.toggle_full_rubric').click
wait_for_ajaximations
rubric = f('#rubric_full')
def submit_and_grade_homework(student, grade)
@assignment.submit_homework(student)
@assignment.grade_student(student, :grade => grade)
end
rubric_inputs = rubric.find_elements(:css, 'input.criterion_points')
rubric_inputs[0].send_keys(score1)
rubric_inputs[1].send_keys(score2)
end
# Creates a dummy rubric and scores its criteria as specified in the parameters (passed as strings)
def setup_and_grade_rubric(score1, score2)
student_submission
@association.save!
def clear_grade_and_validate
@assignment.grade_student @students[0], {grade: ''}
@assignment.grade_student @students[1], {grade: ''}
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
wait_for_ajaximations
refresh_page
expect(f('#grading-box-extended').attribute 'value').to eq ''
f('a.next').click
expect(f('#grading-box-extended').attribute 'value').to eq ''
end
f('.toggle_full_rubric').click
wait_for_ajaximations
rubric = f('#rubric_full')
rubric_inputs = rubric.find_elements(:css, 'input.criterion_points')
rubric_inputs[0].send_keys(score1)
rubric_inputs[1].send_keys(score2)
end
def clear_grade_and_validate
@assignment.grade_student @students[0], {grade: ''}
@assignment.grade_student @students[1], {grade: ''}
refresh_page
expect(f('#grading-box-extended').attribute 'value').to eq ''
f('a.next').click
expect(f('#grading-box-extended').attribute 'value').to eq ''
end
end

View File

@ -1,43 +1,44 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
def create_assignment(type = 'online_text_entry')
assignment = @course.assignments.build({
:name => 'media assignment',
:submission_types => type
})
assignment.workflow_state = 'published'
assignment.save!
assignment
end
module SubmissionsCommon
def create_assignment(type = 'online_text_entry')
assignment = @course.assignments.build({
:name => 'media assignment',
:submission_types => type
})
assignment.workflow_state = 'published'
assignment.save!
assignment
end
def create_assignment_and_go_to_page(type = 'online_text_entry')
assignment = create_assignment type
get "/courses/#{@course.id}/assignments/#{assignment.id}"
assignment
end
def create_assignment_and_go_to_page(type = 'online_text_entry')
assignment = create_assignment type
get "/courses/#{@course.id}/assignments/#{assignment.id}"
assignment
end
def open_media_comment_dialog
f('.media_comment_link').click
# swf and stuff loads, give it a sec to do its thing
sleep 0.5
end
def open_media_comment_dialog
f('.media_comment_link').click
# swf and stuff loads, give it a sec to do its thing
sleep 0.5
end
def submit_media_comment_1
open_media_comment_dialog
# pretend like we are flash sending data to the JS
driver.execute_script <<-JS
var entries1 = [{"duration":1.664,"thumbnailUrl":"http://www.instructuremedia.com/p/100/sp/10000/thumbnail/entry_id/0_jd6ger47/version/0","numComments":-1,"status":1,"rank":-1,"userScreenName":"_100_1_1","displayCredit":"_100_1_1","partnerLandingPage":null,"dataUrl":"http://www.instructuremedia.com/p/100/sp/10000/flvclipper/entry_id/0_jd6ger47/version/100000","sourceLink":"","subpId":10000,"puserId":"1_1","views":0,"height":0,"description":null,"hasThumbnail":false,"width":0,"kshowId":"0_pb7id2lf","kuserId":"","userLandingPage":"","mediaType":2,"plays":0,"partnerId":100,"adminTags":"","entryVersion":"","downloadUrl":"http://www.instructuremedia.com/p/100/sp/10000/raw/entry_id/0_jd6ger47/version/100000","createdAtDate":"1970-01-16T09:24:02.931Z","votes":-1,"uploaderName":null,"tags":"","entryName":"ryanf@instructure.com 2012-02-21T16:48:37.729Z","entryType":1,"entryId":"0_jd6ger47","createdAtAsInt":1329842931,"uid":"E78A81CC-D03D-CD10-B449-A0D0D172EF38"}]
addEntryComplete(entries1)
JS
wait_for_ajax_requests
end
def submit_media_comment_2
open_media_comment_dialog
driver.execute_script <<-JS
var entries2 = [{"duration":1.829,"thumbnailUrl":"http://www.instructuremedia.com/p/100/sp/10000/thumbnail/entry_id/0_5hcd9mro/version/0","numComments":-1,"status":1,"rank":-1,"userScreenName":"_100_1_1","displayCredit":"_100_1_1","partnerLandingPage":null,"dataUrl":"http://www.instructuremedia.com/p/100/sp/10000/flvclipper/entry_id/0_5hcd9mro/version/100000","sourceLink":"","subpId":10000,"puserId":"1_1","views":0,"height":0,"description":null,"hasThumbnail":false,"width":0,"kshowId":"0_pb7id2lf","kuserId":"","userLandingPage":"","mediaType":2,"plays":0,"partnerId":100,"adminTags":"","entryVersion":"","downloadUrl":"http://www.instructuremedia.com/p/100/sp/10000/raw/entry_id/0_5hcd9mro/version/100000","createdAtDate":"1970-01-16T09:24:03.563Z","votes":-1,"uploaderName":null,"tags":"","entryName":"ryanf@instructure.com 2012-02-21T16:59:11.249Z","entryType":1,"entryId":"0_5hcd9mro","createdAtAsInt":1329843563,"uid":"22A2C625-5FAB-AF3A-1A76-A0DA7572BFE4"}]
addEntryComplete(entries2)
JS
wait_for_ajax_requests
end
def submit_media_comment_1
open_media_comment_dialog
# pretend like we are flash sending data to the JS
driver.execute_script <<-JS
var entries1 = [{"duration":1.664,"thumbnailUrl":"http://www.instructuremedia.com/p/100/sp/10000/thumbnail/entry_id/0_jd6ger47/version/0","numComments":-1,"status":1,"rank":-1,"userScreenName":"_100_1_1","displayCredit":"_100_1_1","partnerLandingPage":null,"dataUrl":"http://www.instructuremedia.com/p/100/sp/10000/flvclipper/entry_id/0_jd6ger47/version/100000","sourceLink":"","subpId":10000,"puserId":"1_1","views":0,"height":0,"description":null,"hasThumbnail":false,"width":0,"kshowId":"0_pb7id2lf","kuserId":"","userLandingPage":"","mediaType":2,"plays":0,"partnerId":100,"adminTags":"","entryVersion":"","downloadUrl":"http://www.instructuremedia.com/p/100/sp/10000/raw/entry_id/0_jd6ger47/version/100000","createdAtDate":"1970-01-16T09:24:02.931Z","votes":-1,"uploaderName":null,"tags":"","entryName":"ryanf@instructure.com 2012-02-21T16:48:37.729Z","entryType":1,"entryId":"0_jd6ger47","createdAtAsInt":1329842931,"uid":"E78A81CC-D03D-CD10-B449-A0D0D172EF38"}]
addEntryComplete(entries1)
JS
wait_for_ajax_requests
end
def submit_media_comment_2
open_media_comment_dialog
driver.execute_script <<-JS
var entries2 = [{"duration":1.829,"thumbnailUrl":"http://www.instructuremedia.com/p/100/sp/10000/thumbnail/entry_id/0_5hcd9mro/version/0","numComments":-1,"status":1,"rank":-1,"userScreenName":"_100_1_1","displayCredit":"_100_1_1","partnerLandingPage":null,"dataUrl":"http://www.instructuremedia.com/p/100/sp/10000/flvclipper/entry_id/0_5hcd9mro/version/100000","sourceLink":"","subpId":10000,"puserId":"1_1","views":0,"height":0,"description":null,"hasThumbnail":false,"width":0,"kshowId":"0_pb7id2lf","kuserId":"","userLandingPage":"","mediaType":2,"plays":0,"partnerId":100,"adminTags":"","entryVersion":"","downloadUrl":"http://www.instructuremedia.com/p/100/sp/10000/raw/entry_id/0_5hcd9mro/version/100000","createdAtDate":"1970-01-16T09:24:03.563Z","votes":-1,"uploaderName":null,"tags":"","entryName":"ryanf@instructure.com 2012-02-21T16:59:11.249Z","entryType":1,"entryId":"0_5hcd9mro","createdAtAsInt":1329843563,"uid":"22A2C625-5FAB-AF3A-1A76-A0DA7572BFE4"}]
addEntryComplete(entries2)
JS
wait_for_ajax_requests
end
end

View File

@ -1,170 +1,171 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
def open_theme_editor_with_btn
fj('.btn.button-sidebar-wide').click
end
def open_theme_editor(account_id)
get "/accounts/#{account_id}/theme_editor"
wait_for_ajaximations
end
# the close mechanism only works with beta and not with how it is in master
def close_theme_editor
fj('button:contains("Cancel")').click
end
def select_template(template)
# "Canvas Default" "K12 Theme"
select_list = Selenium::WebDriver::Support::Select.new(fj('#sharedThemes'))
select_list.select_by(:text, template)
end
def apply_settings
f('div.Theme__editor-header_actions > span').click
wait_for_ajaximations
preview_your_changes
accept_alert
end
def preview_your_changes
f('button.Button.Button--primary > span').click
wait_for_ajaximations
end
def single_warning_message
f('.ic-Form-message--error')
end
def all_warning_messages
ff('.ic-Form-message--error')
end
def click_global_branding
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:first-child').click
wait_for_ajaximations
end
def click_global_navigation
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:nth-of-type(2)').click
wait_for_ajaximations
end
def click_watermarks_and_other_images
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:nth-of-type(3)').click
wait_for_ajaximations
end
# finds a hex text input by its text label
# i.e. 'Primary Color'
def find_theme_text_input(text_label)
js_string =
"$('label').filter(function(){return $(this).text() === '#{text_label}'}).siblings('.Theme__editor-color-block').find('.Theme__editor-color-block_input-text')"
driver.execute_script(js_string)
end
def primary_color(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def primary_button(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def primary_button_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def secondary_button(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def secondary_button_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def link(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_background(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_icon(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_icon_active(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_text_active(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_avatar_border(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_badge(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(7) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(7) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def logo_background(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(8) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(8) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def window_title_color(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(3) > section.Theme__editor-accordion_element.Theme__editor-color.ic-Form-control > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(3) > section.Theme__editor-accordion_element.Theme__editor-color.ic-Form-control > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def all_global_branding(option = 'text_field')
[primary_color(option), primary_button(option), primary_button_text(option), secondary_button(option), secondary_button_text(option), link(option)]
end
def all_global_navigation(option = 'text_field')
[nav_background(option), nav_icon(option), nav_icon_active(option), nav_text(option), nav_text_active(option), nav_avatar_border(option), nav_badge(option), logo_background(option)]
end
def all_watermarks(option = 'text_field')
[window_title_color(option)]
end
def all_colors(array, color = 'random')
array.each do |x|
x.send_keys(color) if color != 'random'
x.send_keys(random_hex_color) if color == 'random'
module ThemeEditorCommon
def open_theme_editor_with_btn
fj('.btn.button-sidebar-wide').click
end
end
def create_theme(color = 'random')
click_global_branding
all_colors(all_global_branding, color)
def open_theme_editor(account_id)
get "/accounts/#{account_id}/theme_editor"
wait_for_ajaximations
end
click_global_navigation
all_colors(all_global_navigation, color)
# the close mechanism only works with beta and not with how it is in master
def close_theme_editor
fj('button:contains("Cancel")').click
end
click_watermarks_and_other_images
all_colors(all_watermarks, color)
def select_template(template)
# "Canvas Default" "K12 Theme"
select_list = Selenium::WebDriver::Support::Select.new(fj('#sharedThemes'))
select_list.select_by(:text, template)
end
def apply_settings
f('div.Theme__editor-header_actions > span').click
wait_for_ajaximations
preview_your_changes
accept_alert
end
def preview_your_changes
f('button.Button.Button--primary > span').click
wait_for_ajaximations
end
def single_warning_message
f('.ic-Form-message--error')
end
def all_warning_messages
ff('.ic-Form-message--error')
end
def click_global_branding
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:first-child').click
wait_for_ajaximations
end
def click_global_navigation
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:nth-of-type(2)').click
wait_for_ajaximations
end
def click_watermarks_and_other_images
f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > h3:nth-of-type(3)').click
wait_for_ajaximations
end
# finds a hex text input by its text label
# i.e. 'Primary Color'
def find_theme_text_input(text_label)
js_string =
"$('label').filter(function(){return $(this).text() === '#{text_label}'}).siblings('.Theme__editor-color-block').find('.Theme__editor-color-block_input-text')"
driver.execute_script(js_string)
end
def primary_color(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def primary_button(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def primary_button_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def secondary_button(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def secondary_button_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def link(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(1) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_background(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:first-child > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_icon(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(2) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_icon_active(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(3) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_text(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(4) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_text_active(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(5) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_avatar_border(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(6) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def nav_badge(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(7) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(7) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def logo_background(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(8) > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(2) > section:nth-of-type(8) > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def window_title_color(option = 'text_field')
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(3) > section.Theme__editor-accordion_element.Theme__editor-color.ic-Form-control > div.Theme__editor-form--color > div.Theme__editor-color-block > span > input.Theme__editor-color-block_input-text.Theme__editor-color-block_input') if option == 'text_field'
return f('div.accordion.ui-accordion--mini.Theme__editor-accordion.ui-accordion.ui-widget.ui-helper-reset > div:nth-of-type(3) > section.Theme__editor-accordion_element.Theme__editor-color.ic-Form-control > div.Theme__editor-form--color > div.Theme__editor-color-block > label.Theme__editor-color-label.Theme__editor-color-block_label-sample') if option == 'color_box'
end
def all_global_branding(option = 'text_field')
[primary_color(option), primary_button(option), primary_button_text(option), secondary_button(option), secondary_button_text(option), link(option)]
end
def all_global_navigation(option = 'text_field')
[nav_background(option), nav_icon(option), nav_icon_active(option), nav_text(option), nav_text_active(option), nav_avatar_border(option), nav_badge(option), logo_background(option)]
end
def all_watermarks(option = 'text_field')
[window_title_color(option)]
end
def all_colors(array, color = 'random')
array.each do |x|
x.send_keys(color) if color != 'random'
x.send_keys(random_hex_color) if color == 'random'
end
end
def create_theme(color = 'random')
click_global_branding
all_colors(all_global_branding, color)
click_global_navigation
all_colors(all_global_navigation, color)
click_watermarks_and_other_images
all_colors(all_watermarks, color)
end
end

View File

@ -0,0 +1,30 @@
module UsersCommon
def add_user(opts={})
f(".add_user_link").click
name = opts[:name] ? opts[:name] : "user1"
email = opts[:email] ? opts[:email] : "user1@test.com"
sortable_name = opts[:sortable_name] ? opts[:sortable_name] : name
confirmation = opts[:confirmation] ? opts[:confirmation] : 1
short_name = opts[:short_name] ? opts[:short_name] : name
replace_content f("#user_short_name"), short_name unless short_name.eql? name
replace_content f("#user_sortable_name"), sortable_name unless sortable_name.eql? name
expect(is_checked("#pseudonym_send_confirmation")).to be_truthy
if confirmation == 0
f("#pseudonym_send_confirmation").click
expect(is_checked("#pseudonym_send_confirmation")).to be_falsey
end
f("#add_user_form #user_name").send_keys name
f("#pseudonym_unique_id").send_keys email
submit_form("#add_user_form")
wait_for_ajax_requests
user = User.where(:name => name).first
expect(user).to be_present
expect(user.sortable_name).to eq sortable_name
expect(user.short_name).to eq short_name
expect(user.email).to eq email
user
end
end

View File

@ -1,5 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../common')
module WikiAndTinyCommon
def clear_wiki_rce
wiki_page_body = driver.find_element(:css, 'textarea.body')
wiki_page_body.clear
@ -186,4 +187,5 @@ require File.expand_path(File.dirname(__FILE__) + '/../common')
f("[aria-label=\'#{button_aria}\'] .mce-open").send_keys(:shift) # no content but gives the italic button focus
f("[aria-label=\'#{button_aria}\'] .mce-open").click
f("div[data-mce-color=\'#{mce_color}\']").click
end
end
end

View File

@ -5,67 +5,67 @@ describe "student interactions report" do
context "as a student" do
before (:each) do
course_with_teacher_logged_in(:active_all => true)
@student1 = student_in_course(:active_all => true).user
@student2 = student_in_course(:active_all => true, :name => "zzz student").user
before(:each) do
course_with_teacher_logged_in(:active_all => true)
@student1 = student_in_course(:active_all => true).user
@student2 = student_in_course(:active_all => true, :name => "zzz student").user
@assignment = @course.assignments.create(:name => "first assignment", :points_possible => 10)
@sub1 = @assignment.submissions.create(:user => @student1)
@sub2 = @assignment.submissions.create(:user => @student2)
@assignment = @course.assignments.create(:name => "first assignment", :points_possible => 10)
@sub1 = @assignment.submissions.create(:user => @student1)
@sub2 = @assignment.submissions.create(:user => @student2)
@sub1.update_attribute(:score, 10)
@sub2.update_attribute(:score, 5)
@sub1.update_attribute(:score, 10)
@sub2.update_attribute(:score, 5)
get "/users/#{@teacher.id}/teacher_activity/course/#{@course.id}"
get "/users/#{@teacher.id}/teacher_activity/course/#{@course.id}"
end
it "should have sortable columns, except the email header" do
ths = ff(".report th")
expect(ths[0]).to have_class("header")
expect(ths[1]).to have_class("header")
expect(ths[2]).to have_class("header")
expect(ths[3]).to have_class("header")
expect(ths[4]).to have_class("header")
expect(ths[5]).not_to have_class("header")
end
it "should allow sorting by columns" do
ths = ff(".report th")
trs = ff(".report tbody tr")
ths[0].click
wait_for_ajaximations
expect(ths[0]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[0].click
wait_for_ajaximations
expect(ths[0]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[2].click
wait_for_ajaximations
expect(ths[2]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[2].click
wait_for_ajaximations
expect(ths[2]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[3].click
wait_for_ajaximations
expect(ths[3]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[3].click
wait_for_ajaximations
expect(ths[3]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[5].click
wait_for_ajaximations
expect(ths[5]).not_to have_class("header")
end
end
it "should have sortable columns, except the email header" do
ths = ff(".report th")
expect(ths[0]).to have_class("header")
expect(ths[1]).to have_class("header")
expect(ths[2]).to have_class("header")
expect(ths[3]).to have_class("header")
expect(ths[4]).to have_class("header")
expect(ths[5]).not_to have_class("header")
end
it "should allow sorting by columns" do
ths = ff(".report th")
trs = ff(".report tbody tr")
ths[0].click
wait_for_ajaximations
expect(ths[0]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[0].click
wait_for_ajaximations
expect(ths[0]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[2].click
wait_for_ajaximations
expect(ths[2]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[2].click
wait_for_ajaximations
expect(ths[2]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[3].click
wait_for_ajaximations
expect(ths[3]).to have_class("headerSortDown")
expect(ff(".report tbody tr")).to eq [trs[0], trs[1]]
ths[3].click
wait_for_ajaximations
expect(ths[3]).to have_class("headerSortUp")
expect(ff(".report tbody tr")).to eq [trs[1], trs[0]]
ths[5].click
wait_for_ajaximations
expect(ths[5]).not_to have_class("header")
end
end
end

View File

@ -3,8 +3,9 @@ require 'thread'
describe "manage groups students" do
include_context "in-process server selenium tests"
include ManageGroupsCommon
before (:each) do
before(:each) do
skip
#course_with_teacher_logged_in
#Account.default.settings[:enable_manage_groups2] = false

View File

@ -3,8 +3,9 @@ require 'thread'
describe "manage groups" do
include_context "in-process server selenium tests"
include ManageGroupsCommon
before (:each) do
before(:each) do
course_with_teacher_logged_in
end

View File

@ -3,14 +3,16 @@ require 'thread'
describe "manage groups" do
include_context "in-process server selenium tests"
include GroupsCommon
include ManageGroupsCommon
before (:each) do
before(:each) do
course_with_teacher_logged_in
end
# TODO: Remove this whole section after new UI becomes default
context "with old UI" do
before :each do
before(:each) do
#TODO: Remove this setting once made the default behavior
account = Account.default
account.settings[:enable_manage_groups2] = false

View File

@ -2,11 +2,13 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/outcome_common')
describe "outcomes" do
include_context "in-process server selenium tests"
include OutcomeCommon
let(:who_to_login) { 'teacher' }
let(:outcome_url) { "/courses/#{@course.id}/outcomes" }
describe "course outcomes" do
before (:each) do
before(:each) do
course_with_teacher_logged_in
end

View File

@ -2,6 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/outcome_common')
describe "outcomes as a student" do
include_context "in-process server selenium tests"
include OutcomeCommon
let(:who_to_login) { 'student' }
let(:outcome_url) { "/courses/#{@course.id}/outcomes" }

View File

@ -2,6 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/outcome_common')
describe "outcomes as a teacher" do
include_context "in-process server selenium tests"
include OutcomeCommon
let(:who_to_login) { 'teacher' }
let(:outcome_url) { "/courses/#{@course.id}/outcomes" }

View File

@ -3,9 +3,9 @@ require_relative "../helpers/quiz_questions_common"
describe 'taking a quiz one question at a time' do
include_context 'in-process server selenium tests'
include_context 'quiz question selenium tests'
include QuizQuestionsCommon
before(:each) do
before(:once) do
create_oqaat_quiz(publish: true)
end
@ -19,7 +19,7 @@ describe 'taking a quiz one question at a time' do
before(:each) do
@quiz.update_attribute(:cant_go_back, false)
take_the_quiz
begin_quiz
end
it 'allows going back to previous questions', priority: "1", test_id: 140611 do
@ -129,7 +129,7 @@ describe 'taking a quiz one question at a time' do
@quiz.update_attribute(:cant_go_back, true)
preview_the_quiz
end
it 'prevents going back to previous questions', priority: "1", test_id: 209374 do
it_should_show_cant_go_back_warning
accept_cant_go_back_warning

View File

@ -7,7 +7,6 @@ describe 'drag and drop reordering' do
before(:each) do
course_with_teacher_logged_in
@last_quiz = start_quiz_question
resize_screen_to_normal
quiz_with_new_questions
create_question_group
@ -26,9 +25,11 @@ describe 'drag and drop reordering' do
it 'should add questions to a group', priority: "1", test_id: 140588 do
resize_screen_to_default
# drag it into the group
click_questions_tab
drag_question_into_group @quest1.id, @group.id
create_question_group
drag_question_into_group(@quest1.id, @group.id)
drag_question_into_group(@quest2.id, @group.id)
click_save_settings_button
refresh_page
group_should_contain_question(@group, @quest1)
end
@ -45,6 +46,7 @@ describe 'drag and drop reordering' do
it 'should reorder questions within a group', priority: "1", test_id: 201952 do
resize_screen_to_default
create_question_group
drag_question_into_group @quest1.id, @group.id
drag_question_into_group @quest2.id, @group.id
data = get_question_data_for_group @group.id
@ -60,7 +62,6 @@ describe 'drag and drop reordering' do
it 'should reorder groups and questions', priority: "1", test_id: 206020 do
click_questions_tab
old_data = get_question_data
drag_group_to_top @group.id
refresh_page

View File

@ -1,12 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/helpers/rubrics_common')
describe "teacher shared rubric specs" do
include_context "in-process server selenium tests"
include RubricsCommon
let(:rubric_url) { "/courses/#{@course.id}/rubrics" }
let(:who_to_login) { 'teacher' }
before (:each) do
before(:each) do
resize_screen_to_normal
course_with_teacher_logged_in
end
@ -39,6 +40,7 @@ end
describe "course rubrics" do
include_context "in-process server selenium tests"
include RubricsCommon
context "as a teacher" do

View File

@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/gradebook2_common')
describe "speed grader" do
include_context "in-process server selenium tests"
include Gradebook2Common
include SpeedGraderCommon
before(:once) do
stub_kaltura

View File

@ -9,6 +9,9 @@ describe 'Speedgrader' do
include_context "in-process server selenium tests"
include QuizzesCommon
include Gradebook2Common
include GroupsCommon
include AssignmentsCommon
include SpeedGraderCommon
let(:rubric_data) do
[

View File

@ -7,6 +7,7 @@ describe "speed grader" do
include_context "in-process server selenium tests"
include QuizzesCommon
include Gradebook2Common
include SpeedGraderCommon
before(:each) do
stub_kaltura

View File

@ -2,8 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/speed_grader_common'
describe "speed grader submissions" do
include_context "in-process server selenium tests"
include SpeedGraderCommon
before (:each) do
before(:each) do
stub_kaltura
course_with_teacher_logged_in

View File

@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/assignments_common')
describe "assignments" do
include_context "in-process server selenium tests"
include AssignmentsCommon
def click_away_accept_alert
f('#section-tabs .home').click
@ -16,7 +17,7 @@ describe "assignments" do
end
context "as a student" do
before (:each) do
before(:each) do
course_with_student_logged_in
end
@ -78,5 +79,4 @@ describe "assignments" do
expect(f('#tool_content')).to be_displayed
end
end
end

View File

@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/color_common')
describe 'Theme Editor' do
include_context 'in-process server selenium tests'
include ColorCommon
include ThemeEditorCommon
before(:each) do
course_with_admin_logged_in

View File

@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Tiny MCE editor functions" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "as a teacher" do

View File

@ -2,6 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Tiny MCE editor plugins" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
it "should load all folders for the image plugin", priority: "1", test_id: 420486 do
course_with_teacher_logged_in

View File

@ -2,9 +2,10 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor Files" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "wiki and tiny files as a student" do
before (:each) do
before(:each) do
course(:active_all => true, :name => 'wiki course')
@student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :name => 'student@example.com', :password => 'asdfasdf')
@teacher = user_with_pseudonym(:active_user => true, :username => 'teacher@example.com', :name => 'teacher@example.com', :password => 'asdfasdf')
@ -25,7 +26,7 @@ describe "Wiki pages and Tiny WYSIWYG editor Files" do
end
context "wiki sidebar files and locking/hiding" do
before (:each) do
before(:each) do
course_with_teacher(:active_all => true, :name => 'wiki course')
@student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :name => 'student@example.com', :password => 'asdfasdf')
@course.enroll_student(@student).accept
@ -119,7 +120,7 @@ describe "Wiki pages and Tiny WYSIWYG editor Files" do
end
context "wiki sidebar images and locking/hiding" do
before (:each) do
before(:each) do
course_with_teacher(:active_all => true, :name => 'wiki course')
@student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :name => 'student@example.com', :password => 'asdfasdf')
@course.enroll_student(@student).accept

View File

@ -2,10 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor Images" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "wiki and tiny images as a student" do
before (:each) do
before(:each) do
course(:active_all => true, :name => 'wiki course')
@student = user_with_pseudonym(:active_user => true, :username => 'student@example.com', :name => 'student@example.com', :password => 'asdfasdf')
@teacher = user_with_pseudonym(:active_user => true, :username => 'teacher@example.com', :name => 'teacher@example.com', :password => 'asdfasdf')

View File

@ -2,6 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "as a student" do
@ -70,7 +71,7 @@ describe "Wiki pages and Tiny WYSIWYG editor" do
expect(f('a.edit-wiki')).to be_displayed
end
it "should allow students to create new pages if enabled" do
@course.default_wiki_editing_roles = "teachers,students"
@course.save!

View File

@ -2,10 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor Files" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "wiki and tiny files as a teacher" do
before (:each) do
before(:each) do
course_with_teacher_logged_in
end
@ -67,7 +68,7 @@ describe "Wiki pages and Tiny WYSIWYG editor Files" do
expect(root_folder.attribute('aria-expanded')).to eq "false"
end
it "goes to the next file avalible when pressing down" do
it "goes to the next file avalible when pressing down" do
root_folder = @tree1.find_elements(:css, '[role="treeitem"]').first
@tree1.send_keys :arrow_right
wait_for_ajaximations
@ -77,7 +78,7 @@ describe "Wiki pages and Tiny WYSIWYG editor Files" do
expect(selected.attribute('id')).to eq root_folder.find_elements(:css, '[role="treeitem"]').first.attribute('id')
end
it "goes to the prevous file avalible when pressing up" do
it "goes to the prevous file avalible when pressing up" do
root_folder = @tree1.find_elements(:css, '[role="treeitem"]').first
@tree1.send_keys :arrow_right
wait_for_ajaximations

View File

@ -5,6 +5,7 @@ require_relative "helpers/quizzes_common"
describe "Wiki pages and Tiny WYSIWYG editor Images" do
include_context "in-process server selenium tests"
include QuizzesCommon
include WikiAndTinyCommon
context "wiki and tiny images as a teacher" do

View File

@ -2,10 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
context "as a teacher" do
before (:each) do
before(:each) do
course_with_teacher_logged_in
end

View File

@ -2,12 +2,13 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/wiki_and_tiny_common
describe "Wiki pages and Tiny WYSIWYG editor features" do
include_context "in-process server selenium tests"
include WikiAndTinyCommon
equation_button_selector = "div[aria-label='Insert Math Equation'] button"
context "WYSIWYG generic as a teacher" do
before (:each) do
before(:each) do
course_with_teacher_logged_in
end

View File

@ -6,6 +6,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/files_common')
describe "Wiki Pages" do
include_context "in-process server selenium tests"
include FilesCommon
include WikiAndTinyCommon
context "Navigation" do
before do