forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-50714 mod_forum: Add tests for all groupmodes
- Loading branch information
1 parent
344e126
commit bff7570
Showing
5 changed files
with
529 additions
and
12 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
mod/forum/tests/behat/groups_in_course_no_groups_in_forum.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@mod @mod_forum | ||
Feature: Forums in 'No groups' mode allow posting to All participants for all users | ||
In order to post to a forum in 'No groups' mode, which is in course which has groups | ||
As any user | ||
I need to post | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
| student1 | Student | 1 | student1@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 | | ||
| student1 | C1 | student | | ||
And the following "groups" exist: | ||
| name | course | idnumber | | ||
| Group A | C1 | G1 | | ||
| Group B | C1 | G2 | | ||
And the following "group members" exist: | ||
| user | group | | ||
| teacher1 | G1 | | ||
| teacher1 | G2 | | ||
| student1 | G1 | | ||
And the following "activities" exist: | ||
| activity | name | intro | course | idnumber | groupmode | | ||
| forum | Standard forum name | Standard forum description | C1 | nogroups | 0 | | ||
|
||
Scenario: Teacher can post | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Standard forum name" | ||
And I should not see "Group A" | ||
And I should not see "Group B" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I should not see "Group" in the "form" "css_element" | ||
And I set the following fields to these values: | ||
| Subject | Teacher 1 -> Forum | | ||
| Message | Teacher 1 -> Forum | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Teacher 1 -> Forum" | ||
|
||
Scenario: Student can post | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "Standard forum name" | ||
And I should not see "Group A" | ||
And I should not see "Group B" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I should not see "Group" in the "form" "css_element" | ||
And I set the following fields to these values: | ||
| Subject | Student 1 -> Forum | | ||
| Message | Student 1 -> Forum | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Student 1 -> Forum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
@mod @mod_forum | ||
Feature: Posting to forums in a course with no groups behaves correctly | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
| student1 | Student | 1 | student1@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 | | ||
| student1 | C1 | student | | ||
And the following "activities" exist: | ||
| activity | name | intro | course | idnumber | groupmode | | ||
| forum | Standard forum | Standard forum description | C1 | nogroups | 0 | | ||
| forum | Visible forum | Visible forum description | C1 | visgroups | 2 | | ||
| forum | Separate forum | Separate forum description | C1 | sepgroups | 1 | | ||
|
||
Scenario: Teachers can post in standard forum | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Standard forum" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I set the following fields to these values: | ||
| Subject | Teacher -> All participants | | ||
| Message | Teacher -> All participants | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Teacher -> All participants" | ||
|
||
Scenario: Teachers can post in forum with separate groups | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Separate forum" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I set the following fields to these values: | ||
| Subject | Teacher -> All participants | | ||
| Message | Teacher -> All participants | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Teacher -> All participants" | ||
|
||
Scenario: Teachers can post in forum with visible groups | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Visible forum" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I set the following fields to these values: | ||
| Subject | Teacher -> All participants | | ||
| Message | Teacher -> All participants | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Teacher -> All participants" | ||
|
||
Scenario: Students can post in standard forum | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "Standard forum" | ||
When I click on "Add a new discussion topic" "button" | ||
Then I should not see "Post a copy to all groups" | ||
And I set the following fields to these values: | ||
| Subject | Student -> All participants | | ||
| Message | Student -> All participants | | ||
And I press "Post to forum" | ||
And I wait to be redirected | ||
And I should see "Student -> All participants" | ||
|
||
Scenario: Students cannot post in forum with separate groups | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
When I follow "Separate forum" | ||
Then I should see "You do not have permission to add a new discussion topic for all participants." | ||
And I should not see "Add a new discussion topic" | ||
|
||
Scenario: Teachers can post in forum with visible groups | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
When I follow "Visible forum" | ||
Then I should see "You do not have permission to add a new discussion topic for all participants." | ||
And I should not see "Add a new discussion topic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.