MDL-42625 behat: Editing .feature files
[moodle.git] / mod / forum / tests / behat / track_read_posts.feature
CommitLineData
550d842e 1@mod @mod_forum
9449cf8e
DM
2Feature: A teacher can set one of 3 possible options for tracking read forum posts
3 In order to ease the forum posts follow up
5d7b6307 4 As a user
9449cf8e
DM
5 I need to distinct the unread posts from the read ones
6
7 Background:
8 Given the following "users" exists:
9 | username | firstname | lastname | email | trackforums |
10 | student1 | Student | 1 | student1@asd.com | 1 |
20e6782f 11 | student2 | Student | 2 | student2@asd.com | 0 |
9449cf8e
DM
12 And the following "courses" exists:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exists:
16 | user | course | role |
17 | student1 | C1 | student |
20e6782f 18 | student2 | C1 | student |
9449cf8e
DM
19 And I log in as "admin"
20 And I follow "Course 1"
21 And I turn editing mode on
22
23 @javascript
20e6782f 24 Scenario: Tracking forum posts off
4d40089d 25 Given I add a "Forum" to section "1" and I fill the form with:
9449cf8e
DM
26 | Forum name | Test forum name |
27 | Forum type | Standard forum for general use |
28 | Description | Test forum description |
20e6782f
EM
29 | Read tracking | Off |
30 And I add a new discussion to "Test forum name" forum with:
31 | Subject | Test post subject |
32 | Message | Test post message |
20e6782f
EM
33 And I log out
34 When I log in as "student1"
35 And I follow "Course 1"
36 Then I should not see "1 unread post"
37 And I follow "Test forum name"
38 And I should not see "Track unread posts"
39
40 @javascript
41 Scenario: Tracking forum posts optional with user tracking on
42 Given I add a "Forum" to section "1" and I fill the form with:
43 | Forum name | Test forum name |
44 | Forum type | Standard forum for general use |
45 | Description | Test forum description |
46 | Read tracking | Optional |
9449cf8e
DM
47 And I add a new discussion to "Test forum name" forum with:
48 | Subject | Test post subject |
49 | Message | Test post message |
9449cf8e
DM
50 And I log out
51 When I log in as "student1"
52 And I follow "Course 1"
53 Then I should see "1 unread post"
20e6782f
EM
54 And I follow "Test forum name"
55 And I follow "Don't track unread posts"
333db2e9 56 And I wait to be redirected
20e6782f
EM
57 And I follow "Course 1"
58 And I should not see "1 unread post"
59 And I follow "Test forum name"
60 And I follow "Track unread posts"
333db2e9 61 And I wait to be redirected
20e6782f 62 And I follow "1"
9449cf8e
DM
63 And I follow "Course 1"
64 And I should not see "1 unread post"
65
66 @javascript
20e6782f 67 Scenario: Tracking forum posts optional with user tracking off
4d40089d 68 Given I add a "Forum" to section "1" and I fill the form with:
9449cf8e
DM
69 | Forum name | Test forum name |
70 | Forum type | Standard forum for general use |
71 | Description | Test forum description |
20e6782f 72 | Read tracking | Optional |
9449cf8e
DM
73 And I add a new discussion to "Test forum name" forum with:
74 | Subject | Test post subject |
75 | Message | Test post message |
9449cf8e 76 And I log out
20e6782f 77 When I log in as "student2"
9449cf8e
DM
78 And I follow "Course 1"
79 Then I should not see "1 unread post"
80 And I follow "Test forum name"
81 And I should not see "Track unread posts"
82
83 @javascript
20e6782f 84 Scenario: Tracking forum posts forced with user tracking on
333db2e9 85 Given I set the following administration settings values:
20e6782f
EM
86 | Allow forced read tracking | 1 |
87 And I follow "Home"
88 And I follow "Course 1"
4d40089d 89 Given I add a "Forum" to section "1" and I fill the form with:
9449cf8e
DM
90 | Forum name | Test forum name |
91 | Forum type | Standard forum for general use |
92 | Description | Test forum description |
20e6782f
EM
93 | Read tracking | Force |
94 And I add a new discussion to "Test forum name" forum with:
95 | Subject | Test post subject |
96 | Message | Test post message |
20e6782f
EM
97 And I log out
98 When I log in as "student1"
99 And I follow "Course 1"
100 Then I should see "1 unread post"
101 And I follow "1 unread post"
102 And I should not see "Don't track unread posts"
103 And I follow "Test post subject"
104 And I follow "Course 1"
105 And I should not see "1 unread post"
106
107 @javascript
108 Scenario: Tracking forum posts forced with user tracking off
333db2e9 109 Given I set the following administration settings values:
20e6782f
EM
110 | Allow forced read tracking | 1 |
111 And I follow "Home"
112 And I follow "Course 1"
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 | Read tracking | Force |
118 And I add a new discussion to "Test forum name" forum with:
119 | Subject | Test post subject |
120 | Message | Test post message |
20e6782f
EM
121 And I log out
122 When I log in as "student2"
123 And I follow "Course 1"
124 Then I should see "1 unread post"
125 And I follow "1 unread post"
126 And I should not see "Don't track unread posts"
127 And I follow "Test post subject"
128 And I follow "Course 1"
129 And I should not see "1 unread post"
130
131 @javascript
132 Scenario: Tracking forum posts forced (with force disabled) with user tracking on
333db2e9 133 Given I set the following administration settings values:
20e6782f
EM
134 | Allow forced read tracking | 1 |
135 And I follow "Home"
136 And I follow "Course 1"
137 Given I add a "Forum" to section "1" and I fill the form with:
138 | Forum name | Test forum name |
139 | Forum type | Standard forum for general use |
140 | Description | Test forum description |
141 | Read tracking | Force |
9449cf8e
DM
142 And I add a new discussion to "Test forum name" forum with:
143 | Subject | Test post subject |
144 | Message | Test post message |
20e6782f
EM
145 And I set the following administration settings values:
146 | Allow forced read tracking | 0 |
9449cf8e
DM
147 And I log out
148 When I log in as "student1"
149 And I follow "Course 1"
150 Then I should see "1 unread post"
151 And I follow "Test forum name"
152 And I follow "Don't track unread posts"
333db2e9 153 And I wait to be redirected
9449cf8e
DM
154 And I follow "Course 1"
155 And I should not see "1 unread post"
156 And I follow "Test forum name"
157 And I follow "Track unread posts"
333db2e9 158 And I wait to be redirected
9449cf8e
DM
159 And I follow "1"
160 And I follow "Course 1"
161 And I should not see "1 unread post"
20e6782f
EM
162
163 @javascript
164 Scenario: Tracking forum posts forced (with force disabled) with user tracking off
333db2e9 165 Given I set the following administration settings values:
20e6782f
EM
166 | Allow forced read tracking | 1 |
167 And I follow "Home"
168 And I follow "Course 1"
169 Given I add a "Forum" to section "1" and I fill the form with:
170 | Forum name | Test forum name |
171 | Forum type | Standard forum for general use |
172 | Description | Test forum description |
173 | Read tracking | Force |
174 And I add a new discussion to "Test forum name" forum with:
175 | Subject | Test post subject |
176 | Message | Test post message |
20e6782f
EM
177 And I set the following administration settings values:
178 | Allow forced read tracking | 0 |
179 And I log out
180 When I log in as "student2"
181 And I follow "Course 1"
182 Then I should not see "1 unread post"
183 And I follow "Test forum name"
184 And I should not see "Track unread posts"