Skip to content

Commit

Permalink
MDL-75719 completion: Add Behat scenario for completion states.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyatregubov committed Mar 2, 2023
1 parent 23915a3 commit 1e26496
Showing 1 changed file with 137 additions and 0 deletions.
@@ -0,0 +1,137 @@
@core @core_completion @javascript
Feature: Students will be shown relevant completion state based on grade item visibility.
In order to understand completion states of course modules
As a student
I need to see relevant completion information for various combination of activity passgrade settings

Background:
Given the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
| student1 | Student | First | student1@example.com |
| student2 | Student | Second | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| completion | 2 |
| completionpassgrade | 1 |
| completionusegrade | 1 |
| gradepass | 50 |
And I am on the "Course 1" course page logged in as teacher1
And "Student First" user has not completed "Test assignment name" activity
And I log out
And I am on the "Course 1" course page logged in as student1
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "todo"
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "todo"
And I log out

Scenario: Passing grade and receive a grade completions for visible grade item (passgrade completion enabled)
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
And I give the grade "50" to the user "Student Second" for the grade item "Test assignment name"
And I press "Save changes"
And I am on "Course 1" course homepage
And "Student First" user has completed "Test assignment name" activity
And "Student Second" user has completed "Test assignment name" activity
And I log out
When I am on the "Course 1" course page logged in as student1
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "failed"
And I log out
And I am on the "Course 1" course page logged in as student2
Then the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "done"

Scenario: Passing grade and receive a grade completions for hidden grade item (passgrade completion enabled)
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I hide the grade item "Test assignment name"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
And I give the grade "50" to the user "Student Second" for the grade item "Test assignment name"
And I press "Save changes"
And I am on "Course 1" course homepage
And "Student First" user has not completed "Test assignment name" activity
And "Student Second" user has completed "Test assignment name" activity
And I log out
And I am on the "Course 1" course page logged in as student1
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "todo"
And I log out
And I am on the "Course 1" course page logged in as student2
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "done"

Scenario: Receive a grade completion for visible grade item (passgrade completion disabled)
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Settings" in current page administration
And I set the following fields to these values:
| completionpassgrade | 0 |
And I press "Save and display"
And I log out
And I am on the "Course 1" course page logged in as student1
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "todo"
And I should not see "Receive a passing grade"
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
And I give the grade "50" to the user "Student Second" for the grade item "Test assignment name"
And I press "Save changes"
And I am on "Course 1" course homepage
And "Student First" user has completed "Test assignment name" activity
And "Student Second" user has completed "Test assignment name" activity
And I log out
When I am on the "Course 1" course page logged in as student1
# Once MDL-75582 is fixed "failed" should be changed to "done"
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "failed"
And I should not see "Receive a passing grade"
And I log out
And I am on the "Course 1" course page logged in as student2
Then the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"

Scenario: Receive a grade completion for hidden grade item (passgrade completion disabled)
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Settings" in current page administration
And I set the following fields to these values:
| completionpassgrade | 0 |
And I press "Save and display"
And I log out
And I am on the "Course 1" course page logged in as student1
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "todo"
And I should not see "Receive a passing grade"
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I hide the grade item "Test assignment name"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
And I give the grade "50" to the user "Student Second" for the grade item "Test assignment name"
And I press "Save changes"
And I am on "Course 1" course homepage
And "Student First" user has completed "Test assignment name" activity
And "Student Second" user has completed "Test assignment name" activity
And I log out
When I am on the "Course 1" course page logged in as student1
Then the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
And I should not see "Receive a passing grade"
And I log out
And I am on the "Course 1" course page logged in as student2
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"

0 comments on commit 1e26496

Please sign in to comment.