Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_availability @javascript
2
Feature: Private rule sets
3
  In order to prevent private data being leaked in restriction sets
4
  As a teacher
5
  I want to have restrictions hidden when a private condition is selected
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | format | enablecompletion | numsections |
10
      | Course 1 | C1        | topics | 1                | 3           |
11
    And the following "users" exist:
12
      | username |
13
      | teacher1 |
14
      | student1 |
15
    And the following "course enrolments" exist:
16
      | user     | course | role           |
17
      | teacher1 | C1     | editingteacher |
18
      | student1 | C1     | student        |
19
    And the following "groups" exist:
20
      | name    | course | idnumber | visibility |
21
      | Group A | C1     | GA       | 0          |
22
      | Group B | C1     | GB       | 1          |
23
    And I log in as "teacher1"
24
    And I add a page activity to course "Course 1" section "1"
25
    And I expand all fieldsets
26
 
27
  Scenario: Add restriction with visible condition (must match), display option should be active
28
    When I click on "Add restriction..." "button"
29
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
30
    Then ".availability-children .availability-eye" "css_element" should be visible
31
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
32
    And the "title" attribute of ".availability-eye" "css_element" should contain "Click to hide"
33
 
34
  Scenario: Add restriction with private condition (must match), display option should be disabled
35
    When I click on "Add restriction..." "button"
36
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
37
    And I set the field "Group" to "Group B"
38
    Then ".availability-children .availability-eye" "css_element" should not be visible
39
    And ".availability-children .availability-eye-disabled" "css_element" should be visible
40
    And the "title" attribute of ".availability-eye-disabled" "css_element" should contain "Cannot be changed as ruleset includes a rule containing private data."
41
 
42
  Scenario: Add restrictions with a visible and a private condition (must match all), display option should be disabled
43
    When I click on "Add restriction..." "button"
44
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
45
    And I set the field "Group" to "Group B"
46
    When I click on "Add restriction..." "button"
47
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
48
    Then ".availability-children .availability-eye" "css_element" should not be visible
49
    And ".availability-children .availability-eye-disabled" "css_element" should be visible
50
 
51
  Scenario: Remove private condition (must match), display option should be active
52
    When I click on "Add restriction..." "button"
53
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
54
    And I set the field "Group" to "Group B"
55
    And I click on "Add restriction..." "button"
56
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
57
    Then ".availability-children .availability-eye" "css_element" should not be visible
58
    And ".availability-children .availability-eye-disabled" "css_element" should be visible
59
    # Should pick the first one (Group B)
60
    When I click on ".availability-item .availability-delete img" "css_element"
61
    Then ".availability-children .availability-eye" "css_element" should be visible
62
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
63
 
64
  Scenario: Set a private condition to a visible value (must match), display option should be active
65
    When I click on "Add restriction..." "button"
66
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
67
    And I set the field "Group" to "Group B"
68
    Then ".availability-children .availability-eye" "css_element" should not be visible
69
    And ".availability-children .availability-eye-disabled" "css_element" should be visible
70
    # Should pick the first one (Group B)
71
    When I set the field "Group" to "Group A"
72
    Then ".availability-children .availability-eye" "css_element" should be visible
73
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
74
 
75
  Scenario: Add restrictions with a visible and a private condition (must match any), display option should be disabled
76
    When I click on "Add restriction..." "button"
77
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
78
    And I set the field "Group" to "Group B"
79
    And I click on "Add restriction..." "button"
80
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
81
    And I set the field "Required restrictions" to "any"
82
    # "Hidden" icon should be shown in header.
83
    And ".availability-children .availability-eye" "css_element" should not be visible
84
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
85
    And ".availability-header .availability-eye" "css_element" should not be visible
86
    And ".availability-header .availability-eye-disabled" "css_element" should be visible
87
 
88
  Scenario: Add restriction with private condition (must not match), display option should be disabled
89
    When I click on "Add restriction..." "button"
90
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
91
    And I set the field "Group" to "Group B"
92
    And I set the field "Restriction type" to "must not"
93
    # "Hidden" icon should be shown in header.
94
    And ".availability-children .availability-eye" "css_element" should not be visible
95
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
96
    And ".availability-header .availability-eye" "css_element" should not be visible
97
    And ".availability-header .availability-eye-disabled" "css_element" should be visible
98
 
99
  Scenario: Add restrictions with a visible and a private condition (must not match all), display option should be disabled
100
    When I click on "Add restriction..." "button"
101
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
102
    And I set the field "Group" to "Group B"
103
    And I click on "Add restriction..." "button"
104
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
105
    And I set the field "Restriction type" to "must not"
106
    # "Hidden" icon should be shown in header.
107
    And ".availability-children .availability-eye" "css_element" should not be visible
108
    And ".availability-children .availability-eye-disabled" "css_element" should not be visible
109
    And ".availability-header .availability-eye" "css_element" should not be visible
110
    And ".availability-header .availability-eye-disabled" "css_element" should be visible
111
 
112
  Scenario: Add restrictions with a visible and a private condition (must not match any), display option should be disabled
113
    When I click on "Add restriction..." "button"
114
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
115
    And I set the field "Group" to "Group B"
116
    And I click on "Add restriction..." "button"
117
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
118
    And I set the field "Restriction type" to "must not"
119
    And I set the field "Required restrictions" to "any"
120
    # "Hidden" icon should be shown in conditions, but not in the header.
121
    And ".availability-header .availability-eye" "css_element" should not be visible
122
    And ".availability-header .availability-eye-disabled" "css_element" should not be visible
123
    And ".availability-children .availability-eye" "css_element" should not be visible
124
    And ".availability-children .availability-eye-disabled" "css_element" should be visible
125
 
126
  Scenario: Private conditions should not show to unprivileged users
127
    Given I set the field "Name" to "Test page"
128
    And I set the field "Page content" to "test"
129
    And I click on "Add restriction..." "button"
130
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
131
    And I set the field "Group" to "Group B"
132
    And I press "Save and return to course"
133
    And I log out
134
    And I log in as "student1"
135
    When I am on "Course 1" course homepage
136
    Then I should not see "Test page"
137
    And I should not see "Not available unless: You belong to Group B"
138
 
139
  Scenario: Loading a rule set containing private conditions should disable display option
140
    Given I set the field "Name" to "Test page"
141
    And I set the field "Page content" to "test"
142
    And I click on "Add restriction..." "button"
143
    And I click on "Group" "button" in the "Add restriction..." "dialogue"
144
    And I set the field "Group" to "Group B"
145
    And I press "Save and display"
146
    When I follow "Settings"
147
    And I expand all fieldsets
148
    Then ".availability-children .availability-eye" "css_element" should not be visible
149
    And ".availability-children .availability-eye-disabled" "css_element" should be visible