diff --git a/mod/forum/tests/behat/separate_group_discussions.feature b/mod/forum/tests/behat/separate_group_discussions.feature index c75cd8be9ba40..4762a1f9f4986 100644 --- a/mod/forum/tests/behat/separate_group_discussions.feature +++ b/mod/forum/tests/behat/separate_group_discussions.feature @@ -12,6 +12,8 @@ Feature: Posting to all groups in a separate group discussion is restricted to u | noneditor2 | Non-editing teacher | 2 | noneditor2@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | + | student3 | Student | 3 | student3@example.com | + | student4 | Student | 4 | student4@example.com | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | @@ -22,11 +24,14 @@ Feature: Posting to all groups in a separate group discussion is restricted to u | noneditor2 | C1 | teacher | | student1 | C1 | student | | student2 | C1 | student | + | student3 | C1 | student | + | student4 | C1 | student | And the following "groups" exist: - | name | course | idnumber | - | Group A | C1 | G1 | - | Group B | C1 | G2 | - | Group C | C1 | G3 | + | name | course | idnumber | participation | + | Group A | C1 | G1 | 1 | + | Group B | C1 | G2 | 1 | + | Group C | C1 | G3 | 1 | + | Group D | C1 | G4 | 0 | And the following "group members" exist: | user | group | | teacher1 | G1 | @@ -39,6 +44,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u | student1 | G1 | | student2 | G1 | | student2 | G2 | + | student3 | G4 | And the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | forum | Standard forum name | Standard forum description | C1 | sepgroups | 1 | @@ -57,6 +63,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And the "Separate groups" select box should contain "Group A" And the "Separate groups" select box should contain "Group B" And the "Separate groups" select box should contain "Group C" + And the "Separate groups" select box should not contain "Group D" And I select "All participants" from the "Separate groups" singleselect And I should see "Initial Disc ALL" And I should see "Initial Disc G1" @@ -73,7 +80,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u But I should not see "Initial Disc G1" And I should not see "Initial Disc G3" - Scenario: Teacher with accessallgroups can select any group when posting + Scenario: Teacher with accessallgroups can select any participation group when posting Given I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Standard forum name" @@ -83,6 +90,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And the "Group" select box should contain "Group A" And the "Group" select box should contain "Group B" And the "Group" select box should contain "Group C" + And the "Group" select box should not contain "Group D" And I should see "Post a copy to all groups" Scenario: Teacher with accessallgroups can post in groups they are a member of @@ -193,6 +201,24 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should see "Group A" in the "Student -> B" "table_row" And I should not see "Group B" in the "Student -> B" "table_row" + Scenario: Students in no group can see all group discussions, but not post. + Given I log in as "student4" + And I am on "Course 1" course homepage + When I follow "Standard forum name" + Then I should see "All participants" + And I should see "Initial Disc ALL" + And I should see "You are not able to create a discussion" + And I should not see "Add discussion topic" + + Scenario: Students in non-participation groups can see all group discussions, but not post. + Given I log in as "student3" + And I am on "Course 1" course homepage + When I follow "Standard forum name" + Then I should see "All participants" + And I should see "Initial Disc ALL" + And I should see "You are not able to create a discussion" + And I should not see "Add discussion topic" + Scenario: Students in multiple group can post in all of their group individually Given I log in as "student2" And I am on "Course 1" course homepage diff --git a/mod/forum/tests/behat/visible_group_discussions.feature b/mod/forum/tests/behat/visible_group_discussions.feature index b4b283d31cab0..4c33d7c74cfee 100644 --- a/mod/forum/tests/behat/visible_group_discussions.feature +++ b/mod/forum/tests/behat/visible_group_discussions.feature @@ -10,6 +10,8 @@ Feature: Posting to all groups in a visible group discussion is restricted to us | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | + | student3 | Student | 3 | student3@example.com | + | student4 | Student | 4 | student4@example.com | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | @@ -18,11 +20,14 @@ Feature: Posting to all groups in a visible group discussion is restricted to us | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | + | student3 | C1 | student | + | student4 | C1 | student | And the following "groups" exist: - | name | course | idnumber | - | Group A | C1 | G1 | - | Group B | C1 | G2 | - | Group C | C1 | G3 | + | name | course | idnumber | participation | + | Group A | C1 | G1 | 1 | + | Group B | C1 | G2 | 1 | + | Group C | C1 | G3 | 1 | + | Group D | C1 | G4 | 0 | And the following "group members" exist: | user | group | | teacher1 | G1 | @@ -30,6 +35,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us | student1 | G1 | | student2 | G1 | | student2 | G2 | + | student3 | G4 | And the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | forum | Standard forum name | Standard forum description | C1 | groups | 2 | @@ -48,6 +54,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group B" And the "Visible groups" select box should contain "Group C" + And the "Visible groups" select box should not contain "Group D" And I select "All participants" from the "Visible groups" singleselect And I should see "Initial Disc ALL" And I should see "Initial Disc G1" @@ -74,6 +81,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And the "Group" select box should contain "Group A" And the "Group" select box should contain "Group B" And the "Group" select box should contain "Group C" + And the "Group" select box should not contain "Group D" And I should see "Post a copy to all groups" Scenario: Teacher with accessallgroups can post in groups they are a member of @@ -174,6 +182,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group B" And the "Visible groups" select box should contain "Group C" + And the "Visible groups" select box should not contain "Group D" And I select "All participants" from the "Visible groups" singleselect And I should see "Initial Disc ALL" And I should see "Initial Disc G1" @@ -200,6 +209,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should see "Group A" And I should not see "Group B" And I should not see "Group C" + And I should not see "Group D" And I should not see "Post a copy to all groups" And I set the following fields to these values: | Subject | Student -> B | @@ -220,6 +230,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And the "Group" select box should contain "Group A" And the "Group" select box should contain "Group B" And the "Group" select box should not contain "Group C" + And the "Group" select box should not contain "Group D" And I should not see "Post a copy to all groups" And I set the following fields to these values: | Subject | Student -> B | @@ -254,3 +265,27 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Group B" in the "Student -> A" "table_row" And I select "Group B" from the "Visible groups" singleselect And I should not see "Student -> A" + + Scenario: Students in no group can see all discussions, but not post. + Given I log in as "student4" + And I am on "Course 1" course homepage + When I follow "Standard forum name" + And I select "All participants" from the "Visible groups" singleselect + Then I should see "Initial Disc ALL" + And I should see "Initial Disc G1" + And I should see "Initial Disc G2" + And I should see "Initial Disc G2" + And I should see "You are not able to create a discussion" + And I should not see "Add discussion topic" + + Scenario: Students in non-participation groups can see all discussions, but not post. + Given I log in as "student3" + And I am on "Course 1" course homepage + When I follow "Standard forum name" + And I select "All participants" from the "Visible groups" singleselect + Then I should see "Initial Disc ALL" + And I should see "Initial Disc G1" + And I should see "Initial Disc G2" + And I should see "Initial Disc G2" + And I should see "You are not able to create a discussion" + And I should not see "Add discussion topic"