[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/monitor/tests/behat/ -> subscription.feature (source)

   1  @javascript @tool @tool_monitor @tool_monitor_subscriptions
   2  Feature: tool_monitor_subscriptions
   3    In order to monitor events and receive notifications
   4    As an user
   5    I need to create a new rule, subscribe to it, receive notification and delete subscription
   6  
   7    Background:
   8      Given the following "courses" exist:
   9        | fullname | shortname |
  10        | Course 1 | C1        |
  11        | Course 2 | C2        |
  12      And the following "users" exist:
  13        | username | firstname | lastname | email |
  14        | teacher1 | Teacher | 1 | teacher1@example.com |
  15        | teacher2 | Teacher | 2 | teacher2@example.com |
  16      And the following "course enrolments" exist:
  17        | user | course | role |
  18        | teacher1 | C1 | editingteacher |
  19        | teacher1 | C2 | teacher |
  20        | teacher2 | C1 | teacher |
  21        | teacher2 | C2 | editingteacher |
  22      And I log in as "admin"
  23      And I navigate to "Event monitoring rules" node in "Site administration > Reports"
  24      And I click on "Enable" "link"
  25      And I am on site homepage
  26      And I follow "Course 1"
  27      And I navigate to "Event monitoring rules" node in "Course administration > Reports"
  28      And I press "Add a new rule"
  29      And I set the following fields to these values:
  30        | name                 | New rule course level                             |
  31        | plugin               | Core                                              |
  32        | eventname            | Course viewed                                     |
  33        | id_description       | I want a rule to monitor when a course is viewed. |
  34        | frequency            | 1                                                 |
  35        | minutes              | 1                                                 |
  36        | Notification message | The course was viewed. {modulelink}               |
  37      And I press "Save changes"
  38      And I navigate to "Event monitoring rules" node in "Site administration > Reports"
  39      And I press "Add a new rule"
  40      And I set the following fields to these values:
  41        | name                 | New rule site level                               |
  42        | plugin               | Core                                              |
  43        | eventname            | Course viewed                                     |
  44        | id_description       | I want a rule to monitor when a course is viewed. |
  45        | frequency            | 1                                                 |
  46        | minutes              | 1                                                 |
  47        | Notification message | The course was viewed. {modulelink}               |
  48      And I press "Save changes"
  49      And I navigate to "Define roles" node in "Site administration > Users > Permissions"
  50      And I follow "Non-editing teacher"
  51      And I press "Edit"
  52      And I click on "tool/monitor:managerules" "checkbox"
  53      And I press "Save changes"
  54      And I log out
  55  
  56    Scenario: Subscribe to a rule on course level
  57      Given I log in as "teacher1"
  58      And I follow "Preferences" in the user menu
  59      And I follow "Event monitoring"
  60      And I set the field "Select a course" to "Course 1"
  61      When I follow "Subscribe to rule \"New rule course level\""
  62      Then I should see "Subscription successfully created"
  63      And "#toolmonitorsubs_r0" "css_element" should exist
  64  
  65    Scenario: Delete a subscription on course level
  66      Given I log in as "teacher1"
  67      And I follow "Preferences" in the user menu
  68      And I follow "Event monitoring"
  69      And I set the field "Select a course" to "Course 1"
  70      And I follow "Subscribe to rule \"New rule course level\""
  71      And I should see "Subscription successfully created"
  72      When I click on "Delete subscription" "link" in the "New rule course level" "table_row"
  73      And I should see "Are you sure you want to delete the subscription to the rule \"New rule course level\"?"
  74      And I press "Continue"
  75      Then I should see "Subscription successfully removed"
  76      And "#toolmonitorsubs_r0" "css_element" should not exist
  77  
  78    Scenario: Subscribe to a rule on site level
  79      Given I log in as "admin"
  80      And I follow "Preferences" in the user menu
  81      And I follow "Event monitoring"
  82      And I set the field "Select a course" to "Acceptance test site"
  83      When I follow "Subscribe to rule \"New rule site level\""
  84      Then I should see "Subscription successfully created"
  85      And "#toolmonitorsubs_r0" "css_element" should exist
  86  
  87    Scenario: Delete a subscription on site level
  88      Given I log in as "admin"
  89      And I follow "Preferences" in the user menu
  90      And I follow "Event monitoring"
  91      And I set the field "Select a course" to "Acceptance test site"
  92      And I follow "Subscribe to rule \"New rule site level\""
  93      And I should see "Subscription successfully created"
  94      And "#toolmonitorsubs_r0" "css_element" should exist
  95      When I click on "Delete subscription" "link" in the "New rule site level" "table_row"
  96      And I should see "Are you sure you want to delete the subscription to the rule \"New rule site level\"?"
  97      And I press "Continue"
  98      Then I should see "Subscription successfully removed"
  99      And "#toolmonitorsubs_r0" "css_element" should not exist
 100  
 101    Scenario: Receiving notification on site level
 102      Given I log in as "admin"
 103      And I follow "Preferences" in the user menu
 104      And I follow "Messaging"
 105      And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
 106      And I press "Save changes"
 107      And I follow "Preferences" in the user menu
 108      And I follow "Event monitoring"
 109      And I set the field "Select a course" to "Acceptance test site"
 110      And I follow "Subscribe to rule \"New rule site level\""
 111      And I should see "Subscription successfully created"
 112      And "#toolmonitorsubs_r0" "css_element" should exist
 113      And I am on site homepage
 114      And I trigger cron
 115      And I am on site homepage
 116      When I follow "Messages" in the user menu
 117      And I follow "Do not reply to this email (1)"
 118      Then I should see "The course was viewed."
 119  
 120    Scenario: Receiving notification on course level
 121      Given I log in as "teacher1"
 122      And I follow "Preferences" in the user menu
 123      And I follow "Messaging"
 124      And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
 125      And I press "Save changes"
 126      And I follow "Preferences" in the user menu
 127      And I follow "Event monitoring"
 128      And I set the field "Select a course" to "Course 1"
 129      And I follow "Subscribe to rule \"New rule course level\""
 130      And I should see "Subscription successfully created"
 131      And "#toolmonitorsubs_r0" "css_element" should exist
 132      And I am on site homepage
 133      And I follow "Course 1"
 134      And I trigger cron
 135      And I am on site homepage
 136      When I follow "Messages" in the user menu
 137      And I follow "Do not reply to this email (1)"
 138      Then I should see "The course was viewed."
 139  
 140    Scenario: Navigating via quick link to rules
 141      Given I log in as "admin"
 142      And I follow "Preferences" in the user menu
 143      When I follow "Event monitoring"
 144      And I set the field "Select a course" to "Course 1"
 145      Then I should see "You can manage rules from the Event monitoring rules page."
 146      And I follow "Event monitoring rules"
 147      And I should see "You can subscribe to rules from the Event monitoring page."
 148      And I log out
 149      And I log in as "teacher1"
 150      And I follow "Preferences" in the user menu
 151      And I follow "Event monitoring"
 152      And I set the field "Select a course" to "Course 1"
 153      And I should see "You can manage rules from the Event monitoring rules page."
 154      And I follow "Event monitoring rules"
 155      And I should see "You can subscribe to rules from the Event monitoring page."
 156      And I click on "//a[text()='Event monitoring']" "xpath_element"
 157      And the field "courseid" matches value "Course 1"
 158      And I follow "Preferences" in the user menu
 159      And I follow "Event monitoring"
 160      And I should not see "You can manage rules from the Event monitoring rules page."
 161      And I log out
 162      And I log in as "teacher2"
 163      And I follow "Preferences" in the user menu
 164      And I follow "Event monitoring"
 165      And I set the field "Select a course" to "Course 1"
 166      And I should not see "You can manage rules the from the Event monitoring rules page."
 167  
 168    Scenario: No manage rules link when user does not have permission
 169      Given I log in as "admin"
 170      And I set the following system permissions of "Non-editing teacher" role:
 171        | tool/monitor:managerules | Prohibit |
 172      And I log out
 173      And I log in as "teacher1"
 174      And I follow "Preferences" in the user menu
 175      And I follow "Event monitoring"
 176      When I set the field "Select a course" to "Course 1"
 177      Then I should see "You can manage rules from the Event monitoring rules page."
 178      And I set the field "Select a course" to "Course 2"
 179      And I should not see "You can manage rules from the Event monitoring rules page."
 180      And I log out
 181      And I log in as "teacher2"
 182      And I follow "Preferences" in the user menu
 183      And I follow "Event monitoring"
 184      And I set the field "Select a course" to "Course 1"
 185      And I should not see "You can manage rules from the Event monitoring rules page."
 186      And I set the field "Select a course" to "Course 2"
 187      And I should see "You can manage rules from the Event monitoring rules page."


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1