Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_policy
2
Feature: Manage policies
3
  In order to manage policies
4
  As a manager
5
  I need to be able to create and edit site policies
6
 
7
  Background:
8
    Given the following config values are set as admin:
9
      | sitepolicyhandler | tool_policy |
10
    And the following "users" exist:
11
      | username | firstname | lastname | email           |
12
      | user1    | User      | One      | one@example.com |
13
      | user2    | User      | Two      | two@example.com |
14
      | manager  | Max       | Manager  | man@example.com |
15
    And the following "role assigns" exist:
16
      | user    | role           | contextlevel | reference |
17
      | manager | manager        | System       |           |
18
 
19
  Scenario: Create new policy and save as draft
20
    When I log in as "manager"
21
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
22
    And I follow "New policy"
23
    And I set the following fields to these values:
24
      | Name        | Policy1        |
25
      | Version     | v1             |
26
      | Summary     | Policy summary |
27
      | Full policy | Full text      |
28
    And the field "Type" matches value "Site policy"
29
    And the field "User consent" matches value "All users"
30
    And the field "status" matches value "0"
31
    And "Draft" "field" should exist
32
    And "Active" "field" should exist
33
    And "Minor change" "field" should not exist
34
    And I should not see "Minor change"
35
    And "Save as draft" "button" should not exist
36
    And I press "Save"
37
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
38
      | Name                                        | Policy status | Version | Agreements |
39
      | Policy1 Site policy, All users, Compulsory  | Draft         | v1      | N/A        |
40
    And I log out
41
 
42
  Scenario: Create new policy and save as active
43
    When I log in as "manager"
44
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
45
    And I follow "New policy"
46
    And I set the following fields to these values:
47
      | Name        | Policy1        |
48
      | Version     | v1             |
49
      | Summary     | Policy summary |
50
      | Full policy | Full text      |
51
      | Active      | 1              |
52
    And I press "Save"
53
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
54
      | Name                                        | Policy status | Version | Agreements  |
55
      | Policy1 Site policy, All users, Compulsory  | Active        | v1      | 0 of 4 (0%) |
56
    And I log out
57
 
58
  Scenario: Edit active policy and save as minor change
59
    Given the following policies exist:
60
      | Name       | Revision | Content    | Summary     | Status   |
61
      | Policy1    | v1       | full text2 | short text2 | active   |
62
    And I log in as "manager"
63
    And I press "Next"
64
    And I set the field "I agree to the Policy1" to "1"
65
    And I press "Next"
66
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
67
    And I click on "Edit" "link" in the "Policy1" "table_row"
68
    And "Draft" "field" should not exist
69
    And "Active" "field" should not exist
70
    And "Minor change" "field" should exist
71
    And "Save as draft" "button" should exist
72
    And I set the field "Version" to "v1 amended"
73
    And I set the field "Minor change" to "1"
74
    And I press "Save"
75
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
76
      | Name                                        | Policy status | Version    | Agreements   |
77
      | Policy1 Site policy, All users, Compulsory  | Active        | v1 amended | 1 of 4 (25%) |
78
    And I log out
79
 
80
  Scenario: Edit active policy and save as draft
81
    Given the following policies exist:
82
      | Name       | Revision | Content    | Summary     | Status   |
83
      | Policy1    | v1       | full text2 | short text2 | active   |
84
    And I log in as "manager"
85
    And I press "Next"
86
    And I set the field "I agree to the Policy1" to "1"
87
    And I press "Next"
88
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
89
    And I click on "Edit" "link" in the "Policy1" "table_row"
90
    And I set the field "Version" to "v2"
91
    And I press "Save as draft"
92
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
93
      | Name                                        | Policy status | Version    | Agreements   |
94
      | Policy1 Site policy, All users, Compulsory  | Active        | v1         | 1 of 4 (25%) |
95
      | Policy1 Site policy, All users, Compulsory  | Draft         | v2         | N/A          |
96
    And I log out
97
 
98
  Scenario: Edit active policy and save as new active version
99
    Given the following policies exist:
100
      | Name       | Revision | Content    | Summary     | Status   |
101
      | Policy1    | v1       | full text2 | short text2 | active   |
102
    And I log in as "manager"
103
    And I press "Next"
104
    And I set the field "I agree to the Policy1" to "1"
105
    And I press "Next"
106
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
107
    And I click on "Edit" "link" in the "Policy1" "table_row"
108
    And I set the field "Name" to "Policy2"
109
    And I set the field "Version" to "v2"
110
    And I press "Save"
111
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
112
      | Name                                        | Policy status | Version    | Agreements   |
113
      | Policy2 Site policy, All users, Compulsory  | Active        | v2         | 0 of 4 (0%) |
114
    And I should not see "Policy1"
115
    And I should not see "v1"
116
    And I click on "View previous versions" "link" in the "Policy2" "table_row"
117
    And I should see "Policy2 previous versions"
118
    And I should not see "v2"
119
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
120
      | Name                                        | Policy status | Version    | Agreements   |
121
      | Policy1 Site policy, All users, Compulsory  | Inactive      | v1         | 1 of 4 (25%) |
122
    And I log out
123
 
124
  Scenario: Edit draft policy and save as draft
125
    Given the following policies exist:
126
      | Name       | Revision | Content    | Summary     | Status   |
127
      | Policy1    | v1       | full text2 | short text2 | draft    |
128
    And I log in as "manager"
129
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
130
    And I click on "Edit" "link" in the "Policy1" "table_row"
131
    And I set the field "Version" to "v2"
132
    And "Draft" "field" should exist
133
    And "Active" "field" should exist
134
    And "Minor change" "field" should not exist
135
    And I should not see "Minor change"
136
    And "Save as draft" "button" should not exist
137
    And I press "Save"
138
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
139
      | Name                                        | Policy status | Version    | Agreements   |
140
      | Policy1 Site policy, All users, Compulsory  | Draft         | v2         | N/A          |
141
    And I should not see "v1"
142
    And "View previous versions" "link" should not exist
143
    And I log out
144
 
145
  Scenario: Edit draft policy and save as active
146
    Given the following policies exist:
147
      | Name       | Revision | Content    | Summary     | Status   |
148
      | Policy1    | v1       | full text2 | short text2 | draft    |
149
    And I log in as "manager"
150
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
151
    And I click on "Edit" "link" in the "Policy1" "table_row"
152
    And I set the field "Version" to "v2"
153
    And I set the field "Active" to "1"
154
    And I press "Save"
155
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
156
      | Name                                        | Policy status | Version    | Agreements   |
157
      | Policy1 Site policy, All users, Compulsory  | Active        | v2         | 0 of 4 (0%)  |
158
    And I should not see "v1"
159
    And "View previous versions" "link" should not exist
160
    And I log out
161
 
162
  Scenario: Activate draft policy
163
    Given the following policies exist:
164
      | Name       | Revision | Content    | Summary     | Status   |
165
      | Policy1    | v1       | full text2 | short text2 | draft    |
166
    And I log in as "manager"
167
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
168
    And I click on "Set status to \"Active\"" "link" in the "Policy1" "table_row"
169
    Then I should see "All users will be required to agree to this new policy version to be able to use the site."
170
    And I press "Continue"
171
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
172
      | Name                                        | Policy status | Version    | Agreements   |
173
      | Policy1 Site policy, All users, Compulsory  | Active        | v1         | 0 of 4 (0%)  |
174
    And "View previous versions" "link" should not exist
175
    And I log out
176
 
177
  Scenario: Edit archived policy and save as draft
178
    Given the following policies exist:
179
      | Name       | Revision | Content    | Summary     | Status   |
180
      | Policy1    | v1       | full text2 | short text2 | active   |
181
    And I log in as "manager"
182
    And I press "Next"
183
    And I set the field "I agree to the Policy1" to "1"
184
    And I press "Next"
185
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
186
    And I click on "Set status to \"Inactive\"" "link" in the "Policy1" "table_row"
187
    Then I should see "You are about to inactivate policy"
188
    And I press "Continue"
189
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
190
      | Name                                        | Policy status | Version    | Agreements   |
191
      | Policy1 Site policy, All users, Compulsory  | Inactive      | v1         | 1 of 4 (25%) |
192
    And I click on "Create a new draft" "link" in the "Policy1" "table_row"
193
    And I set the field "Version" to "v2"
194
    And I set the field "Name" to "Policy2"
195
    And the field "status" matches value "0"
196
    And "Draft" "field" should exist
197
    And "Active" "field" should exist
198
    And "Minor change" "field" should not exist
199
    And I should not see "Minor change"
200
    And "Save as draft" "button" should not exist
201
    And I press "Save"
202
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
203
      | Name                                        | Policy status | Version    | Agreements   |
204
      | Policy2 Site policy, All users, Compulsory  | Draft         | v2         | N/A          |
205
    And I should not see "v1"
206
    And I should not see "Policy1"
207
    And I click on "View previous versions" "link" in the "Policy2" "table_row"
208
    And I should see "Policy2 previous versions"
209
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
210
      | Name                                        | Policy status | Version    | Agreements   |
211
      | Policy1 Site policy, All users, Compulsory  | Inactive      | v1         | 1 of 4 (25%) |
212
    And I should not see "v2"
213
    And I log out
214
 
215
  Scenario: Edit archived policy and save as active
216
    Given the following policies exist:
217
      | Name       | Revision | Content    | Summary     | Status   |
218
      | Policy1    | v1       | full text2 | short text2 | active   |
219
    And I log in as "manager"
220
    And I press "Next"
221
    And I set the field "I agree to the Policy1" to "1"
222
    And I press "Next"
223
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
224
    And I click on "Set status to \"Inactive\"" "link" in the "Policy1" "table_row"
225
    And I press "Continue"
226
    And I click on "Create a new draft" "link" in the "Policy1" "table_row"
227
    And I set the field "Version" to "v2"
228
    And I set the field "Name" to "Policy2"
229
    And I set the field "Active" to "1"
230
    And I press "Save"
231
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
232
      | Name                                        | Policy status | Version    | Agreements   |
233
      | Policy2 Site policy, All users, Compulsory  | Active        | v2         | 0 of 4 (0%)  |
234
    And I should not see "v1"
235
    And I should not see "Policy1"
236
    And I click on "View previous versions" "link" in the "Policy2" "table_row"
237
    And I should see "Policy2 previous versions"
238
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
239
      | Name                                        | Policy status | Version    | Agreements   |
240
      | Policy1 Site policy, All users, Compulsory  | Inactive      | v1         | 1 of 4 (25%) |
241
    And I should not see "v2"
242
    And I log out
243
 
244
  Scenario: Current user can go back to previous page in List of active policies page
245
    Given the following policies exist:
246
      | Name       | Revision | Content    | Summary     | Status   |
247
      | Policy1    | v1       | full text2 | short text2 | active   |
248
    And I log in as "user1"
249
    And I press "Next"
250
    And I set the field "I agree to the Policy1" to "1"
251
    And I press "Next"
252
    And I follow "Preferences" in the user menu
253
    And I should see "Preferences"
254
    And I should see "Policies"
255
    # User should see a redirect back to previous page link.
256
    And I click on "Policies" "link"
257
    And I should see "List of active policies"
258
    And I should see "Go back to previous page"
259
    When I click on "Go back to previous page" "link"
260
    Then I should see "Preferences"