MDL-30811 forum: Update use of redirect to include message and type
[moodle.git] / mod / forum / tests / behat / forum_subscriptions.feature
CommitLineData
dc046480
AN
1@mod @mod_forum
2Feature: A user can control their own subscription preferences for a forum
3 In order to receive notifications for things I am interested in
4 As a user
5 I need to choose my forum 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"
221210e9 18 And I am on site homepage
dc046480
AN
19 And I follow "Course 1"
20 And I turn editing mode on
21
22 Scenario: A disallowed subscription forum cannot be 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 | Subscription disabled |
28 And I add a new discussion to "Test forum name" forum with:
29 | Subject | Test post subject |
30 | Message | Test post message |
31 And I log out
32 When I log in as "student1"
33 And I follow "Course 1"
34 And I follow "Test forum name"
35 Then I should not see "Subscribe to this forum"
36 And I should not see "Unsubscribe from this forum"
ebfb73db 37 And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject" "table_row"
8271c89a 38 And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row"
dc046480
AN
39
40 Scenario: A forced subscription forum cannot be subscribed to
41 Given I add a "Forum" to section "1" and I fill the form with:
42 | Forum name | Test forum name |
43 | Forum type | Standard forum for general use |
44 | Description | Test forum description |
45 | Subscription mode | Forced subscription |
46 And I add a new discussion to "Test forum name" forum with:
47 | Subject | Test post subject |
48 | Message | Test post message |
49 And I log out
50 When I log in as "student1"
51 And I follow "Course 1"
52 And I follow "Test forum name"
53 Then I should not see "Subscribe to this forum"
54 And I should not see "Unsubscribe from this forum"
ebfb73db 55 And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject" "table_row"
8271c89a 56 And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row"
dc046480
AN
57
58 Scenario: An optional forum can be subscribed to
59 Given I add a "Forum" to section "1" and I fill the form with:
60 | Forum name | Test forum name |
61 | Forum type | Standard forum for general use |
62 | Description | Test forum description |
63 | Subscription mode | Optional subscription |
64 And I add a new discussion to "Test forum name" forum with:
65 | Subject | Test post subject |
66 | Message | Test post message |
67 And I log out
68 When I log in as "student1"
69 And I follow "Course 1"
70 And I follow "Test forum name"
71 Then I should see "Subscribe to this forum"
72 And I should not see "Unsubscribe from this forum"
73 And I follow "Subscribe to this forum"
d954b54f 74 And I should see "Student One will be notified of new posts in 'Test forum name'"
dc046480
AN
75 And I should see "Unsubscribe from this forum"
76 And I should not see "Subscribe to this forum"
77
78 Scenario: An Automatic forum can be unsubscribed from
79 Given I add a "Forum" to section "1" and I fill the form with:
80 | Forum name | Test forum name |
81 | Forum type | Standard forum for general use |
82 | Description | Test forum description |
83 | Subscription mode | Auto subscription |
84 And I add a new discussion to "Test forum name" forum with:
85 | Subject | Test post subject |
86 | Message | Test post message |
87 And I log out
88 When I log in as "student1"
89 And I follow "Course 1"
90 And I follow "Test forum name"
91 Then I should see "Unsubscribe from this forum"
92 And I should not see "Subscribe to this forum"
93 And I follow "Unsubscribe from this forum"
d954b54f 94 And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
dc046480
AN
95 And I should see "Subscribe to this forum"
96 And I should not see "Unsubscribe from this forum"