spec: add grading period
Change-Id: I6bede0a694e5ee8a5d6e39bba298db400f745c2a Reviewed-on: https://gerrit.instructure.com/86213 Tested-by: Jenkins Reviewed-by: Gentry Beckmann <gbeckmann@instructure.com> Product-Review: Gentry Beckmann <gbeckmann@instructure.com> QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
This commit is contained in:
parent
7fa948227d
commit
8bffd2b85d
|
@ -20,7 +20,7 @@ describe "multiple grading periods account page" do
|
|||
end
|
||||
|
||||
it "deletes grading period set", test_id: 2528621, priority: "1" do
|
||||
group = Factories::GradingPeriodGroupHelper.new.create_for_account(Account.default)
|
||||
group = group_helper.create_for_account(Account.default)
|
||||
visit_account_grading_standards(Account.default.id)
|
||||
delete_first_grading_period_set(false)
|
||||
expect(set_present?(group.title)).to be true
|
||||
|
@ -29,11 +29,17 @@ describe "multiple grading periods account page" do
|
|||
end
|
||||
|
||||
it "edits grading period set", test_id: 2528628, priority: "1" do
|
||||
Factories::GradingPeriodGroupHelper.new.create_for_account(Account.default)
|
||||
group_helper.create_for_account(Account.default)
|
||||
visit_account_grading_standards(Account.default.id)
|
||||
edit_first_grading_period_set("Edited Title")
|
||||
expect(set_present?("Edited Title")).to be true
|
||||
end
|
||||
|
||||
it "adds grading period", test_id: 2528648, priority: "1" do
|
||||
group_helper.create_for_account(Account.default)
|
||||
visit_account_grading_standards(Account.default.id)
|
||||
add_grading_period("New Period")
|
||||
expect(period_present?("New Period")).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
module MultipleGradingPeriods
|
||||
module AccountPage
|
||||
shared_context "account_page_components" do
|
||||
# Helpers
|
||||
let(:group_helper) { Factories::GradingPeriodGroupHelper.new }
|
||||
let(:period_helper) { Factories::GradingPeriodHelper.new }
|
||||
|
||||
# Main page components
|
||||
let(:grading_periods_tab) { f("#grading-periods-tab") }
|
||||
let(:add_set_of_grading_periods_button) { f('button[aria-label="Add Set of Grading Periods"]') }
|
||||
|
||||
# Set components
|
||||
let(:set_name_input) { f('#set-name')}
|
||||
let(:term_input) { f('input[aria-label^="Start typing to search."]') }
|
||||
let(:create_set_button) { fj('button:contains("Create")') }
|
||||
|
@ -12,6 +19,16 @@ module MultipleGradingPeriods
|
|||
let(:delete_grading_period_set_button) { f('.delete_grading_period_set_button') }
|
||||
let(:edit_grading_period_set_button) { f('.edit_grading_period_set_button')}
|
||||
let(:edit_set_save_button) { f('button[aria-label="Save Grading Period Set"]') }
|
||||
let(:first_collapsed_set) { f('.GradingPeriodSet--collapsed') }
|
||||
|
||||
# Period components
|
||||
let(:period_title_input) { f('#title') }
|
||||
let(:start_date_input) { f('input[data-row-key="start-date"]') }
|
||||
let(:end_date_input) { f('input[data-row-key="end-date"]') }
|
||||
let(:close_date_input) { f('input[data-row-key="close-date"]') }
|
||||
let(:save_period_button) { f('button[aria-label="Save Grading Period"]')}
|
||||
let(:first_period) { f('.GradingPeriodList__period span') }
|
||||
let(:period_delete_button) { f('.GradingPeriodList .icon-trash')}
|
||||
end
|
||||
|
||||
def visit_account_grading_standards(account_id)
|
||||
|
@ -49,5 +66,22 @@ module MultipleGradingPeriods
|
|||
replace_content(set_name_input, new_name)
|
||||
edit_set_save_button.click
|
||||
end
|
||||
|
||||
def add_grading_period(title="Grading Period 1")
|
||||
expand_first_set
|
||||
add_grading_period_link.click
|
||||
replace_content(period_title_input, title)
|
||||
replace_content(start_date_input, format_date_for_view(Time.zone.now, :medium))
|
||||
replace_content(end_date_input, format_date_for_view(Time.zone.now + 1.month, :medium))
|
||||
save_period_button.click
|
||||
end
|
||||
|
||||
def expand_first_set
|
||||
first_collapsed_set.click
|
||||
end
|
||||
|
||||
def period_present?(title)
|
||||
first_period.text == title
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue