spec: add specs for only selected provisional comments displayed to student

fixes: GRADE-1390

Test Plan:
	jenkins passes

Change-Id: Ia6a36e3965c82f0c1d326b8ddfb6f7ba2ac9852f
Reviewed-on: https://gerrit.instructure.com/160709
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
This commit is contained in:
James Butters 2018-08-13 15:10:25 -06:00
parent 39698d750e
commit d2795334f3
3 changed files with 55 additions and 6 deletions

View File

@ -164,15 +164,15 @@ describe 'Moderated Marking' do
ModeratePage.click_post_grades_button
driver.switch_to.alert.accept
wait_for_ajaximations
# wait for info header stating grades are posted
wait = Selenium::WebDriver::Wait.new(timeout: 5)
wait.until { ff("#content header div").size > 3 }
# wait for element to exist, means page has loaded
ModeratePage.grades_posted_button
# unmute using Display to Students button
ModeratePage.click_display_to_students_button
driver.switch_to.alert.accept
wait_for_ajaximations
# wait for flash alert stating grades are visible to students
wait.until {ff("#flashalert_message_holder div").size > 1}
# wait for element to exist, means page has loaded
ModeratePage.grades_posted_button
# switch session to student
user_session(@student1)
@ -181,6 +181,43 @@ describe 'Moderated Marking' do
expect(StudentGradesPage.fetch_assignment_score(@moderated_assignment)).to eq '15'
end
it 'displays comments from chosen grader', priority: "1", test_id: 3513994 do
skip('Unskip in GRADE-1326')
submissions = @moderated_assignment.find_or_create_submissions([@student1, @student2])
submissions.each do |submission|
submission.add_comment(author: @teacher1, comment: 'Just a comment by teacher1')
submission.add_comment(author: @teacher2, comment: 'Just a comment by teacher2')
end
# select a provisional grade for each student
ModeratePage.select_provisional_grade_for_student_by_position(@student1, 1)
ModeratePage.select_provisional_grade_for_student_by_position(@student2, 2)
# post the grades
ModeratePage.click_post_grades_button
driver.switch_to.alert.accept
wait_for_ajaximations
# wait for element to exist, means page has loaded
ModeratePage.grades_posted_button
# unmute using Display to Students button
ModeratePage.click_display_to_students_button
driver.switch_to.alert.accept
wait_for_ajaximations
# wait for element to exist, means page has loaded
ModeratePage.grades_visible_to_students_button
# switch session to student
user_session(@student1)
StudentGradesPage.visit_as_student(@moderated_course)
StudentGradesPage.comment_button.click
expect(StudentGradesPage.comments(@moderated_assignment).count).to eq 1
expect(StudentGradesPage.comments(@moderated_assignment).first).to include_text 'Just a comment by teacher1'
end
it 'display to students button disabled until grades are posted', priority: '1', test_id: 3513991 do
expect(ModeratePage.display_to_students_button).to be_disabled
end

View File

@ -121,7 +121,11 @@ class ModeratePage
end
def display_to_students_button
fj("button:contains('Display')")
fj("button:contains('Display to Students')")
end
def grades_visible_to_students_button
fj("button:contains('Grades Visible to Students')")
end
def page_buttons

View File

@ -87,6 +87,14 @@ class StudentGradesPage
f("#submission_#{assignment_id} .assignment_score .grade").text
end
def comment_button
ffxpath('//a[@aria-label="Read comments"]').select(&:displayed?).first
end
def comments(assignment)
ff("#comments_thread_#{assignment.id} table tbody tr")
end
def fetch_assignment_score(assignment)
if assignment.grading_type == "letter_grade"
assignment_row(assignment).find_element(css: '.assignment_score .score_value').text