#
# Copyright (C) 2018 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

require_relative '../../helpers/gradezilla_common'
require_relative '../pages/gradezilla_page'
require_relative '../pages/gradezilla_cells_page'

describe "Gradezilla" do
  include_context "in-process server selenium tests"
  include GradezillaCommon

  describe 'letter grade assignment grading' do
    before :once do
      init_course_with_students 1
      @assignment = @course.assignments.create!(grading_type: 'letter_grade', points_possible: 10)
      @assignment.grade_student(@students[0], grade: 'B', grader: @teacher)
    end

    before :each do
      user_session(@teacher)
      Gradezilla.visit(@course)
    end

    it 'is maintained in editable mode', priority: "1", test_id: 3438379 do
      skip('This is skeleton code that acts as AC for GRADE-61 which is WIP')
      Gradezilla::Cells.grading_cell(@students[0], @assignment).click
      expect(Gradezilla::Cells.grade_cell_input(@students[0], @assignment)).to eq('B')
    end

    it 'is maintained on page refresh post grade update', priority: "1", test_id: 3438380 do
      skip('This is skeleton code that acts as AC for GRADE-61 which is WIP')
      Gradezilla::Cells.edit_grade(@students[0], @assignment, 'A')
      refresh_page
      expect(Gradezilla::Cells.get_grade(@students[0], @assignment)).to eq('A')
    end
  end
end

Add Spec for Letter Grade
Spec: Add Spec for Letter Grade

refs: GRADE-61

Test Plan:
 --- Passes Jenkins

Change-Id: I178774d5e0a68f09926ee6c5c2c20e2459986148
Reviewed-on: https://gerrit.instructure.com/138707
Tested-by: Jenkins
Reviewed-by: Anju Reddy <851202533fb1f0b615e4547ba226c76996d060dd@instructure.com>
Reviewed-by: Jeremy Neander <20252aad5efdc666f083d82ab63ed0f9f72a043e@instructure.com>
Product-Review: Indira Pai <9d2d5fa73bc5f5239dec42fbfd2a2b8495480e96@instructure.com>
QA-Review: Indira Pai <9d2d5fa73bc5f5239dec42fbfd2a2b8495480e96@instructure.com>
