source: moodle/trunk/fuentes/admin/tool/monitor/tests/behat/rule.feature @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 8.6 KB
Line 
1@javascript @tool @tool_monitor @tool_monitor_rules
2Feature: 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@asd.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 "Event monitoring rules" node in "Site administration > Reports"
19    And I click on "Enable" "link"
20    And I am on homepage
21    And I follow "Course 1"
22    And I navigate to "Event monitoring rules" node in "Course administration > Reports"
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 "Event monitoring rules" node in "Site administration > Reports"
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 homepage
49    And I follow "Course 1"
50    And I navigate to "Event monitoring rules" node in "Course administration > Reports"
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 follow "Course 1"
70    And I navigate to "Event monitoring rules" node in "Course administration > Reports"
71    When I click on "Delete rule" "link"
72    Then I should see "Are you sure you want to delete the rule \"New rule course level\"?"
73    And I press "Continue"
74    And I should see "Rule successfully deleted"
75    And I should not see "New rule course level"
76
77  Scenario: Edit a rule on course level
78    Given I log in as "teacher1"
79    And I follow "Course 1"
80    And I navigate to "Event monitoring rules" node in "Course administration > Reports"
81    When I click on "Edit rule" "link"
82    And I set the following fields to these values:
83      | name                 | New rule quiz                                  |
84      | plugin               | Quiz                                           |
85      | eventname            | Quiz attempt deleted                           |
86      | id_description       | I want a rule to monitor quiz attempts deleted |
87      | frequency            | 5                                              |
88      | minutes              | 5                                              |
89      | Notification message | Quiz attempt deleted. {modulelink}             |
90    And I press "Save changes"
91    Then I should see "New rule quiz"
92    And I should see "I want a rule to monitor quiz attempts deleted"
93    And I should see "Quiz attempt deleted"
94    And I should see "5 time(s) in 5 minute(s)"
95
96  Scenario: Duplicate a rule on course level
97    Given I log in as "teacher1"
98    And I follow "Course 1"
99    And I navigate to "Event monitoring rules" node in "Course administration > Reports"
100    When I click on "Duplicate rule" "link"
101    Then I should see "Rule successfully duplicated"
102    And "#toolmonitorrules_r1" "css_element" should appear before "#toolmonitorrules_r2" "css_element"
103    And I should see "New rule"
104    And I should see "I want a rule to monitor posts created on a forum"
105    And I should see "Forum"
106    And I should see "Post created"
107    And I should see "1 time(s) in 1 minute(s)"
108
109  Scenario: Add a rule on site level
110    Given I log in as "admin"
111    And I navigate to "Event monitoring rules" node in "Site administration > Reports"
112    When I press "Add a new rule"
113    And I set the following fields to these values:
114      | name                 | New rule                                          |
115      | plugin               | Forum                                             |
116      | eventname            | Post created                                      |
117      | id_description       | I want a rule to monitor posts created on a forum |
118      | frequency            | 1                                                 |
119      | minutes              | 1                                                 |
120      | Notification message | The forum post was created. {modulelink}          |
121    And I press "Save changes"
122    Then "New rule" row "Course" column of "toolmonitorrules_table" table should contain "Site"
123    And I should see "I want a rule to monitor posts created on a forum"
124    And I should see "Forum"
125    And I should see "Post created"
126    And I should see "1 time(s) in 1 minute(s)"
127
128  Scenario: Delete a rule on site level
129    Given I log in as "admin"
130    And I navigate to "Event monitoring rules" node in "Site administration > Reports"
131    When I click on "Delete rule" "link"
132    Then I should see "Are you sure you want to delete the rule \"New rule site level\"?"
133    And I press "Continue"
134    And I should see "Rule successfully deleted"
135    And I should not see "New rule site level"
136
137  Scenario: Edit a rule on site level
138    Given I log in as "admin"
139    And I navigate to "Event monitoring rules" node in "Site administration > Reports"
140    When I click on "Edit rule" "link"
141    And I set the following fields to these values:
142      | name                 | New Rule Quiz                                  |
143      | plugin               | Quiz                                           |
144      | eventname            | Quiz attempt deleted                           |
145      | id_description       | I want a rule to monitor quiz attempts deleted |
146      | frequency            | 5                                              |
147      | minutes              | 5                                              |
148      | Notification message | Quiz attempt deleted. {modulelink}             |
149    And I press "Save changes"
150    Then I should see "New Rule Quiz"
151    And I should see "I want a rule to monitor quiz attempts deleted"
152    And I should see "Quiz attempt deleted"
153    And I should see "5 time(s) in 5 minute(s)"
154
155  Scenario: Duplicate a rule on site level
156    Given I log in as "admin"
157    And I navigate to "Event monitoring rules" node in "Site administration > Reports"
158    When I click on "Duplicate rule" "link"
159    Then I should see "Rule successfully duplicated"
160    And "#toolmonitorrules_r2" "css_element" should appear after "#toolmonitorrules_r1" "css_element"
161    And I should see "I want a rule to monitor posts created on a forum"
162    And I should see "Forum"
163    And I should see "Post created"
164    And I should see "1 time(s) in 1 minute(s)"
Note: See TracBrowser for help on using the repository browser.