first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,67 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
/**
* Availability related behat steps and selectors definitions.
*
* @package core_availability
* @category test
* @copyright 2023 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_availability extends behat_base {
/**
* Return the list of partial named selectors.
*
* @return array
*/
public static function get_partial_named_selectors(): array {
return [
new behat_component_named_selector(
'Activity availability', [
".//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')]"
. "[descendant::*[contains(normalize-space(.), %locator%)]]//div[@data-region='availabilityinfo']",
]
),
new behat_component_named_selector(
'Section availability', [".//li[@id = %locator%]//div[@data-region='availabilityinfo']"],
),
new behat_component_named_selector(
'Set Of Restrictions', ["//div[h3[@data-restriction-order=%locator% and contains(text(), 'Set of')]]"],
),
];
}
/**
* Return the list of exact named selectors
*
* @return array
*/
public static function get_exact_named_selectors(): array {
return [
new behat_component_named_selector(
'Availability Button Area',
[
"//h3[@data-restriction-order=%locator%]/following-sibling::div[contains(@class,'availability-inner')]/"
. "div[contains(@class,'availability-button')]",
],
),
];
}
}
@@ -0,0 +1,166 @@
@core @core_availability
Feature: Display availability for activities and sections
In order to know which activities are available
As a user
I need to see appropriate availability restrictions for activities and sections
# PURPOSE OF THIS TEST FEATURE:
#
# This test is to do a basic check of the user interface relating to display
# of availability conditions - i.e. if there's a condition, does it show up;
# are we doing the HTML correctly; does it correctly hide an activity where
# the options are set to not show it at all.
#
# Things this test is not:
# - It is not a test of the date condition specifically. The date condition is
# only used as an example in order to get the availability information to
# display. (The date condition has its own Behat test in
# /availability/condition/date/tests/behat.)
# - It is not a complete test of the logic. This is supposed to be a shallow
# check of the user interface parts and doesn't cover all logical
# possibilities. The logic is tested in PHPUnit tests instead, which are
# much more efficient. (Again there are unit tests for the overall system
# and for each condition type.)
Background:
Given the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| format | topics |
| initsections | 1 |
And the following "users" exist:
| username |
| teacher1 |
| student1 |
And the following "course enrolments" exist:
| 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 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"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I set the field "x[month]" to "March"
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 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"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I set the field "x[month]" to "March"
And I click on ".availability-item .availability-eye img" "css_element"
And I press "Add restriction..."
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
And I set the field "User profile field" to "Email address"
And I set the field "Value to compare against" to "email@example.com"
And I set the field "Method of comparison" to "is equal to"
And I press "Save and return to course"
# Page 1 should show in single-line format, showing the date
Then I should see "Available until" in the "Page 1" "core_availability > Activity availability"
And I should see "2013" in the "Page 1" "core_availability > Activity availability"
And I should see "2013" in the "Page 1" "core_availability > Activity availability"
And "li" "css_element" should not exist in the "Page 1" "core_availability > Activity availability"
And "Show more" "button" should not exist in the "Page 1" "core_availability > Activity availability"
# Page 2 should show in list format.
And "li" "css_element" should exist in the "Page 2" "core_availability > Activity availability"
And I should see "Not available unless:" in the "Page 2" "core_availability > Activity availability"
And I should see "It is before" in the "Page 2" "core_availability > Activity availability"
And I should see "hidden otherwise" in the "Page 2" "core_availability > Activity availability"
And I click on "Show more" "button" in the "Page 2" "activity"
And I should see "Email address" in the "Page 2" "core_availability > Activity availability"
And I click on "Show less" "button" in the "Page 2" "core_availability > Activity availability"
And I should not see "Email address" in the "Page 2" "core_availability > Activity availability"
# Page 3 should not have available info.
And "Page 3" "core_availability > Activity availability" should not exist
# Change to student view.
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"
And ".activity-instance a" "css_element" should not exist in the "Section 1" "section"
# Date display should be present.
And I should see "Available until" in the "Section 1" "section"
# Page 2 display not there at all
And I should not see "Page 2" in the "region-main" "region"
# Page 3 display and link
And I should see "Page 3" in the "region-main" "region"
And ".activity-instance a" "css_element" should exist in the "Section 3" "section"
@javascript
Scenario: Section availability display
# Set up.
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"
And I expand all fieldsets
And I press "Add restriction..."
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I press "Add restriction..."
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
And I set the field "User profile field" to "Email address"
And I set the field "Value to compare against" to "email@example.com"
And I set the field "Method of comparison" to "is equal to"
And I press "Save changes"
# Section 2 is the same but hidden from students
And I am on "Course 1" course homepage
And I edit the section "2"
And I expand all fieldsets
And I press "Add restriction..."
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I click on ".availability-item .availability-eye img" "css_element"
And I press "Save changes"
# This is necessary because otherwise it fails in Chrome, see MDL-44959
And I am on "Course 1" course homepage
# Check display
Then I should see "Not available unless" in the "section-1" "core_availability > Section availability"
And I should see "Available until" in the "section-2" "core_availability > Section availability"
And I should see "hidden otherwise" in the "section-2" "core_availability > Section availability"
# Change to student view.
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"
And I should not see "Page 2" in the "region-main" "region"
And I should see "Page 3" in the "region-main" "region"
# Section 1 should be visible and show info.
And I should see "Section 1" in the "region-main" "region"
And I should see "Not available unless" in the "section-1" "core_availability > Section availability"
And I click on "Show more" "button" in the "section-1" "core_availability > Section availability"
And I should see "Email address" in the "section-1" "core_availability > Section availability"
And I click on "Show less" "button" in the "section-1" "core_availability > Section availability"
And I should not see "Email address" in the "section-1" "core_availability > Section availability"
# Section 2 should not be available at all
And I should not see "Section 2" in the "region-main" "region"
@@ -0,0 +1,279 @@
@core @core_availability
Feature: edit_availability
In order to control which students can see activities
As a teacher
I need to set up availability options for activities and sections
# PURPOSE OF THIS TEST FEATURE:
#
# This test covers the user interface around editing availability conditions,
# especially the JavaScript code which is not tested elsewhere (e.g. does the
# 'Add restriction' dialog work). It tests both forms and also the admin
# setting interface.
#
# This test does not check the detailed behaviour of the availability system,
# which is mainly covered in PHPUnit (and, from the user interface
# perspective, in the other Behat tests for each type of condition).
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "users" exist:
| username |
| teacher1 |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| name | MyForum |
Scenario: Confirm the 'enable availability' option is working
Given the following config values are set as admin:
| enableavailability | 0 |
When I log in as "teacher1"
And the following "activity" exists:
| activity | page |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
| name | Page1 |
| intro | pageintro |
And I am on "Course 1" course homepage with editing mode on
And I follow "Page1"
And I navigate to "Settings" in current page administration
Then "Restrict access" "fieldset" should not exist
Given I am on "Course 1" course homepage
When I edit the section "1"
Then "Restrict access" "fieldset" should not exist
And the following config values are set as admin:
| enableavailability | 1 |
And the following "activity" exists:
| activity | page |
| course | C1 |
| idnumber | 0002 |
| name | Page2 |
And I am on the "Page2" "page activity editing" page
Then "Restrict access" "fieldset" should exist
Given I am on "Course 1" course homepage
When I edit the section "1"
Then "Restrict access" "fieldset" should exist
@javascript
Scenario: Edit availability using settings in activity form
# Set up.
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"
# Add a Date restriction and check it appears.
When I click on "Add restriction..." "button"
Then "Add restriction..." "dialogue" should be visible
When I click on "Date" "button" in the "Add restriction..." "dialogue"
Then "Add restriction..." "dialogue" should not exist
And I should not see "None" in the "Restrict access" "fieldset"
And "Restriction type" "select" should be visible
And I should see "Date" in the "Restrict access" "fieldset"
And ".availability-item .availability-eye img" "css_element" should be visible
And ".availability-item .availability-delete img" "css_element" should be visible
And the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Displayed if student"
# Toggle the eye icon.
When I click on ".availability-item .availability-eye img" "css_element"
Then the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Hidden entirely"
When I click on ".availability-item .availability-eye img" "css_element"
Then the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Displayed if student"
# Click the delete button.
When I click on ".availability-item .availability-delete img" "css_element"
Then I should not see "Date" in the "Restrict access" "fieldset"
# Add a nested restriction set and check it appears.
When I click on "Add restriction..." "button"
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
Then ".availability-children .availability-list" "css_element" should be visible
And I should see "None" in the ".availability-children .availability-list" "css_element"
And I should see "Please set" in the ".availability-children .availability-list" "css_element"
And I should see "Add restriction" in the ".availability-children .availability-list" "css_element"
# Click on the button to add a restriction inside the nested set.
When I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then I should not see "None" in the ".availability-children .availability-list" "css_element"
And I should not see "Please set" in the ".availability-children .availability-list" "css_element"
And I should see "Date" in the ".availability-children .availability-list" "css_element"
# OK, let's delete the date inside the nested set...
When I click on ".availability-item .availability-delete img" "css_element" in the ".availability-item" "css_element"
Then I should not see "Date" in the ".availability-children .availability-list" "css_element"
And I should see "None" in the ".availability-children .availability-list" "css_element"
# ...and the nested set itself.
When I click on ".availability-none .availability-delete img" "css_element"
Then ".availability-children .availability-list" "css_element" should not exist
# Add two dates so we can check the connectors.
When I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then I should see "and" in the "Restrict access" "fieldset"
And "Required restrictions" "select" should be visible
# Try changing the connector type.
When I set the field "Required restrictions" to "any"
Then I should not see "and" in the "Restrict access" "fieldset"
And I should see "or" in the "Restrict access" "fieldset"
# Now delete one of the dates and check the connector goes away.
When I click on ".availability-item .availability-delete img" "css_element"
Then I should not see "or" in the "Restrict access" "fieldset"
# Add a nested restriction set with two dates so there will be inner connector.
When I click on "Add restriction..." "button"
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then I should see "and" in the ".availability-children .availability-list .availability-connector" "css_element"
# Check changing the outer one does not affect the inner one.
When I set the field "Required restrictions" to "all"
Then I should not see "or" in the "Restrict access" "fieldset"
When I set the field "Required restrictions" to "any"
Then I should see "or" in the "Restrict access" "fieldset"
And I should not see "or" in the ".availability-children .availability-list .availability-connector" "css_element"
@javascript
Scenario: Edit availability using settings in section form
# Set up.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
# Edit a section
When I edit the section "1"
And I expand all fieldsets
Then I should see "None" in the "Restrict access" "fieldset"
# Add a Date restriction and check it appears.
When I click on "Add restriction..." "button"
When I click on "Date" "button" in the "Add restriction..." "dialogue"
And I should not see "None" in the "Restrict access" "fieldset"
And "Restriction type" "select" should be visible
And I should see "Date" in the "Restrict access" "fieldset"
@javascript
Scenario: 'Add group/grouping access restriction' button unavailable
# Button does not exist when conditional access restrictions are turned off.
Given the following config values are set as admin:
| enableavailability | 0 |
And I am on the "MyForum" "forum activity editing" page logged in as admin
When I expand all fieldsets
Then "Add group/grouping access restriction" "button" should not exist
@javascript
Scenario: Use the 'Add group/grouping access restriction' button
# Button should initially be disabled.
Given the following "groupings" exist:
| name | course | idnumber |
| GX1 | C1 | GXI1 |
And I am on the "MyForum" "forum activity editing" page logged in as admin
When I expand all fieldsets
Then the "Add group/grouping access restriction" "button" should be disabled
# Turn on separate groups.
And I set the field "Group mode" to "Separate groups"
And the "Add group/grouping access restriction" "button" should be enabled
# Press the button and check it adds a restriction and disables itself.
And I should see "None" in the "Restrict access" "fieldset"
And I press "Add group/grouping access restriction"
And I should see "Group" in the "Restrict access" "fieldset"
And the "Add group/grouping access restriction" "button" should be disabled
# Delete the restriction and check it is enabled again.
And I click on "Delete" "link" in the "Restrict access" "fieldset"
And the "Add group/grouping access restriction" "button" should be enabled
# Try a grouping instead.
And I set the field "Grouping" to "GX1"
And I press "Add group/grouping access restriction"
And I should see "Grouping" in the "Restrict access" "fieldset"
# Check the button still works after saving and editing.
And I press "Save and display"
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And the "Add group/grouping access restriction" "button" should be disabled
And I should see "Grouping" in the "Restrict access" "fieldset"
# And check it's still active if I delete the condition.
And I click on "Delete" "link" in the "Restrict access" "fieldset"
And the "Add group/grouping access restriction" "button" should be enabled
@javascript
Scenario: Edit section availability using course page link
# Setting a restriction up
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I edit the section "1"
And I expand all fieldsets
And I press "Add restriction..."
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I press "Save changes"
# Testing edit restrictions link
And "Edit restrictions" "link" should exist in the "section-1" "core_availability > Section availability"
When I click on "Edit restrictions" "link" in the "section-1" "core_availability > Section availability"
Then I should see "Restrict access"
And I should not see "Summary of General"
And I should see "Collapse all"
And I should not see "Expand all"
And I click on "Cancel" "button"
And I am on "Course 1" course homepage with editing mode off
And I should not see "Edit restrictions"
@javascript
Scenario: Edit activity availability using course page link
# Setting a restriction up
Given I am on the "MyForum" "forum 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"
When I press "Save and return to course"
# Edit restrictions link not displayed when editing mode is off.
Then "Edit restrictions" "link" should not exist in the "MyForum" "core_availability > Activity availability"
# Testing edit restrictions link
But I am on "Course 1" course homepage with editing mode on
And "Edit restrictions" "link" should exist in the "MyForum" "core_availability > Activity availability"
And I click on "Edit restrictions" "link" in the "MyForum" "core_availability > Activity availability"
And I should see "Restrict access"
And I should not see "Content"
And I should see "Collapse all"
And I should not see "Expand all"
@javascript
Scenario: Edit activity availability button is shown after duplicating an activity
# Setting a restriction up
Given I am on the "MyForum" "forum 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"
When I press "Save and return to course"
And I turn editing mode on
And I duplicate "MyForum" activity
# Testing edit restrictions link
Then "Edit restrictions" "link" should exist in the "MyForum (copy)" "core_availability > Activity availability"
@@ -0,0 +1,149 @@
@core @core_availability @javascript
Feature: Private rule sets
In order to prevent private data being leaked in restriction sets
As a teacher
I want to have restrictions hidden when a private condition is selected
Background:
Given the following "courses" exist:
| fullname | shortname | format | enablecompletion | numsections |
| Course 1 | C1 | topics | 1 | 3 |
And the following "users" exist:
| username |
| teacher1 |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "groups" exist:
| name | course | idnumber | visibility |
| Group A | C1 | GA | 0 |
| Group B | C1 | GB | 1 |
And I log in as "teacher1"
And I add a page activity to course "Course 1" section "1"
And I expand all fieldsets
Scenario: Add restriction with visible condition (must match), display option should be active
When I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then ".availability-children .availability-eye" "css_element" should be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
And the "title" attribute of ".availability-eye" "css_element" should contain "Click to hide"
Scenario: Add restriction with private condition (must match), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
Then ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible
And the "title" attribute of ".availability-eye-disabled" "css_element" should contain "Cannot be changed as ruleset includes a rule containing private data."
Scenario: Add restrictions with a visible and a private condition (must match all), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
When I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible
Scenario: Remove private condition (must match), display option should be active
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
Then ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible
# Should pick the first one (Group B)
When I click on ".availability-item .availability-delete img" "css_element"
Then ".availability-children .availability-eye" "css_element" should be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
Scenario: Set a private condition to a visible value (must match), display option should be active
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
Then ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible
# Should pick the first one (Group B)
When I set the field "Group" to "Group A"
Then ".availability-children .availability-eye" "css_element" should be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
Scenario: Add restrictions with a visible and a private condition (must match any), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "Required restrictions" to "any"
# "Hidden" icon should be shown in header.
And ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
And ".availability-header .availability-eye" "css_element" should not be visible
And ".availability-header .availability-eye-disabled" "css_element" should be visible
Scenario: Add restriction with private condition (must not match), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
And I set the field "Restriction type" to "must not"
# "Hidden" icon should be shown in header.
And ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
And ".availability-header .availability-eye" "css_element" should not be visible
And ".availability-header .availability-eye-disabled" "css_element" should be visible
Scenario: Add restrictions with a visible and a private condition (must not match all), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "Restriction type" to "must not"
# "Hidden" icon should be shown in header.
And ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should not be visible
And ".availability-header .availability-eye" "css_element" should not be visible
And ".availability-header .availability-eye-disabled" "css_element" should be visible
Scenario: Add restrictions with a visible and a private condition (must not match any), display option should be disabled
When I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Group B"
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "Restriction type" to "must not"
And I set the field "Required restrictions" to "any"
# "Hidden" icon should be shown in conditions, but not in the header.
And ".availability-header .availability-eye" "css_element" should not be visible
And ".availability-header .availability-eye-disabled" "css_element" should not be visible
And ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible
Scenario: Private conditions should not show to unprivileged users
Given I set the field "Name" to "Test page"
And I set the field "Page content" to "test"
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 "Group B"
And I press "Save and return to course"
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
Then I should not see "Test page"
And I should not see "Not available unless: You belong to Group B"
Scenario: Loading a rule set containing private conditions should disable display option
Given I set the field "Name" to "Test page"
And I set the field "Page content" to "test"
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 "Group B"
And I press "Save and display"
When I follow "Settings"
And I expand all fieldsets
Then ".availability-children .availability-eye" "css_element" should not be visible
And ".availability-children .availability-eye-disabled" "css_element" should be visible