1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: An admin or teacher sets the post threshold for blocking and warning
|
|
|
3 |
A student should not be able to post more than blocking value
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| student1 | Student | 1 | student1@example.com |
|
|
|
9 |
| student2 | Student | 1 | student2@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | category |
|
|
|
12 |
| Course 1 | C1 | 0 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| student1 | C1 | student |
|
|
|
16 |
| student2 | C1 | student |
|
|
|
17 |
And the following "activities" exist:
|
|
|
18 |
| activity | name | course | blockperiod | blockafter | warnafter |
|
|
|
19 |
| forum | Test forum name | C1 | 172800 | 3 | 2 |
|
|
|
20 |
|
|
|
21 |
@javascript
|
|
|
22 |
Scenario: A student should not be able to post new discussion or reply to the existing discussion once the threshold block count is reached
|
|
|
23 |
Given I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
24 |
When I add a new discussion to "Test forum name" forum with:
|
|
|
25 |
| Subject | Test post subject one |
|
|
|
26 |
| Message | Test post message one |
|
|
|
27 |
And I add a new discussion to "Test forum name" forum with:
|
|
|
28 |
| Subject | Test post subject two |
|
|
|
29 |
| Message | Test post message two |
|
|
|
30 |
And I should see "Add discussion topic"
|
|
|
31 |
# Verify that when navigated to one of the topics and then click reply the warning notification is shown.
|
|
|
32 |
And I click on "Test post subject two" "link"
|
|
|
33 |
And I click on "Reply" "link"
|
|
|
34 |
And I should see "You are approaching the posting threshold. You have posted 2 times in the last 2 days and the limit is 3 posts."
|
|
|
35 |
And I click on "Test forum name" "link"
|
|
|
36 |
And I add a new discussion to "Test forum name" forum with:
|
|
|
37 |
| Subject | Test post subject three |
|
|
|
38 |
| Message | Test post message three |
|
|
|
39 |
Then I should not see "Add discussion topic"
|
|
|
40 |
# Verify that no reply link available in the posts.
|
|
|
41 |
And I click on "Test post subject three" "link"
|
|
|
42 |
And I should not see "Reply"
|
|
|
43 |
And I am on the "Test forum name" "forum activity" page
|
|
|
44 |
And I click on "Test post subject two" "link"
|
|
|
45 |
And I should not see "Reply"
|
|
|
46 |
# Verify that student2 is not affected by the posts made by student1
|
|
|
47 |
And I am on the "Test forum name" "forum activity" page logged in as student2
|
|
|
48 |
And I should see "Add discussion topic"
|
|
|
49 |
|
|
|
50 |
@javascript
|
|
|
51 |
Scenario: A student should see warning when the post is about to reach threshold when experimental nested discussion view is set
|
|
|
52 |
Given I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
53 |
When I add a new discussion to "Test forum name" forum with:
|
|
|
54 |
| Subject | Test post subject one |
|
|
|
55 |
| Message | Test post message one |
|
|
|
56 |
And I add a new discussion to "Test forum name" forum with:
|
|
|
57 |
| Subject | Test post subject two |
|
|
|
58 |
| Message | Test post message two |
|
|
|
59 |
And I should see "Add discussion topic"
|
|
|
60 |
#Now verify that when "Use experimental nested discussion view" is set, the user should see same warning in the Reply.
|
|
|
61 |
And I follow "Preferences" in the user menu
|
|
|
62 |
And I click on "Forum preferences" "link"
|
|
|
63 |
And I set the field "Use experimental nested discussion view" to "Yes"
|
|
|
64 |
And I press "Save changes"
|
|
|
65 |
And I am on the "Test forum name" "forum activity" page
|
|
|
66 |
And I click on "Test post subject two" "link"
|
|
|
67 |
When I press "Reply"
|
|
|
68 |
Then I should see "You are approaching the posting threshold. You have posted 2 times in the last 2 days and the limit is 3 posts."
|
|
|
69 |
|
|
|
70 |
@javascript
|
|
|
71 |
Scenario: A student with 'mod/forum:postwithoutthrottling' capability should be able to post unlimited number of times
|
|
|
72 |
Given the following "permission overrides" exist:
|
|
|
73 |
| capability | permission | role | contextlevel | reference |
|
|
|
74 |
| mod/forum:postwithoutthrottling | Allow | student | Course | C1 |
|
|
|
75 |
And I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
76 |
And I should see "This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 3 posting(s) in 2 days"
|
|
|
77 |
When I add a new discussion to "Test forum name" forum with:
|
|
|
78 |
| Subject | Test post subject one |
|
|
|
79 |
| Message | Test post message one |
|
|
|
80 |
And I add a new discussion to "Test forum name" forum with:
|
|
|
81 |
| Subject | Test post subject two |
|
|
|
82 |
| Message | Test post message two |
|
|
|
83 |
And I should see "Add discussion topic"
|
|
|
84 |
# Verify that when navigated to one of the topics and then click reply the warning notification is shown.
|
|
|
85 |
And I click on "Test post subject two" "link"
|
|
|
86 |
And I click on "Reply" "link"
|
|
|
87 |
# With 'mod/forum:postwithoutthrottling' assigned capability the message below should not be displayed.
|
|
|
88 |
And I should not see "You are approaching the posting threshold. You have posted 2 times in the last 2 days and the limit is 3 posts."
|
|
|
89 |
And I click on "Test forum name" "link"
|
|
|
90 |
And I add a new discussion to "Test forum name" forum with:
|
|
|
91 |
| Subject | Test post subject three |
|
|
|
92 |
| Message | Test post message three |
|
|
|
93 |
Then I should see "Add discussion topic"
|
|
|
94 |
# Verify that reply link is available in the posts.
|
|
|
95 |
And I click on "Test post subject three" "link"
|
|
|
96 |
And I should see "Reply"
|
|
|
97 |
And I am on the "Test forum name" "forum activity" page
|
|
|
98 |
And I click on "Test post subject two" "link"
|
|
|
99 |
And I should see "Reply"
|