Skip to content

Commit

Permalink
spec: fix flaky specs frd
Browse files Browse the repository at this point in the history
followup to 3ef932c

Change-Id: I1a6aa1ecc6f143242167dd3f22324b4f409c609f
Reviewed-on: https://gerrit.instructure.com/109167
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <[email protected]>
Product-Review: Landon Wilkins <[email protected]>
QA-Review: Landon Wilkins <[email protected]>
  • Loading branch information
jenseng committed Apr 19, 2017
1 parent c5a66aa commit 8976bf7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spec/selenium/grades/integration/weighting_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module WeightingSetup
include GradebookSetup

def weighted_grading_setup
now = Time.zone.now

enrollment = add_teacher_and_student
enrollment.workflow_state = 'active'
enrollment.save!
Expand All @@ -16,7 +14,7 @@ def weighted_grading_setup

@term_name = "First Term"

create_weighted_grading_periods(now)
create_weighted_grading_periods

associate_course_to_term(@term_name)

Expand All @@ -34,14 +32,25 @@ def weighted_grading_setup
@a4.grade_student(@student, grade: 16, grader: @teacher)
end

def create_weighted_grading_periods(now)
def create_weighted_grading_periods()
# :sigh: ... in the case of SRGB, the grading period dropdown behavior
# is "interesting"... specifically 1. only the first change event
# records your preference, 2. if its value doesn't change, no
# preference is recorded and 3. if no preference is recorded, the
# selected value can change from one page load to the next (say, if a
# period becomes current due to crossing a minute boundary)
#
# so play it safe and make sure neither period will be current during
# the specs. also why does SRGB need a page refresh to work at all?
# :noideadog: (╯°□°)╯︵ ┻━┻

backend_group_helper = Factories::GradingPeriodGroupHelper.new
@gpg = backend_group_helper.create_for_account_with_term(Account.default, @term_name)
@gpg.update_attributes(display_totals_for_all_grading_periods: true)

backend_period_helper = Factories::GradingPeriodHelper.new
@gp1 = backend_period_helper.create_for_group(@gpg, {
start_date: now, end_date: 2.weeks.from_now, title: 'grading period one'
start_date: 1.hour.from_now, end_date: 2.weeks.from_now, title: 'grading period one'
})

@gp2 = backend_period_helper.create_for_group(@gpg, {
Expand Down

0 comments on commit 8976bf7

Please sign in to comment.