1 |
efrain |
1 |
@javascript @tool @tool_monitor @tool_monitor_rules
|
|
|
2 |
Feature: tool_monitor_rule
|
|
|
3 |
In order to manage rules
|
|
|
4 |
As an admin
|
|
|
5 |
I need to create a rule, edit a rule, duplicate a rule and delete a rule
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Course 1 | C1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And I log in as "admin"
|
|
|
18 |
And I navigate to "Reports > Event monitoring rules" in site administration
|
|
|
19 |
And I click on "Enable" "link"
|
|
|
20 |
And I am on "Course 1" course homepage
|
|
|
21 |
And I navigate to "Reports" in current page administration
|
|
|
22 |
And I click on "Event monitoring rules" "link"
|
|
|
23 |
And I press "Add a new rule"
|
|
|
24 |
And I set the following fields to these values:
|
|
|
25 |
| name | New rule course level |
|
|
|
26 |
| plugin | Forum |
|
|
|
27 |
| eventname | Post created |
|
|
|
28 |
| id_description | I want a rule to monitor posts created on a forum |
|
|
|
29 |
| frequency | 1 |
|
|
|
30 |
| minutes | 1 |
|
|
|
31 |
| Notification message | The forum post was created. {modulelink} |
|
|
|
32 |
And I press "Save changes"
|
|
|
33 |
And I navigate to "Reports > Event monitoring rules" in site administration
|
|
|
34 |
And I press "Add a new rule"
|
|
|
35 |
And I set the following fields to these values:
|
|
|
36 |
| name | New rule site level |
|
|
|
37 |
| plugin | Forum |
|
|
|
38 |
| eventname | Post created |
|
|
|
39 |
| id_description | I want a rule to monitor posts created on a forum |
|
|
|
40 |
| frequency | 1 |
|
|
|
41 |
| minutes | 1 |
|
|
|
42 |
| Notification message | The forum post was created. {modulelink} |
|
|
|
43 |
And I press "Save changes"
|
|
|
44 |
And I log out
|
|
|
45 |
|
|
|
46 |
Scenario: Add a rule on course level
|
|
|
47 |
Given I log in as "teacher1"
|
|
|
48 |
And I am on "Course 1" course homepage
|
|
|
49 |
And I navigate to "Reports" in current page administration
|
|
|
50 |
And I click on "Event monitoring rules" "link"
|
|
|
51 |
When I press "Add a new rule"
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| name | New rule |
|
|
|
54 |
| plugin | Forum |
|
|
|
55 |
| eventname | Post created |
|
|
|
56 |
| id_description | I want a rule to monitor posts created on a forum |
|
|
|
57 |
| frequency | 1 |
|
|
|
58 |
| minutes | 1 |
|
|
|
59 |
| Notification message | The forum post was created. {modulelink} |
|
|
|
60 |
And I press "Save changes"
|
|
|
61 |
Then "New rule" row "Course" column of "toolmonitorrules_table" table should contain "Course 1"
|
|
|
62 |
And I should see "I want a rule to monitor posts created on a forum"
|
|
|
63 |
And I should see "Forum"
|
|
|
64 |
And I should see "Post created"
|
|
|
65 |
And I should see "1 time(s) in 1 minute(s)"
|
|
|
66 |
|
|
|
67 |
Scenario: Delete a rule on course level
|
|
|
68 |
Given I log in as "teacher1"
|
|
|
69 |
And I am on "Course 1" course homepage
|
|
|
70 |
And I navigate to "Reports" in current page administration
|
|
|
71 |
And I click on "Event monitoring rules" "link"
|
|
|
72 |
When I click on "Delete rule" "link"
|
|
|
73 |
Then I should see "Are you sure you want to delete the rule \"New rule course level\"?"
|
|
|
74 |
And I press "Continue"
|
|
|
75 |
And I should see "Rule successfully deleted"
|
|
|
76 |
And I should not see "New rule course level"
|
|
|
77 |
|
|
|
78 |
Scenario: Edit a rule on course level
|
|
|
79 |
Given I log in as "teacher1"
|
|
|
80 |
And I am on "Course 1" course homepage
|
|
|
81 |
And I navigate to "Reports" in current page administration
|
|
|
82 |
And I click on "Event monitoring rules" "link"
|
|
|
83 |
When I click on "Edit rule" "link"
|
|
|
84 |
And I set the following fields to these values:
|
|
|
85 |
| name | New rule quiz |
|
|
|
86 |
| plugin | Quiz |
|
|
|
87 |
| eventname | Quiz attempt deleted |
|
|
|
88 |
| id_description | I want a rule to monitor quiz attempts deleted |
|
|
|
89 |
| frequency | 5 |
|
|
|
90 |
| minutes | 5 |
|
|
|
91 |
| Notification message | Quiz attempt deleted. {modulelink} |
|
|
|
92 |
And I press "Save changes"
|
|
|
93 |
Then I should see "New rule quiz"
|
|
|
94 |
And I should see "I want a rule to monitor quiz attempts deleted"
|
|
|
95 |
And I should see "Quiz attempt deleted"
|
|
|
96 |
And I should see "5 time(s) in 5 minute(s)"
|
|
|
97 |
|
|
|
98 |
Scenario: Duplicate a rule on course level
|
|
|
99 |
Given I log in as "teacher1"
|
|
|
100 |
And I am on "Course 1" course homepage
|
|
|
101 |
And I navigate to "Reports" in current page administration
|
|
|
102 |
And I click on "Event monitoring rules" "link"
|
|
|
103 |
When I click on "Duplicate rule" "link" in the "New rule course level" "table_row"
|
|
|
104 |
Then I should see "Rule successfully duplicated"
|
|
|
105 |
And "#toolmonitorrules_r1" "css_element" should appear before "#toolmonitorrules_r2" "css_element"
|
|
|
106 |
And I should see "New rule"
|
|
|
107 |
And I should see "I want a rule to monitor posts created on a forum"
|
|
|
108 |
And I should see "Forum"
|
|
|
109 |
And I should see "Post created"
|
|
|
110 |
And I should see "1 time(s) in 1 minute(s)"
|
|
|
111 |
|
|
|
112 |
Scenario: Add a rule on site level
|
|
|
113 |
Given I log in as "admin"
|
|
|
114 |
And I navigate to "Reports > Event monitoring rules" in site administration
|
|
|
115 |
When I press "Add a new rule"
|
|
|
116 |
And I set the following fields to these values:
|
|
|
117 |
| name | New rule |
|
|
|
118 |
| plugin | Forum |
|
|
|
119 |
| eventname | Post created |
|
|
|
120 |
| id_description | I want a rule to monitor posts created on a forum |
|
|
|
121 |
| frequency | 1 |
|
|
|
122 |
| minutes | 1 |
|
|
|
123 |
| Notification message | The forum post was created. {modulelink} |
|
|
|
124 |
And I press "Save changes"
|
|
|
125 |
Then "New rule" row "Course" column of "toolmonitorrules_table" table should contain "Site"
|
|
|
126 |
And I should see "I want a rule to monitor posts created on a forum"
|
|
|
127 |
And I should see "Forum"
|
|
|
128 |
And I should see "Post created"
|
|
|
129 |
And I should see "1 time(s) in 1 minute(s)"
|
|
|
130 |
|
|
|
131 |
Scenario: Delete a rule on site level
|
|
|
132 |
Given I log in as "admin"
|
|
|
133 |
And I navigate to "Reports > Event monitoring rules" in site administration
|
|
|
134 |
When I click on "Delete rule" "link"
|
|
|
135 |
Then I should see "Are you sure you want to delete the rule \"New rule site level\"?"
|
|
|
136 |
And I press "Continue"
|
|
|
137 |
And I should see "Rule successfully deleted"
|
|
|
138 |
And I should not see "New rule site level"
|
|
|
139 |
|
|
|
140 |
Scenario: Edit a rule on site level
|
|
|
141 |
Given I log in as "admin"
|
|
|
142 |
And I navigate to "Reports > Event monitoring rules" in site administration
|
|
|
143 |
When I click on "Edit rule" "link"
|
|
|
144 |
And I set the following fields to these values:
|
|
|
145 |
| name | New Rule Quiz |
|
|
|
146 |
| plugin | Quiz |
|
|
|
147 |
| eventname | Quiz attempt deleted |
|
|
|
148 |
| id_description | I want a rule to monitor quiz attempts deleted |
|
|
|
149 |
| frequency | 5 |
|
|
|
150 |
| minutes | 5 |
|
|
|
151 |
| Notification message | Quiz attempt deleted. {modulelink} |
|
|
|
152 |
And I press "Save changes"
|
|
|
153 |
Then I should see "New Rule Quiz"
|
|
|
154 |
And I should see "I want a rule to monitor quiz attempts deleted"
|
|
|
155 |
And I should see "Quiz attempt deleted"
|
|
|
156 |
And I should see "5 time(s) in 5 minute(s)"
|
|
|
157 |
|
|
|
158 |
Scenario: Duplicate a rule on site level
|
|
|
159 |
Given I log in as "teacher1"
|
|
|
160 |
And I am on "Course 1" course homepage
|
|
|
161 |
And I navigate to "Reports" in current page administration
|
|
|
162 |
And I click on "Event monitoring rules" "link"
|
|
|
163 |
When I click on "Duplicate rule" "link" in the "New rule site level" "table_row"
|
|
|
164 |
Then I should see "Rule successfully duplicated"
|
|
|
165 |
And "#toolmonitorrules_r2" "css_element" should appear after "#toolmonitorrules_r1" "css_element"
|
|
|
166 |
And I should see "I want a rule to monitor posts created on a forum"
|
|
|
167 |
And I should see "Forum"
|
|
|
168 |
And I should see "Post created"
|
|
|
169 |
And I should see "1 time(s) in 1 minute(s)"
|