Skip to content

Commit

Permalink
MDL-44070 core_completion: Fixed behat
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja authored and stronk7 committed Apr 9, 2014
1 parent 1a19494 commit ae90dec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
13 changes: 7 additions & 6 deletions completion/tests/behat/restrict_activity_by_grade.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ Feature: Restrict activity availability through grade conditions
# Adding the page like this because id_availableform_enabled needs to be clicked to trigger the action.
And I add a "Page" to section "2"
And I expand all fieldsets
And I click on "id_availablefrom_enabled" "checkbox"
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I click on "min" "checkbox"
And I set the following fields to these values:
| Name | Test page name |
| Description | Restricted page, till grades in Grade assignment is at least 20% |
| Page content | Test page contents |
| id_conditiongradegroup_0_conditiongradeitemid | 2 |
| id_conditiongradegroup_0_conditiongrademin | 20 |
| id_showavailability | 1 |
| id | 2 |
| minval | 20 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I follow "Course 1"
Then I should see "Not available until you achieve a required score in Grade assignment"
Then I should see "Not available unless: You achieve a required score in Grade assignment"
And "Test page name" activity should be hidden
And I follow "Grade assignment"
And I press "Add submission"
Expand All @@ -65,4 +66,4 @@ Feature: Restrict activity availability through grade conditions
And I log in as "student1"
And I follow "Course 1"
And "Test page name" activity should be visible
And I should not see "Not available until you achieve a required score in Grade assignment"
And I should not see "Not available unless: You achieve a required score in Grade assignment"
33 changes: 21 additions & 12 deletions completion/tests/behat/restrict_section_availability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ Feature: Restrict sections availability through completion or grade conditions
| Name | Test page name |
| Description | Test page description |
| Page content | Test page contents |
When I edit the section "2" and I fill the form with:
| id_conditioncompletiongroup_0_conditionsourcecmid | Test label |
| id_conditioncompletiongroup_0_conditionrequiredcompletion | must be marked complete |
| Before section can be accessed | Show section greyed-out, with restriction information |
When I edit the section "2"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
And I set the following fields to these values:
| cm | Test label |
| Required completion status | must be marked complete |
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Course 1"
Then I should see "Not available until the activity Test label is marked complete."
Then I should see "Not available unless: The activity Test label is marked complete"
And I should not see "Test page name"
And I press "Not completed: Test label. Select to mark as complete."
And I should see "Test page name"
And I should not see "Not available until the activity Test label is marked complete."
And I should not see "Not available unless: The activity Test label is marked complete"

@javascript
Scenario: Show section greyed-out to student when grade condition is not satisfied
Expand All @@ -65,14 +69,19 @@ Feature: Restrict sections availability through completion or grade conditions
| Name | Test page name |
| Description | Restricted section page resource, till grades in Grade assignment is at least 20% |
| Page content | Test page contents |
And I edit the section "2" and I fill the form with:
| id_conditiongradegroup_0_conditiongradeitemid | 2 |
| id_conditiongradegroup_0_conditiongrademin | 20 |
| Before section can be accessed | 1 |
And I edit the section "2"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I click on "min" "checkbox"
And I set the following fields to these values:
| id | 2 |
| minval | 20 |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
Then I should see "Not available until you achieve a required score in Grade assignment"
Then I should see "Not available unless: You achieve a required score in Grade assignment"
And "Test page name" activity should be hidden
And I follow "Grade assignment"
And I press "Add submission"
Expand All @@ -93,4 +102,4 @@ Feature: Restrict sections availability through completion or grade conditions
And I log in as "student1"
And I follow "Course 1"
And "Test page name" activity should be visible
And I should not see "Not available until you achieve a required score in Grade assignment"
And I should not see "Not available unless: You achieve a required score in Grade assignment"

0 comments on commit ae90dec

Please sign in to comment.