Skip to content

Commit

Permalink
CTP-3783 adapt behat 2
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Oct 7, 2024
1 parent 569103c commit 36da94b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 32 deletions.
6 changes: 0 additions & 6 deletions tests/behat/behat_mod_coursework.php
Original file line number Diff line number Diff line change
Expand Up @@ -2191,10 +2191,6 @@ public function i_have_an_assessor_feedback() {
* @param string $expectedvalue
*/
public function i_should_see_the_grade_comment_in_the_form_on_the_page($expectedvalue = 'New comment here') {
// Since commit c1132f6, feedback comments editing has happened from AJAX form.
// Tests were not updated for this so add a wait to enable form to load before we check.
$this->wait_for_pending_js();
$this->wait_for_seconds(2);
$commentfield = $this->find('css', '#feedback_comment');
if ($commentfield->getValue() != $expectedvalue) {
throw new ExpectationException("Expected comment $expectedvalue got " . $commentfield->getValue(), $this->getSession());
Expand Down Expand Up @@ -2254,8 +2250,6 @@ public function i_should_see_the_rubric_grade_on_the_page() {
* @throws Behat\Mink\Exception\ElementNotFoundException
*/
public function i_grade_the_submission_using_the_simple_form($grade = 56, $withoutcomments=false) {
$this->wait_for_pending_js();
$this->wait_for_seconds(2);
$nodeelement = $this->getSession()->getPage()->findById('feedback_grade');
if ($nodeelement) {
$nodeelement->selectOption($grade);
Expand Down
16 changes: 12 additions & 4 deletions tests/behat/feedback_group_marking.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_coursework
@mod @mod_coursework @mod_coursework_feedback_group_marking
Feature: Marking the group submissions applies the grades to the whole group

As a teacher
Expand All @@ -22,10 +22,18 @@ Feature: Marking the group submissions applies the grades to the whole group
And there are feedbacks from both teachers
And I am logged in as a manager

@javascript
Scenario: grading the submission makes the grades show up for both students in the interface
Given I visit the coursework page
When I click the new final feedback button for the group
And show me the page
And I grade the submission using the simple form
Then I should be on the coursework page
# Form loaded and sent by AJAX now so wait for it to load.
And I wait until the page is ready
And I wait "1" seconds
And I set the field "Grade" to "56"
And I set the field "Comment" to "Some comment 1"
And I wait "2" seconds
And I click on "Save and finalise" "button"
And I should see "Your data has been saved."
Then I visit the coursework page
And I wait "2" seconds
And I should see the final grade for the group in the grading interface
30 changes: 27 additions & 3 deletions tests/behat/feedback_publishing_grades.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_coursework
@mod @mod_coursework @mod_coursework_feedback_publishing_grades
Feature: publishing grades to the students

In order that the students receive their final grades
Expand All @@ -15,6 +15,7 @@ Feature: publishing grades to the students
And the student has a submission
And the submission is finalised

@javascript
Scenario: Not publishing with double marking hides feedback from the student
Given there is a teacher
And there is another teacher
Expand All @@ -23,13 +24,27 @@ Feature: publishing grades to the students
And I am logged in as a manager
When I visit the coursework page
And I click the new multiple final feedback button for the student
And I grade the submission using the simple form
# Form loaded and sent by AJAX now so wait for it to load.
And I wait until the page is ready
And I wait "1" seconds
And I set the field "Grade" to "56"
And I set the field "Comment" to "Some comment 1"
And I wait "2" seconds
And I click on "Save and finalise" "button"
And I should see "Your data has been saved."
Then I visit the coursework page
And I click the edit final feedback button
And I wait until the page is ready
And I wait "1" seconds
And the field "Grade" matches value "56"
And the field "Comment" matches value "Some comment 1"
And I log out
And I log in as the student
And I visit the coursework page
Then I should not see the final grade on the student page
And I should not see the grade comment on the student page

@javascript
Scenario: Deliberate publishing with double marking shows feedback to the student
Given there is a teacher
And there is another teacher
Expand All @@ -39,10 +54,19 @@ Feature: publishing grades to the students

When I visit the coursework page
And I click the new multiple final feedback button for the student
And I grade the submission using the simple form
# Form loaded and sent by AJAX now so wait for it to load.
And I wait until the page is ready
And I wait "1" seconds
And I set the field "Grade" to "56"
And I set the field "Comment" to "New comment here"
And I wait "2" seconds
And I click on "Save and finalise" "button"
And I should see "Your data has been saved."
Then I visit the coursework page
And I press the publish button
And I log out
And I log in as the student
And I visit the coursework page
And I wait "2" seconds
Then I should see the final grade on the student page
And I should see the grade comment on the student page
45 changes: 26 additions & 19 deletions tests/behat/feedback_single_marking.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_coursework
@mod @mod_coursework @mod_coursework_feedback_single_marking
Feature: Adding and editing single feedback

In order to provide students with a fair final grade that combines the component grades
Expand All @@ -15,33 +15,40 @@ Feature: Adding and editing single feedback
And the teacher has a capability to edit their own initial feedbacks
And I log in as the teacher

Scenario: Setting the final feedback grade
@javascript
Scenario: Setting the final feedback grade and comment
Given the submission is finalised
And the coursework deadline has passed
And I visit the coursework page
When I click the new single final feedback button for the student
When I grade the submission using the simple form
Then I should be on the coursework page
And I should see the final grade on the single marker page
# Form loaded and sent by AJAX now so wait for it to load.
And I wait until the page is ready
And I wait "1" seconds
And I set the field "Grade" to "56"
And I set the field "Comment" to "Some comment 1"
And I wait "2" seconds
And I click on "Save and finalise" "button"
And I should see "Your data has been saved."
Then I visit the coursework page
And I should see the final grade as 56 on the single marker page
And I click the edit final feedback button
And I wait until the page is ready
And I wait "1" seconds
And the field "Grade" matches value "56"
And the field "Comment" matches value "Some comment 1"

Scenario: Setting the final feedback comment
Given the submission is finalised
And I visit the coursework page
When I click the new single final feedback button for the student
When I grade the submission using the simple form
Then I should be on the coursework page
When I click the edit final feedback button
Then I should see the grade comment in the form on the page
And I should see the grade in the form on the page

Scenario: I should not see the feedback icon when the submisison has not been finalised
Scenario: I should not see the feedback icon when the submission has not been finalised
And I visit the coursework page
Then I should not see a link to add feedback

Scenario: Editing someone elses grade
@javascript
Scenario: Editing someone else's grade
Given the submission is finalised
And there is feedback for the submission from the teacher
And I visit the coursework page
When I click the edit final feedback button
Then I should see the grade comment as "Blah" in the form on the page
And I should see the other teacher's grade in the form on the page
And I wait until the page is ready
And I wait "1" seconds
And the field "Grade" matches value "58"
And I wait "1" seconds
And the field with xpath "//textarea[@id='id_feedbackcomment']" matches value "Blah"

0 comments on commit 36da94b

Please sign in to comment.