Skip to content

Commit

Permalink
Merge branch 'MDL-74021-401' of https://github.com/andelacruz/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_401_STABLE
  • Loading branch information
junpataleta committed Jun 20, 2023
2 parents 64f4f58 + 07df782 commit d963201
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 296 deletions.
Expand Up @@ -34,8 +34,11 @@ Feature: Manage availability conditions
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "activity" exists:
| activity | page |
| course | C1 |
| name | P1 |
And I log in as "admin"
And I am on site homepage
When I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration

# Check the icon is there (it should be a Hide icon, meaning is currently visible).
Expand All @@ -51,8 +54,7 @@ Feature: Manage availability conditions

# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
And I click on "Hide" "icon" in the "Restriction by grade" "table_row"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1"
And I am on the "P1" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And "Add restriction..." "dialogue" should be visible
Expand Down
Expand Up @@ -16,26 +16,15 @@ Feature: availability_completion
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name | completion |
| page | C1 | Page 1 | 1 |
| page | C1 | Page 2 | |

@javascript
Scenario: Test condition
# Basic setup.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on

# Add a Page with a completion tickbox.
And I add a "Page" to section "1" and I fill the form with:
| Name | Page 1 |
| Description | Test |
| Page content | Test |
| Completion tracking | 1 |

# And another one that depends on it (hidden otherwise).
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | Page 2 |
| Description | Test |
| Page content | Test |
Given I am on the "Page 2" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
Expand All @@ -44,9 +33,7 @@ Feature: availability_completion
And I press "Save and return to course"

# Log back in as student.
When I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" "course" page logged in as "student1"

# Page 2 should not appear yet.
Then I should not see "Page 2" in the "region-main" "region"
Expand All @@ -58,24 +45,12 @@ Feature: availability_completion
@javascript
Scenario: Test completion and course cache rebuild
Given the following "activities" exist:
| activity | name | course | idnumber |
| forum | forum 1 | C1 | forum1 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| student1 | forum 1 | Forum posst 1 | This is the body |
And I am on the "forum 1" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| completionview | 1 |
| completionpostsenabled | 1 |
| completionposts | 2 |
And I press "Save and return to course"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | Page 2 |
| Description | Test |
| Page content | Test |
| activity | name | course | idnumber | completion | completionview | completionpostsenabled | completionposts |
| forum | forum 1 | C1 | forum1 | 2 | 1 | 1 | 2 |
And the following "mod_forum > discussions" exist:
| forum | subject | message |
| forum1 | Forum post 1 | This is the body |
And I am on the "Page 2" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I press "Add restriction..."
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
Expand All @@ -84,18 +59,18 @@ Feature: availability_completion
| Required completion status | must be marked complete |
| cm | forum 1 |
And I press "Save and return to course"
When I am on the "Course 1" course page logged in as student1
When I am on the "Course 1" "course" page logged in as "student1"
# Page 2 should not appear yet.
Then I should not see "Page 2" in the "region-main" "region"
And I click on "forum 1" "link" in the "region-main" "region"
# Page 2 should not appear yet.
And I should not see "Page 2" in the "region-main" "region"
And I am on the "forum 1" "forum activity editing" page logged in as teacher1
And I am on the "forum 1" "forum activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I set the following fields to these values:
| completionpostsenabled | 0 |
And I press "Save and display"
And I am on the "Course 1" course page logged in as student1
And I am on the "Course 1" "course" page logged in as "student1"
And I click on "forum 1" "link" in the "region-main" "region"
And I am on "Course 1" course homepage
And I should see "Page 2" in the "region-main" "region"
Expand Up @@ -18,21 +18,17 @@ Feature: Confirm that conditions on completion no longer cause a bug
@javascript
Scenario: Multiple completion conditions on glossary
# Set up course.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
Given I am on the "Course 1" "course" page logged in as "teacher1"
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the field "Enable completion tracking" to "Yes"
And I press "Save and display"
And I turn editing mode on

# Add a couple of Pages with manual completion.
And I add a "Page" to section "1" and I fill the form with:
| Name | Page1 |
| Page content | x |
And I add a "Page" to section "1" and I fill the form with:
| Name | Page2 |
| Page content | x |
And the following "activities" exist:
| activity | course | name | completion |
| page | C1 | Page1 | 1 |
| page | C1 | Page2 | 1 |

# Add a Glossary.
When I add a "Glossary" to section "1"
Expand Down
24 changes: 7 additions & 17 deletions availability/condition/date/tests/behat/availability_date.feature
Expand Up @@ -16,19 +16,15 @@ Feature: availability_date
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| page | C1 | Page 1 |
| page | C1 | Page 2 |

@javascript
Scenario: Test condition
# Basic setup.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on

# Add a Page with a date condition that does match (from the past).
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Page 1 |
| Description | Test |
| Page content | Test |
Given I am on the "Page 1" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Expand All @@ -37,11 +33,7 @@ Feature: availability_date
And I press "Save and return to course"

# Add a Page with a date condition that doesn't match (until the past).
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | Page 2 |
| Description | Test |
| Page content | Test |
And I am on the "Page 2" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Expand All @@ -51,9 +43,7 @@ Feature: availability_date
And I press "Save and return to course"

# Log back in as student.
When I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" "course" page logged in as "student1"

# Page 1 should appear, but page 2 does not.
Then I should see "Page 1" in the "region-main" "region"
Expand Down
53 changes: 13 additions & 40 deletions availability/condition/grade/tests/behat/availability_grade.feature
Expand Up @@ -17,26 +17,17 @@ Feature: availability_grade
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
# Add an assignment.
And the following "activity" exists:
| activity | assign |
| course | C1 |
| section | 1 |
| name | A1 |
| intro | x |
| assignsubmission_onlinetext_enabled | 1 |
And the following "activities" exist:
| activity | course | name | assignsubmission_onlinetext_enabled |
| assign | C1 | A1 | 1 |
| page | C1 | P1 | |
| page | C1 | P2 | |
| page | C1 | P3 | |
| page | C1 | P4 | |

@javascript
Scenario: Test condition
# Basic setup.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on

# Add a Page with a grade condition for 'any grade'.
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
Given I am on the "P2" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
Expand All @@ -45,11 +36,7 @@ Feature: availability_grade
And I press "Save and return to course"

# Add a Page with a grade condition for 50%.
And I add a "Page" to section "3"
And I set the following fields to these values:
| Name | P3 |
| Description | x |
| Page content | x |
And I am on the "P3" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
Expand All @@ -62,23 +49,16 @@ Feature: availability_grade
And I press "Save and return to course"

# Check if disabling a part of the restriction is get saved.
And I open "P3" actions menu
And I click on "Edit settings" "link" in the "P3" activity
And I am on the "P3" "page activity editing" page
And I expand all fieldsets
And I click on "max" "checkbox" in the ".availability-item" "css_element"
And I press "Save and return to course"
And I open "P3" actions menu
And I click on "Edit settings" "link" in the "P3" activity
And I expand all fieldsets
And I am on the "P3" "page activity editing" page
And the field "Maximum grade percentage (exclusive)" matches value ""
And I am on "Course 1" course homepage

# Add a Page with a grade condition for 10%.
And I add a "Page" to section "4"
And I set the following fields to these values:
| Name | P4 |
| Description | x |
| Page content | x |
And I am on the "P4" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
Expand All @@ -88,8 +68,6 @@ Feature: availability_grade
And I set the field "Minimum grade percentage (inclusive)" to "10"
And I press "Save and return to course"

And I log out

# Log in as student without a grade yet.
When I am on the "A1" "assign activity" page logged in as student1

Expand All @@ -104,7 +82,6 @@ Feature: availability_grade
And I should not see "P3" in the "region-main" "region"
And I should not see "P4" in the "region-main" "region"
And I should see "A1" in the "region-main" "region"
And I log out

# Log back in as teacher.
When I am on the "A1" "assign activity" page logged in as teacher1
Expand Down Expand Up @@ -143,12 +120,8 @@ Feature: availability_grade
And the "activitynames" filter applies to "content and headings"
And I am on the "C1" "Course" page logged in as "teacher1"
And I turn editing mode on
And I add a "Page" to section "1"
And I am on the "P1" "page activity editing" page
And I expand all fieldsets
And I set the following fields to these values:
| Name | P1 |
| Description | x |
| Page content | x |
And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I set the field "Grade" to "A-One"
Expand Down

0 comments on commit d963201

Please sign in to comment.