[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/forum/tests/behat/ -> discussion_subscriptions.feature (source)

   1  @mod @mod_forum
   2  Feature: A user can control their own subscription preferences for a discussion
   3    In order to receive notifications for things I am interested in
   4    As a user
   5    I need to choose my discussion subscriptions
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | student1 | Student   | One      | student.one@example.com |
  11      And the following "courses" exist:
  12        | fullname | shortname | category |
  13        | Course 1 | C1 | 0 |
  14      And the following "course enrolments" exist:
  15        | user | course | role |
  16        | student1 | C1 | student |
  17      And I log in as "admin"
  18      And I am on site homepage
  19      And I follow "Course 1"
  20      And I turn editing mode on
  21  
  22    Scenario: An optional forum can have discussions subscribed to
  23      Given I add a "Forum" to section "1" and I fill the form with:
  24        | Forum name        | Test forum name |
  25        | Forum type        | Standard forum for general use |
  26        | Description       | Test forum description |
  27        | Subscription mode | Optional subscription |
  28      And I add a new discussion to "Test forum name" forum with:
  29        | Subject | Test post subject one |
  30        | Message | Test post message one |
  31      And I add a new discussion to "Test forum name" forum with:
  32        | Subject | Test post subject two |
  33        | Message | Test post message two |
  34      And I log out
  35      When I log in as "student1"
  36      And I follow "Course 1"
  37      And I follow "Test forum name"
  38      Then I should see "Subscribe to this forum"
  39      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
  40      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
  41      And I click on "You are not subscribed to this discussion. Click to subscribe." "link" in the "Test post subject one" "table_row"
  42      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
  43      And I should see "Subscribe to this forum"
  44      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
  45      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
  46      And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
  47      And I should see "Student One will NOT be notified of new posts in 'Test post subject one' of 'Test forum name'"
  48      And I should see "Subscribe to this forum"
  49      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
  50      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
  51      And I click on "You are not subscribed to this discussion. Click to subscribe." "link" in the "Test post subject one" "table_row"
  52      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
  53      And I should see "Subscribe to this forum"
  54      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
  55      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
  56      And I follow "Subscribe to this forum"
  57      And I should see "Student One will be notified of new posts in 'Test forum name'"
  58      And I should see "Unsubscribe from this forum"
  59      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
  60      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
  61      And I follow "Unsubscribe from this forum"
  62      And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
  63      And I should see "Subscribe to this forum"
  64      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
  65      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
  66  
  67    Scenario: An automatic subscription forum can have discussions unsubscribed from
  68      Given I add a "Forum" to section "1" and I fill the form with:
  69        | Forum name        | Test forum name |
  70        | Forum type        | Standard forum for general use |
  71        | Description       | Test forum description |
  72        | Subscription mode | Auto subscription |
  73      And I add a new discussion to "Test forum name" forum with:
  74        | Subject | Test post subject one |
  75        | Message | Test post message one |
  76      And I add a new discussion to "Test forum name" forum with:
  77        | Subject | Test post subject two |
  78        | Message | Test post message two |
  79      And I log out
  80      When I log in as "student1"
  81      And I follow "Course 1"
  82      And I follow "Test forum name"
  83      Then I should see "Unsubscribe from this forum"
  84      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
  85      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
  86      And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
  87      And I should see "Student One will NOT be notified of new posts in 'Test post subject one' of 'Test forum name'"
  88      And I should see "Unsubscribe from this forum"
  89      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
  90      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
  91      And I click on "You are not subscribed to this discussion. Click to subscribe." "link" in the "Test post subject one" "table_row"
  92      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
  93      And I should see "Unsubscribe from this forum"
  94      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
  95      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
  96      And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
  97      And I should see "Student One will NOT be notified of new posts in 'Test post subject one' of 'Test forum name'"
  98      And I should see "Unsubscribe from this forum"
  99      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
 100      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
 101      And I follow "Unsubscribe from this forum"
 102      And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
 103      And I should see "Subscribe to this forum"
 104      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
 105      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 106      And I follow "Subscribe to this forum"
 107      And I should see "Student One will be notified of new posts in 'Test forum name'"
 108      And I should see "Unsubscribe from this forum"
 109      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 110      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
 111  
 112    Scenario: A user does not lose their preferences when a forum is switch from optional to automatic
 113      Given I add a "Forum" to section "1" and I fill the form with:
 114        | Forum name        | Test forum name |
 115        | Forum type        | Standard forum for general use |
 116        | Description       | Test forum description |
 117        | Subscription mode | Optional subscription |
 118      And I add a new discussion to "Test forum name" forum with:
 119        | Subject | Test post subject one |
 120        | Message | Test post message one |
 121      And I add a new discussion to "Test forum name" forum with:
 122        | Subject | Test post subject two |
 123        | Message | Test post message two |
 124      And I log out
 125      And I log in as "student1"
 126      And I follow "Course 1"
 127      And I follow "Test forum name"
 128      And I should see "Subscribe to this forum"
 129      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
 130      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 131      And I click on "You are not subscribed to this discussion. Click to subscribe." "link" in the "Test post subject one" "table_row"
 132      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
 133      And I should see "Subscribe to this forum"
 134      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 135      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 136      And I log out
 137      And I log in as "admin"
 138      And I am on site homepage
 139      And I follow "Course 1"
 140      And I follow "Test forum name"
 141      And I click on "Edit settings" "link" in the "Administration" "block"
 142      And I set the following fields to these values:
 143        | Subscription mode | Auto subscription |
 144      And I press "Save and return to course"
 145      And I log out
 146      And I log in as "student1"
 147      And I follow "Course 1"
 148      And I follow "Test forum name"
 149      And I should see "Unsubscribe from this forum"
 150      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 151      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
 152      When I follow "Unsubscribe from this forum"
 153      Then I should see "Student One will NOT be notified of new posts in 'Test forum name'"
 154      And I should see "Subscribe to this forum"
 155      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 156      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 157  
 158    Scenario: A user does not lose their preferences when a forum is switch from optional to automatic
 159      Given I add a "Forum" to section "1" and I fill the form with:
 160        | Forum name        | Test forum name |
 161        | Forum type        | Standard forum for general use |
 162        | Description       | Test forum description |
 163        | Subscription mode | Optional subscription |
 164      And I add a new discussion to "Test forum name" forum with:
 165        | Subject | Test post subject one |
 166        | Message | Test post message one |
 167      And I add a new discussion to "Test forum name" forum with:
 168        | Subject | Test post subject two |
 169        | Message | Test post message two |
 170      And I log out
 171      And I log in as "student1"
 172      And I follow "Course 1"
 173      And I follow "Test forum name"
 174      And I should see "Subscribe to this forum"
 175      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
 176      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 177      And I click on "You are not subscribed to this discussion. Click to subscribe." "link" in the "Test post subject one" "table_row"
 178      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
 179      And I should see "Subscribe to this forum"
 180      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 181      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 182      And I log out
 183      And I log in as "admin"
 184      And I am on site homepage
 185      And I follow "Course 1"
 186      And I follow "Test forum name"
 187      And I click on "Edit settings" "link" in the "Administration" "block"
 188      And I set the following fields to these values:
 189        | Subscription mode | Auto subscription |
 190      And I press "Save and return to course"
 191      And I log out
 192      And I log in as "student1"
 193      And I follow "Course 1"
 194      And I follow "Test forum name"
 195      And I should see "Unsubscribe from this forum"
 196      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 197      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
 198      When I follow "Unsubscribe from this forum"
 199      And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
 200      Then I should see "Subscribe to this forum"
 201      And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 202      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 203  
 204    Scenario: An optional forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
 205      Given I add a "Forum" to section "1" and I fill the form with:
 206        | Forum name        | Test forum name |
 207        | Forum type        | Standard forum for general use |
 208        | Description       | Test forum description |
 209        | Subscription mode | Optional subscription |
 210      And I add a new discussion to "Test forum name" forum with:
 211        | Subject | Test post subject one |
 212        | Message | Test post message one |
 213      And I add a new discussion to "Test forum name" forum with:
 214        | Subject | Test post subject two |
 215        | Message | Test post message two |
 216      And I log out
 217      When I log in as "student1"
 218      And I follow "Course 1"
 219      And I follow "Test forum name"
 220      And I should see "Subscribe to this forum"
 221      And I reply "Test post subject one" post from "Test forum name" forum with:
 222        | Subject | Reply 1 to discussion 1 |
 223        | Message | Discussion contents 1, second message |
 224        | Discussion subscription | 1 |
 225      And I reply "Test post subject two" post from "Test forum name" forum with:
 226        | Subject | Reply 1 to discussion 1 |
 227        | Message | Discussion contents 1, second message |
 228        | Discussion subscription | 0 |
 229      And I follow "Test forum name"
 230      Then "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 231      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 232      And I follow "Test post subject one"
 233      And I follow "Reply"
 234      And the field "Discussion subscription" matches value "Send me notifications of new posts in this discussion"
 235      And I follow "Test forum name"
 236      And I follow "Test post subject two"
 237      And I follow "Reply"
 238      And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion"
 239  
 240    Scenario: An automatic forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
 241      Given I add a "Forum" to section "1" and I fill the form with:
 242        | Forum name        | Test forum name |
 243        | Forum type        | Standard forum for general use |
 244        | Description       | Test forum description |
 245        | Subscription mode | Auto subscription |
 246      And I add a new discussion to "Test forum name" forum with:
 247        | Subject | Test post subject one |
 248        | Message | Test post message one |
 249      And I add a new discussion to "Test forum name" forum with:
 250        | Subject | Test post subject two |
 251        | Message | Test post message two |
 252      And I log out
 253      When I log in as "student1"
 254      And I follow "Course 1"
 255      And I follow "Test forum name"
 256      And I should see "Unsubscribe from this forum"
 257      And I reply "Test post subject one" post from "Test forum name" forum with:
 258        | Subject | Reply 1 to discussion 1 |
 259        | Message | Discussion contents 1, second message |
 260        | Discussion subscription | 1 |
 261      And I reply "Test post subject two" post from "Test forum name" forum with:
 262        | Subject | Reply 1 to discussion 1 |
 263        | Message | Discussion contents 1, second message |
 264        | Discussion subscription | 0 |
 265      And I follow "Test forum name"
 266      Then "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
 267      And "You are not subscribed to this discussion. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
 268      And I follow "Test post subject one"
 269      And I follow "Reply"
 270      And the field "Discussion subscription" matches value "Send me notifications of new posts in this discussion"
 271      And I follow "Test forum name"
 272      And I follow "Test post subject two"
 273      And I follow "Reply"
 274      And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion"
 275  
 276   Scenario: A guest should not be able to subscribe to a discussion
 277     Given I am on site homepage
 278     And I add a "Forum" to section "1" and I fill the form with:
 279       | Forum name        | Test forum name |
 280       | Forum type        | Standard forum for general use |
 281       | Description       | Test forum description |
 282     And I add a new discussion to "Test forum name" forum with:
 283       | Subject | Test post subject one |
 284       | Message | Test post message one |
 285     And I log out
 286     When I log in as "guest"
 287     And I follow "Test forum name"
 288     Then "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject one" "table_row"
 289     And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject one" "table_row"
 290     And I follow "Test post subject one"
 291     And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist
 292     And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist
 293  
 294   Scenario: A user who is not logged in should not be able to subscribe to a discussion
 295     Given I am on site homepage
 296     And I add a "Forum" to section "1" and I fill the form with:
 297       | Forum name        | Test forum name |
 298       | Forum type        | Standard forum for general use |
 299       | Description       | Test forum description |
 300     And I add a new discussion to "Test forum name" forum with:
 301       | Subject | Test post subject one |
 302       | Message | Test post message one |
 303     And I log out
 304     When I follow "Test forum name"
 305     Then "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject one" "table_row"
 306     And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject one" "table_row"
 307     And I follow "Test post subject one"
 308     And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist
 309     And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist
 310  
 311    Scenario: A user can toggle their subscription preferences when viewing a discussion
 312      Given I add a "Forum" to section "1" and I fill the form with:
 313        | Forum name        | Test forum name |
 314        | Forum type        | Standard forum for general use |
 315        | Description       | Test forum description |
 316        | Subscription mode | Optional subscription |
 317      And I add a new discussion to "Test forum name" forum with:
 318        | Subject | Test post subject one |
 319        | Message | Test post message one |
 320      And I log out
 321      And I log in as "student1"
 322      And I follow "Course 1"
 323      And I follow "Test forum name"
 324      When I follow "Test post subject one"
 325      Then I should see "Subscribe to this forum"
 326      And I should see "Subscribe to this discussion"
 327      And I follow "Subscribe to this forum"
 328      And I should see "Student One will be notified of new posts in 'Test forum name'"
 329      And I follow "Test post subject one"
 330      And I should see "Unsubscribe from this forum"
 331      And I should see "Unsubscribe from this discussion"
 332      And I follow "Unsubscribe from this discussion"
 333      And I should see "Student One will NOT be notified of new posts in 'Test post subject one' of 'Test forum name'"
 334      And I follow "Test post subject one"
 335      And I should see "Unsubscribe from this forum"
 336      And I should see "Subscribe to this discussion"
 337      And I follow "Unsubscribe from this forum"
 338      And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
 339      And I follow "Test post subject one"
 340      And I should see "Subscribe to this forum"
 341      And I should see "Subscribe to this discussion"
 342      And I follow "Subscribe to this discussion"
 343      And I should see "Student One will be notified of new posts in 'Test post subject one' of 'Test forum name'"
 344      And I should see "Subscribe to this forum"
 345      And I should see "Unsubscribe from this discussion"
 346      And I follow "Subscribe to this forum"
 347      And I should see "Student One will be notified of new posts in 'Test forum name'"
 348      And I follow "Test post subject one"
 349      And I should see "Unsubscribe from this forum"
 350      And I should see "Unsubscribe from this discussion"
 351      And I follow "Unsubscribe from this forum"
 352      And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
 353      And I follow "Test post subject one"
 354      And I should see "Subscribe to this forum"
 355      And I should see "Subscribe to this discussion"


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