Merge branch 'MDL-74021-master' of https://github.com/andelacruz/moodle

This commit is contained in:
Jun Pataleta 2023-06-20 10:13:34 +08:00
commit 6132904e80
12 changed files with 108 additions and 296 deletions

View File

@ -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).
@ -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

View File

@ -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"
@ -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"
@ -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"
@ -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"

View File

@ -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"

View File

@ -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"
@ -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"
@ -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"

View File

@ -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"
@ -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"
@ -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"
@ -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
@ -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
@ -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"

View File

@ -16,15 +16,16 @@ Feature: availability_group
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| page | C1 | P1 |
| page | C1 | P2 |
| page | C1 | P3 |
@javascript
Scenario: Test condition
# Basic setup.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
# Start to add a Page. If there aren't any groups, there's no Group option.
And I add a "Page" to section "1"
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
Then "Group" "button" should not exist in the "Add restriction..." "dialogue"
@ -37,8 +38,7 @@ Feature: availability_group
| G2 | C1 | GI2 |
# This step used to be 'And I follow "C1"', but Chrome thinks the breadcrumb
# is not clickable, so we'll go via the home page instead.
And I am on "Course 1" course homepage
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"
Then "Group" "button" should exist in the "Add restriction..." "dialogue"
@ -47,18 +47,10 @@ Feature: availability_group
Given I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "(Any group)"
And I click on ".availability-item .availability-eye img" "css_element"
And I set the following fields to these values:
| Name | P1 |
| Description | x |
| Page content | x |
And I click on "Save and return to course" "button"
# Page P2 with group G1.
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
And I am on the "P2" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
@ -67,11 +59,7 @@ Feature: availability_group
And I click on "Save and return to course" "button"
# Page P3 with group G2
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 "Group" "button" in the "Add restriction..." "dialogue"
@ -80,9 +68,7 @@ Feature: availability_group
And I click on "Save and return to course" "button"
# 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"
# No pages should appear yet.
Then I should not see "P1" in the "region-main" "region"
@ -93,8 +79,6 @@ Feature: availability_group
Given the following "group members" exist:
| user | group |
| student1 | GI1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
# P1 (any groups) and P2 should show but not P3.
@ -113,19 +97,12 @@ Feature: availability_group
# The activity names filter is enabled because it triggered a bug in older versions.
And the "activitynames" filter is "on"
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 logged in as "teacher1"
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 "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "G-One"
And I click on "Save and return to course" "button"
And I log out
# Student sees information about no access to group, with group name in correct language.
When I am on the "C1" "Course" page logged in as "student1"

View File

@ -22,15 +22,16 @@ Feature: availability_grouping
And the following "group members" exist:
| user | group |
| student1 | GI1 |
# Basic setup.
And the following "activities" exist:
| activity | course | name |
| page | C1 | P1 |
| page | C1 | P2 |
@javascript
Scenario: Test condition
# Basic setup.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
# Start to add a Page. If there aren't any groupings, there's no Grouping option.
And I add a "Page" to section "1"
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
Then "Grouping" "button" should not exist in the "Add restriction..." "dialogue"
@ -44,7 +45,7 @@ Feature: availability_grouping
| name | course | idnumber |
| GX1 | C1 | GXI1 |
| GX2 | C1 | GXI2 |
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"
Then "Grouping" "button" should exist in the "Add restriction..." "dialogue"
@ -53,18 +54,10 @@ Feature: availability_grouping
Given I click on "Grouping" "button"
And I set the field "Grouping" to "GX1"
And I click on ".availability-item .availability-eye img" "css_element"
And I set the following fields to these values:
| Name | P1 |
| Description | x |
| Page content | x |
And I click on "Save and return to course" "button"
# Page P2 with grouping GX2.
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
And I am on the "P2" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Grouping" "button"
@ -73,21 +66,17 @@ Feature: availability_grouping
And I click on "Save and return to course" "button"
# 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"
# No pages should appear yet.
Then I should not see "P1" in the "region-main" "region"
And I should not see "P2" in the "region-main" "region"
# Add group to grouping and log out/in again.
And I log out
And the following "grouping groups" exist:
| grouping | group |
| GXI1 | GI1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" "course" page logged in as "student1"
# P1 should show but not B2.
Then I should see "P1" in the "region-main" "region"
@ -129,14 +118,10 @@ Feature: availability_grouping
# The activity names filter is enabled because it triggered a bug in older versions.
And the "activitynames" filter is "on"
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 open "Test assign" actions menu
And I choose "Edit settings" in the open action menu
And I am on the "Test assign" "assign activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I press "Add group/grouping access restriction"
And I press "Save and return to course"
And I log out
# Student sees information about no access to group, with group name in correct language.
When I am on the "C1" "Course" page logged in as "student1"

View File

@ -16,19 +16,15 @@ Feature: availability_profile
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| page | C1 | P1 |
| page | C1 | P2 |
@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
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | P1 |
| Description | x |
| Page content | x |
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "User profile" "button"
@ -38,11 +34,7 @@ Feature: availability_profile
And I click on "Save and return to course" "button"
# Add
And I add a "Page" to section "2"
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
And I am on the "P2" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "User profile" "button"
@ -52,9 +44,7 @@ Feature: availability_profile
And I click on "Save and return to course" "button"
# 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"
# I see P1 but not P2.
Then I should see "P1" in the "region-main" "region"
@ -72,12 +62,7 @@ Feature: availability_profile
And I click on "Update profile" "button"
# Set Page activity which has requirement on this field.
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | P1 |
| Description | x |
| Page content | x |
And I am on the "P1" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "User profile" "button"
@ -94,9 +79,7 @@ Feature: availability_profile
And the field "Value to compare against" matches value "Bananaman"
# Log out and back in as student. Should be able to see activity.
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" "course" page logged in as "student1"
Then I should see "P1" in the "region-main" "region"
@javascript
@ -110,14 +93,8 @@ Feature: availability_profile
# The activity names filter is enabled because it triggered a bug in older versions.
And the "activitynames" filter is "on"
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 logged in as "teacher1"
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 "User profile" "button" in the "Add restriction..." "dialogue"
And I set the following fields to these values:

View File

@ -34,19 +34,16 @@ Feature: display_availability
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | section | name |
| page | C1 | 1 | Page 1 |
| page | C1 | 2 | Page 2 |
| page | C1 | 3 | Page 3 |
@javascript
Scenario: Activity availability display
# Set up.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
# Add a Page with 1 restriction.
When 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 press "Add restriction..."
And I click on "Date" "button" in the "Add restriction..." "dialogue"
@ -56,11 +53,7 @@ Feature: display_availability
And I press "Save and return to course"
# Add a Page with 2 restrictions - one is set to hide from students if failed.
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 press "Add restriction..."
And I click on "Date" "button" in the "Add restriction..." "dialogue"
@ -75,12 +68,6 @@ Feature: display_availability
And I set the field "Method of comparison" to "is equal to"
And I press "Save and return to course"
# Add another Page with no restrictions.
And I add a "Page" to section "3" and I fill the form with:
| Name | Page 3 |
| Description | Test |
| Page content | Test |
# Page 1 should show in single-line format, showing the date
Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element"
And I should see "2013" in the "#section-1 .availabilityinfo" "css_element"
@ -98,9 +85,7 @@ Feature: display_availability
And "#section-3 .availabilityinfo" "css_element" should not exist
# Change to student view.
Given I log out
And I log in as "student1"
And I am on "Course 1" course homepage
Given I am on the "C1" "Course" page logged in as "student1"
# Page 1 display still there but should not be a link.
Then I should see "Page 1" in the "#section-1" "css_element"
@ -119,8 +104,8 @@ Feature: display_availability
@javascript
Scenario: Section availability display
# Set up.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Given I am on the "C1" "Course" page logged in as "teacher1"
And I turn editing mode on
# Add a restriction to section 1 (visible to students).
When I edit the section "1"
@ -144,29 +129,13 @@ Feature: display_availability
# This is necessary because otherwise it fails in Chrome, see MDL-44959
And I am on "Course 1" course homepage
# Add Pages to each section.
And I add a "Page" to section "1" and I fill the form with:
| Name | Page 1 |
| Description | Test |
| Page content | Test |
And I add a "Page" to section "2" and I fill the form with:
| Name | Page 2 |
| Description | Test |
| Page content | Test |
And I add a "Page" to section "3" and I fill the form with:
| Name | Page 3 |
| Description | Test |
| Page content | Test |
# Check display
Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element"
And I should see "Available until" in the "#section-2 .availabilityinfo" "css_element"
And I should see "hidden otherwise" in the "#section-2 .availabilityinfo" "css_element"
# Change to student view.
Given I log out
And I log in as "student1"
And I am on "Course 1" course homepage
Given I am on the "Course 1" "Course" page logged in as "student1"
# The contents of both sections should be hidden.
Then I should not see "Page 1" in the "region-main" "region"

View File

@ -59,12 +59,8 @@ Feature: edit_availability
| activity | page |
| course | C1 |
| idnumber | 0002 |
| section | 1 |
| name | Page2 |
| intro | pageintro |
And I am on "Course 1" course homepage
And I follow "Page2"
And I navigate to "Settings" in current page administration
And I am on the "Page2" "page activity editing" page
Then "Restrict access" "fieldset" should exist
Given I am on "Course 1" course homepage
@ -74,9 +70,12 @@ Feature: edit_availability
@javascript
Scenario: Edit availability using settings in activity form
# Set up.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1"
Given the following "activity" exists:
| activity | page |
| course | C1 |
| section | 1 |
| name | P1 |
And I am on the "P1" "page activity editing" page logged in as "teacher1"
And I expand all fieldsets
Then I should see "None" in the "Restrict access" "fieldset"

View File

@ -17,30 +17,20 @@ Feature: Restrict activity availability through grade conditions
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| course | C1 |
| activity | assign |
| idnumber | Grade assignment |
| name | Grade assignment |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And I am on the "Course 1" course page logged in as teacher1
And I am on "Course 1" course homepage with editing mode on
And the following "activities" exist:
| course | activity | idnumber | name | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | submissiondrafts |
| C1 | assign | Grade assignment | Grade assignment | 1 | 0 | 0 |
| C1 | page | Grade page | Test page name | | | |
# 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 am on the "Test page name" "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"
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 | Grade assignment |
| minval | 20 |
| id | Grade assignment |
| minval | 20 |
And I press "Save and return to course"
And I log out
When I am on the "Course 1" course page logged in as student1
Then I should see "Not available unless: You achieve higher than a certain score in Grade assignment"
@ -52,7 +42,6 @@ Feature: Restrict activity availability through grade conditions
| Online text | I'm the student submission |
And I press "Save changes"
And I should see "Submitted for grading"
And I log out
And I am on the "Grade assignment" "assign activity" page logged in as teacher1
And I follow "View all submissions"
@ -60,8 +49,6 @@ Feature: Restrict activity availability through grade conditions
And I set the following fields to these values:
| Grade | 21 |
And I press "Save changes"
And I follow "Edit settings"
And I log out
And I am on the "Course 1" course page logged in as student1
And "Test page name" activity should be visible

View File

@ -16,15 +16,10 @@ Feature: Restrict sections availability through completion or grade conditions
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| section | 1 |
| name | Grade assignment |
| intro | Grade this assignment to revoke restriction on restricted assignment |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "activities" exist:
| activity | course | section | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | submissiondrafts | content |
| assign | C1 | 1 | Grade assignment | Grade this assignment to revoke restriction on restricted assignment | 1 | 0 | 0 | |
| page | C1 | 2 | Test page name | Restricted section page resource, till grades in Grade assignment is at least 20% | | | | Test page contents |
@javascript
Scenario: Show section greyed-out to student when completion condition is not satisfied
@ -37,10 +32,6 @@ Feature: Restrict sections availability through completion or grade conditions
And the following "activities" exist:
| activity | course | section | intro | completion | idnumber |
| label | C1 | 1 | Test label | 1 | 1 |
And I add a "Page" to section "2" and I fill the form with:
| Name | Test page name |
| Description | Test page description |
| Page content | Test page contents |
When I edit the section "2"
And I expand all fieldsets
And I click on "Add restriction..." "button"
@ -49,9 +40,7 @@ Feature: Restrict sections availability through completion or grade conditions
| 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 am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as "student1"
Then I should see "Not available unless: The activity Test label is marked complete"
And I should not see "Test page name"
And I toggle the manual completion state of "Test label"
@ -62,10 +51,6 @@ Feature: Restrict sections availability through completion or grade conditions
Scenario: Show section greyed-out to student when grade condition is not satisfied
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "2" and I fill the form with:
| 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 expand all fieldsets
And I click on "Add restriction..." "button"
@ -75,9 +60,7 @@ Feature: Restrict sections availability through completion or grade conditions
| min | 1 |
| minval | 20 |
And I press "Save changes"
And I log out
When 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"
Then I should see "Not available unless: You achieve higher than a certain score in Grade assignment"
And "Test page name" activity should be hidden
And I am on the "Grade assignment" "assign activity" page
@ -94,7 +77,6 @@ Feature: Restrict sections availability through completion or grade conditions
| Grade | 21 |
And I press "Save changes"
And I follow "Edit settings"
And I log out
And I am on the "Course 1" Course page logged in as student1
And "Test page name" activity should be visible
And I should not see "Not available unless: You achieve higher than a certain score in Grade assignment"