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: Given the following "courses" exist:
| fullname | shortname | format | | fullname | shortname | format |
| Course 1 | C1 | topics | | Course 1 | C1 | topics |
And the following "activity" exists:
| activity | page |
| course | C1 |
| name | P1 |
And I log in as "admin" And I log in as "admin"
And I am on site homepage
When I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration 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). # 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. # 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 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 am on the "P1" "page activity editing" page
And I add a "Page" to section "1"
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And "Add restriction..." "dialogue" should be visible And "Add restriction..." "dialogue" should be visible

View file

@ -16,26 +16,15 @@ Feature: availability_completion
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activities" exist:
| activity | course | name | completion |
| page | C1 | Page 1 | 1 |
| page | C1 | Page 2 | |
@javascript @javascript
Scenario: Test condition Scenario: Test condition
# Basic setup. # Basic setup.
Given I log in as "teacher1" Given I am on the "Page 2" "page activity editing" page logged 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 |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue" 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" And I press "Save and return to course"
# Log back in as student. # Log back in as student.
When I log out When I am on the "Course 1" "course" page logged in as "student1"
And I log in as "student1"
And I am on "Course 1" course homepage
# Page 2 should not appear yet. # Page 2 should not appear yet.
Then I should not see "Page 2" in the "region-main" "region" Then I should not see "Page 2" in the "region-main" "region"
@ -58,24 +45,12 @@ Feature: availability_completion
@javascript @javascript
Scenario: Test completion and course cache rebuild Scenario: Test completion and course cache rebuild
Given the following "activities" exist: Given the following "activities" exist:
| activity | name | course | idnumber | | activity | name | course | idnumber | completion | completionview | completionpostsenabled | completionposts |
| forum | forum 1 | C1 | forum1 | | forum | forum 1 | C1 | forum1 | 2 | 1 | 1 | 2 |
And the following forum discussions exist in course "Course 1": And the following "mod_forum > discussions" exist:
| user | forum | name | message | | forum | subject | message |
| student1 | forum 1 | Forum posst 1 | This is the body | | forum1 | Forum post 1 | This is the body |
And I am on the "forum 1" "forum activity editing" page logged in as teacher1 And I am on the "Page 2" "page 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 |
And I expand all fieldsets And I expand all fieldsets
And I press "Add restriction..." And I press "Add restriction..."
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue" 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 | | Required completion status | must be marked complete |
| cm | forum 1 | | cm | forum 1 |
And I press "Save and return to course" 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. # Page 2 should not appear yet.
Then I should not see "Page 2" in the "region-main" "region" Then I should not see "Page 2" in the "region-main" "region"
And I click on "forum 1" "link" in the "region-main" "region" And I click on "forum 1" "link" in the "region-main" "region"
# Page 2 should not appear yet. # Page 2 should not appear yet.
And I should not see "Page 2" in the "region-main" "region" 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 expand all fieldsets
And I set the following fields to these values: And I set the following fields to these values:
| completionpostsenabled | 0 | | completionpostsenabled | 0 |
And I press "Save and display" 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 click on "forum 1" "link" in the "region-main" "region"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I should see "Page 2" in the "region-main" "region" 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 @javascript
Scenario: Multiple completion conditions on glossary Scenario: Multiple completion conditions on glossary
# Set up course. # Set up course.
Given I log in as "teacher1" Given I am on the "Course 1" "course" page logged in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration And I navigate to "Settings" in current page administration
And I expand all fieldsets And I expand all fieldsets
And I set the field "Enable completion tracking" to "Yes" And I set the field "Enable completion tracking" to "Yes"
And I press "Save and display" And I press "Save and display"
And I turn editing mode on And I turn editing mode on
# Add a couple of Pages with manual completion. # Add a couple of Pages with manual completion.
And I add a "Page" to section "1" and I fill the form with: And the following "activities" exist:
| Name | Page1 | | activity | course | name | completion |
| Page content | x | | page | C1 | Page1 | 1 |
And I add a "Page" to section "1" and I fill the form with: | page | C1 | Page2 | 1 |
| Name | Page2 |
| Page content | x |
# Add a Glossary. # Add a Glossary.
When I add a "Glossary" to section "1" When I add a "Glossary" to section "1"

View file

@ -16,19 +16,15 @@ Feature: availability_date
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| page | C1 | Page 1 |
| page | C1 | Page 2 |
@javascript @javascript
Scenario: Test condition 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). # Add a Page with a date condition that does match (from the past).
And I add a "Page" to section "1" Given I am on the "Page 1" "page activity editing" page logged in as "teacher1"
And I set the following fields to these values:
| Name | Page 1 |
| Description | Test |
| Page content | Test |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue" 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" And I press "Save and return to course"
# Add a Page with a date condition that doesn't match (until the past). # Add a Page with a date condition that doesn't match (until the past).
And I add a "Page" to section "2" And I am on the "Page 2" "page activity editing" page
And I set the following fields to these values:
| Name | Page 2 |
| Description | Test |
| Page content | Test |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue" 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" And I press "Save and return to course"
# Log back in as student. # Log back in as student.
When I log out When I am on the "Course 1" "course" page logged in as "student1"
And I log in as "student1"
And I am on "Course 1" course homepage
# Page 1 should appear, but page 2 does not. # Page 1 should appear, but page 2 does not.
Then I should see "Page 1" in the "region-main" "region" Then I should see "Page 1" in the "region-main" "region"

View file

@ -17,26 +17,17 @@ Feature: availability_grade
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
# Add an assignment. # Add an assignment.
And the following "activity" exists: And the following "activities" exist:
| activity | assign | | activity | course | name | assignsubmission_onlinetext_enabled |
| course | C1 | | assign | C1 | A1 | 1 |
| section | 1 | | page | C1 | P1 | |
| name | A1 | | page | C1 | P2 | |
| intro | x | | page | C1 | P3 | |
| assignsubmission_onlinetext_enabled | 1 | | page | C1 | P4 | |
@javascript @javascript
Scenario: Test condition Scenario: Test condition
# Basic setup. Given I am on the "P2" "page activity editing" page logged in as "teacher1"
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 |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue" 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" And I press "Save and return to course"
# Add a Page with a grade condition for 50%. # Add a Page with a grade condition for 50%.
And I add a "Page" to section "3" And I am on the "P3" "page activity editing" page
And I set the following fields to these values:
| Name | P3 |
| Description | x |
| Page content | x |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue" 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" And I press "Save and return to course"
# Check if disabling a part of the restriction is get saved. # Check if disabling a part of the restriction is get saved.
And I open "P3" actions menu And I am on the "P3" "page activity editing" page
And I click on "Edit settings" "link" in the "P3" activity
And I expand all fieldsets And I expand all fieldsets
And I click on "max" "checkbox" in the ".availability-item" "css_element" And I click on "max" "checkbox" in the ".availability-item" "css_element"
And I press "Save and return to course" And I press "Save and return to course"
And I open "P3" actions menu And I am on the "P3" "page activity editing" page
And I click on "Edit settings" "link" in the "P3" activity
And I expand all fieldsets
And the field "Maximum grade percentage (exclusive)" matches value "" And the field "Maximum grade percentage (exclusive)" matches value ""
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
# Add a Page with a grade condition for 10%. # Add a Page with a grade condition for 10%.
And I add a "Page" to section "4" And I am on the "P4" "page activity editing" page
And I set the following fields to these values:
| Name | P4 |
| Description | x |
| Page content | x |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue" 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 set the field "Minimum grade percentage (inclusive)" to "10"
And I press "Save and return to course" And I press "Save and return to course"
And I log out
# Log in as student without a grade yet. # Log in as student without a grade yet.
When I am on the "A1" "assign activity" page logged in as student1 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 "P3" in the "region-main" "region"
And I should not see "P4" 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 should see "A1" in the "region-main" "region"
And I log out
# Log back in as teacher. # Log back in as teacher.
When I am on the "A1" "assign activity" page logged in as teacher1 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 the "activitynames" filter applies to "content and headings"
And I am on the "C1" "Course" page logged in as "teacher1" And I am on the "C1" "Course" page logged in as "teacher1"
And I turn editing mode on 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 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 "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue" And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I set the field "Grade" to "A-One" And I set the field "Grade" to "A-One"

View file

@ -16,15 +16,16 @@ Feature: availability_group
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| page | C1 | P1 |
| page | C1 | P2 |
| page | C1 | P3 |
@javascript @javascript
Scenario: Test condition Scenario: Test condition
# Basic setup. # Basic setup.
Given I log in as "teacher1" Given I am on the "P1" "page activity editing" page logged 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"
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
Then "Group" "button" should not exist in the "Add restriction..." "dialogue" Then "Group" "button" should not exist in the "Add restriction..." "dialogue"
@ -37,8 +38,7 @@ Feature: availability_group
| G2 | C1 | GI2 | | G2 | C1 | GI2 |
# This step used to be 'And I follow "C1"', but Chrome thinks the breadcrumb # 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. # is not clickable, so we'll go via the home page instead.
And I am on "Course 1" course homepage And I am on the "P1" "page activity editing" page
And I add a "Page" to section "1"
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
Then "Group" "button" should exist in the "Add restriction..." "dialogue" 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" Given I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "(Any group)" And I set the field "Group" to "(Any group)"
And I click on ".availability-item .availability-eye img" "css_element" 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" And I click on "Save and return to course" "button"
# Page P2 with group G1. # Page P2 with group G1.
And I add a "Page" to section "2" And I am on the "P2" "page activity editing" page
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue" 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" And I click on "Save and return to course" "button"
# Page P3 with group G2 # Page P3 with group G2
And I add a "Page" to section "3" And I am on the "P3" "page activity editing" page
And I set the following fields to these values:
| Name | P3 |
| Description | x |
| Page content | x |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue" 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" And I click on "Save and return to course" "button"
# Log back in as student. # Log back in as student.
When I log out When I am on the "Course 1" "course" page logged in as "student1"
And I log in as "student1"
And I am on "Course 1" course homepage
# No pages should appear yet. # No pages should appear yet.
Then I should not see "P1" in the "region-main" "region" Then I should not see "P1" in the "region-main" "region"
@ -93,8 +79,6 @@ Feature: availability_group
Given the following "group members" exist: Given the following "group members" exist:
| user | group | | user | group |
| student1 | GI1 | | student1 | GI1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
# P1 (any groups) and P2 should show but not P3. # 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. # The activity names filter is enabled because it triggered a bug in older versions.
And the "activitynames" filter is "on" And the "activitynames" filter is "on"
And the "activitynames" filter applies to "content and headings" And the "activitynames" filter applies to "content and headings"
And I am on the "C1" "Course" page logged in as "teacher1" And I am on the "P1" "page activity editing" page logged in as "teacher1"
And I turn editing mode on
And I add a "Page" to section "1"
And I expand all fieldsets 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 "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue" And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "G-One" And I set the field "Group" to "G-One"
And I click on "Save and return to course" "button" 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. # 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" 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: And the following "group members" exist:
| user | group | | user | group |
| student1 | GI1 | | student1 | GI1 |
# Basic setup.
And the following "activities" exist:
| activity | course | name |
| page | C1 | P1 |
| page | C1 | P2 |
@javascript @javascript
Scenario: Test condition 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. # 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 expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
Then "Grouping" "button" should not exist in the "Add restriction..." "dialogue" Then "Grouping" "button" should not exist in the "Add restriction..." "dialogue"
@ -44,7 +45,7 @@ Feature: availability_grouping
| name | course | idnumber | | name | course | idnumber |
| GX1 | C1 | GXI1 | | GX1 | C1 | GXI1 |
| GX2 | C1 | GXI2 | | 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 expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
Then "Grouping" "button" should exist in the "Add restriction..." "dialogue" Then "Grouping" "button" should exist in the "Add restriction..." "dialogue"
@ -53,18 +54,10 @@ Feature: availability_grouping
Given I click on "Grouping" "button" Given I click on "Grouping" "button"
And I set the field "Grouping" to "GX1" And I set the field "Grouping" to "GX1"
And I click on ".availability-item .availability-eye img" "css_element" 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" And I click on "Save and return to course" "button"
# Page P2 with grouping GX2. # Page P2 with grouping GX2.
And I add a "Page" to section "2" And I am on the "P2" "page activity editing" page
And I set the following fields to these values:
| Name | P2 |
| Description | x |
| Page content | x |
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Grouping" "button" And I click on "Grouping" "button"
@ -73,21 +66,17 @@ Feature: availability_grouping
And I click on "Save and return to course" "button" And I click on "Save and return to course" "button"
# Log back in as student. # Log back in as student.
When I log out When I am on the "Course 1" "course" page logged in as "student1"
And I log in as "student1"
And I am on "Course 1" course homepage
# No pages should appear yet. # No pages should appear yet.
Then I should not see "P1" in the "region-main" "region" Then I should not see "P1" in the "region-main" "region"
And I should not see "P2" 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. # Add group to grouping and log out/in again.
And I log out
And the following "grouping groups" exist: And the following "grouping groups" exist:
| grouping | group | | grouping | group |
| GXI1 | GI1 | | GXI1 | GI1 |
And I log in as "student1" And I am on the "Course 1" "course" page logged in as "student1"
And I am on "Course 1" course homepage
# P1 should show but not B2. # P1 should show but not B2.
Then I should see "P1" in the "region-main" "region" 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. # The activity names filter is enabled because it triggered a bug in older versions.
And the "activitynames" filter is "on" And the "activitynames" filter is "on"
And the "activitynames" filter applies to "content and headings" And the "activitynames" filter applies to "content and headings"
And I am on the "C1" "Course" page logged in as "teacher1" And I am on the "Test assign" "assign activity editing" 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 expand all fieldsets And I expand all fieldsets
And I press "Add group/grouping access restriction" And I press "Add group/grouping access restriction"
And I press "Save and return to course" 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. # 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" When I am on the "C1" "Course" page logged in as "student1"

View file

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

View file

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

View file

@ -59,12 +59,8 @@ Feature: edit_availability
| activity | page | | activity | page |
| course | C1 | | course | C1 |
| idnumber | 0002 | | idnumber | 0002 |
| section | 1 |
| name | Page2 | | name | Page2 |
| intro | pageintro | And I am on the "Page2" "page activity editing" page
And I am on "Course 1" course homepage
And I follow "Page2"
And I navigate to "Settings" in current page administration
Then "Restrict access" "fieldset" should exist Then "Restrict access" "fieldset" should exist
Given I am on "Course 1" course homepage Given I am on "Course 1" course homepage
@ -74,9 +70,12 @@ Feature: edit_availability
@javascript @javascript
Scenario: Edit availability using settings in activity form Scenario: Edit availability using settings in activity form
# Set up. # Set up.
Given I log in as "teacher1" Given the following "activity" exists:
And I am on "Course 1" course homepage with editing mode on | activity | page |
And I add a "Page" to section "1" | 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 And I expand all fieldsets
Then I should see "None" in the "Restrict access" "fieldset" 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 | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activity" exists: And the following "activities" exist:
| course | C1 | | course | activity | idnumber | name | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | submissiondrafts |
| activity | assign | | C1 | assign | Grade assignment | Grade assignment | 1 | 0 | 0 |
| idnumber | Grade assignment | | C1 | page | Grade page | Test page name | | | |
| 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
# Adding the page like this because id_availableform_enabled needs to be clicked to trigger the action. # 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 expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
And I click on "Grade" "button" in the "Add restriction..." "dialogue" And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I click on "min" "checkbox" And I click on "min" "checkbox"
And I set the following fields to these values: And I set the following fields to these values:
| Name | Test page name | | id | Grade assignment |
| Description | Restricted page, till grades in Grade assignment is at least 20% | | minval | 20 |
| Page content | Test page contents |
| id | Grade assignment |
| minval | 20 |
And I press "Save and return to course" 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 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" 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 | | Online text | I'm the student submission |
And I press "Save changes" And I press "Save changes"
And I should see "Submitted for grading" 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 am on the "Grade assignment" "assign activity" page logged in as teacher1
And I follow "View all submissions" 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: And I set the following fields to these values:
| Grade | 21 | | Grade | 21 |
And I press "Save changes" 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 I am on the "Course 1" course page logged in as student1
And "Test page name" activity should be visible 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 | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activity" exists: And the following "activities" exist:
| activity | assign | | activity | course | section | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | submissiondrafts | content |
| course | C1 | | assign | C1 | 1 | Grade assignment | Grade this assignment to revoke restriction on restricted assignment | 1 | 0 | 0 | |
| section | 1 | | page | C1 | 2 | Test page name | Restricted section page resource, till grades in Grade assignment is at least 20% | | | | Test page contents |
| name | Grade assignment |
| intro | Grade this assignment to revoke restriction on restricted assignment |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
@javascript @javascript
Scenario: Show section greyed-out to student when completion condition is not satisfied 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: And the following "activities" exist:
| activity | course | section | intro | completion | idnumber | | activity | course | section | intro | completion | idnumber |
| label | C1 | 1 | Test label | 1 | 1 | | 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" When I edit the section "2"
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
@ -49,9 +40,7 @@ Feature: Restrict sections availability through completion or grade conditions
| cm | Test label | | cm | Test label |
| Required completion status | must be marked complete | | Required completion status | must be marked complete |
And I press "Save changes" And I press "Save changes"
And I log out And I am on the "Course 1" course page logged in as "student1"
And I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Not available unless: 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 should not see "Test page name"
And I toggle the manual completion state of "Test label" 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 Scenario: Show section greyed-out to student when grade condition is not satisfied
Given I log in as "teacher1" Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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 edit the section "2"
And I expand all fieldsets And I expand all fieldsets
And I click on "Add restriction..." "button" And I click on "Add restriction..." "button"
@ -75,9 +60,7 @@ Feature: Restrict sections availability through completion or grade conditions
| min | 1 | | min | 1 |
| minval | 20 | | minval | 20 |
And I press "Save changes" And I press "Save changes"
And I log out When I am on the "Course 1" course page logged in as "student1"
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Not available unless: You achieve higher than a certain score in Grade assignment" 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 "Test page name" activity should be hidden
And I am on the "Grade assignment" "assign activity" page 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 | | Grade | 21 |
And I press "Save changes" And I press "Save changes"
And I follow "Edit settings" And I follow "Edit settings"
And I log out
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 "Test page name" activity should be visible 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" And I should not see "Not available unless: You achieve higher than a certain score in Grade assignment"