Merge branch 'MDL-76652-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2023-01-24 18:45:24 +08:00
commit 0006557b59

View File

@ -5,32 +5,22 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 1 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| forum | Test forum name | Test forum name | C1 | forum | 0 |
| activity | name | course | blockperiod | blockafter | warnafter |
| forum | Test forum name | C1 | 172800 | 3 | 2 |
@javascript
Scenario: A student should not be able to post new discussion or reply to the existing discussion once the threshold block count is reached
Given I am on the "Test forum name" "forum activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the field "Time period for blocking" to "2 days"
And I set the field "Post threshold for blocking" to "3"
And I set the field "Post threshold for warning" to "2"
And I press "Save and display"
And I log out
And I am on the "Test forum name" "forum activity" page logged in as student1
Given I am on the "Test forum name" "forum activity" page logged in as student1
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
@ -60,15 +50,7 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
@javascript
Scenario: A student should see warning when the post is about to reach threshold when experimental nested discussion view is set
Given I am on the "Test forum name" "forum activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the field "Time period for blocking" to "2 days"
And I set the field "Post threshold for blocking" to "3"
And I set the field "Post threshold for warning" to "2"
And I press "Save and display"
And I log out
And I am on the "Test forum name" "forum activity" page logged in as student1
Given I am on the "Test forum name" "forum activity" page logged in as student1
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
@ -85,3 +67,34 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
And I click on "Test post subject two" "link"
When I press "Reply"
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."
@javascript
Scenario: A student with 'mod/forum:postwithoutthrottling' capability should be able to post unlimited number of times
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/forum:postwithoutthrottling | Allow | student | Course | C1 |
And I am on the "Test forum name" "forum activity" page logged in as student1
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"
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject two |
| Message | Test post message two |
And I should see "Add discussion topic"
# Verify that when navigated to one of the topics and then click reply the warning notification is shown.
And I click on "Test post subject two" "link"
And I click on "Reply" "link"
# With 'mod/forum:postwithoutthrottling' assigned capability the message below should not be displayed.
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."
And I click on "Test forum name" "link"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject three |
| Message | Test post message three |
Then I should see "Add discussion topic"
# Verify that reply link is available in the posts.
And I click on "Test post subject three" "link"
And I should see "Reply"
And I am on the "Test forum name" "forum activity" page
And I click on "Test post subject two" "link"
And I should see "Reply"