[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/forum/tests/behat/ -> separate_group_discussions.feature (source)

   1  @mod @mod_forum
   2  Feature: Posting to all groups in a separate group discussion is restricted to users with access to all groups
   3    In order to post to all groups in a forum with separate groups
   4    As a teacher
   5    I need to have the accessallgroups capability
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | teacher1 | Teacher | 1 | teacher1@example.com |
  11        | noneditor1 | Non-editing teacher | 1 | noneditor1@example.com |
  12        | noneditor2 | Non-editing teacher | 2 | noneditor2@example.com |
  13        | student1 | Student | 1 | student1@example.com |
  14        | student2 | Student | 2 | student2@example.com |
  15      And the following "courses" exist:
  16        | fullname | shortname | category |
  17        | Course 1 | C1 | 0 |
  18      And the following "course enrolments" exist:
  19        | user | course | role |
  20        | teacher1 | C1 | editingteacher |
  21        | noneditor1 | C1 | teacher |
  22        | noneditor2 | C1 | teacher |
  23        | student1 | C1 | student |
  24        | student2 | C1 | student |
  25      And the following "groups" exist:
  26        | name | course | idnumber |
  27        | Group A | C1 | G1 |
  28        | Group B | C1 | G2 |
  29        | Group C | C1 | G3 |
  30      And the following "group members" exist:
  31        | user | group |
  32        | teacher1 | G1 |
  33        | teacher1 | G2 |
  34        | noneditor1 | G1 |
  35        | noneditor1 | G2 |
  36        | noneditor1 | G3 |
  37        | noneditor2 | G1 |
  38        | noneditor2 | G2 |
  39        | student1 | G1 |
  40        | student2 | G1 |
  41        | student2 | G2 |
  42      And the following "activities" exist:
  43        | activity   | name                   | intro                         | course | idnumber     | groupmode |
  44        | forum      | Standard forum name    | Standard forum description    | C1     | sepgroups    | 1         |
  45  
  46    Scenario: Teacher with accessallgroups can view all groups
  47      Given I log in as "teacher1"
  48      And I follow "Course 1"
  49      When I follow "Standard forum name"
  50      Then the "Separate groups" select box should contain "All participants"
  51      Then the "Separate groups" select box should contain "Group A"
  52      Then the "Separate groups" select box should contain "Group B"
  53      Then the "Separate groups" select box should contain "Group C"
  54  
  55    Scenario: Teacher with accessallgroups can select any group when posting
  56      Given I log in as "teacher1"
  57      And I follow "Course 1"
  58      And I follow "Standard forum name"
  59      When I click on "Add a new discussion topic" "button"
  60      Then the "Group" select box should contain "All participants"
  61      And the "Group" select box should contain "Group A"
  62      And the "Group" select box should contain "Group B"
  63      And the "Group" select box should contain "Group C"
  64      And I should see "Post a copy to all groups"
  65  
  66    Scenario: Teacher with accessallgroups can post in groups they are a member of
  67      Given I log in as "teacher1"
  68      And I follow "Course 1"
  69      And I follow "Standard forum name"
  70      And I select "Group A" from the "Separate groups" singleselect
  71      When I click on "Add a new discussion topic" "button"
  72      Then I should see "Post a copy to all groups"
  73      And I set the following fields to these values:
  74        | Subject | Teacher 1 -> Group B  |
  75        | Message | Teacher 1 -> Group B  |
  76        # Change the group in the post form.
  77        | Group   | Group B               |
  78      And I press "Post to forum"
  79      And I wait to be redirected
  80      # We should be redirected to the group that we selected when posting.
  81      And the field "Separate groups" matches value "Group B"
  82      And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
  83      And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
  84      And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
  85      # It should also be displayed under All participants
  86      And I select "All participants" from the "Separate groups" singleselect
  87      And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
  88      And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
  89      And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
  90      # It should not be displayed in Groups A, or C.
  91      And I select "Group A" from the "Separate groups" singleselect
  92      And I should not see "Teacher 1 -> Group B"
  93      And I select "Group C" from the "Separate groups" singleselect
  94      And I should not see "Teacher 1 -> Group B"
  95  
  96    Scenario: Teacher with accessallgroups can post in groups they are not a member of
  97      Given I log in as "teacher1"
  98      And I follow "Course 1"
  99      And I follow "Standard forum name"
 100      And I select "Group A" from the "Separate groups" singleselect
 101      When I click on "Add a new discussion topic" "button"
 102      Then I should see "Post a copy to all groups"
 103      And I set the following fields to these values:
 104        | Subject | Teacher 1 -> Group C  |
 105        | Message | Teacher 1 -> Group C  |
 106        | Group   | Group C               |
 107      And I press "Post to forum"
 108      And I wait to be redirected
 109      # We should be redirected to the group that we selected when posting.
 110      And the field "Separate groups" matches value "Group C"
 111      # We redirect to the group posted in automatically.
 112      And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
 113      And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
 114      And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
 115      # It should also be displayed under All participants
 116      And I select "All participants" from the "Separate groups" singleselect
 117      And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
 118      And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
 119      And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
 120      # It should not be displayed in Groups A, or B.
 121      And I select "Group A" from the "Separate groups" singleselect
 122      And I should not see "Teacher 1 -> Group C"
 123      And I select "Group B" from the "Separate groups" singleselect
 124      And I should not see "Teacher 1 -> Group C"
 125  
 126    Scenario: Teacher with accessallgroups can post to all groups
 127      Given I log in as "teacher1"
 128      And I follow "Course 1"
 129      And I follow "Standard forum name"
 130      When I click on "Add a new discussion topic" "button"
 131      And I set the following fields to these values:
 132        | Subject                   | Teacher 1 -> Post to all  |
 133        | Message                   | Teacher 1 -> Post to all  |
 134        | Post a copy to all groups | 1                       |
 135      And I press "Post to forum"
 136      And I wait to be redirected
 137      # Posting to all groups means that we should be redirected to the page we started from.
 138      And the field "Separate groups" matches value "All participants"
 139      And I select "Group A" from the "Separate groups" singleselect
 140      Then I should see "Group A" in the "Teacher 1 -> Post to all" "table_row"
 141      And I should not see "Group B" in the "Teacher 1 -> Post to all" "table_row"
 142      And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 143      And I select "Group B" from the "Separate groups" singleselect
 144      And I should see "Group B" in the "Teacher 1 -> Post to all" "table_row"
 145      And I should not see "Group A" in the "Teacher 1 -> Post to all" "table_row"
 146      And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 147      And I select "Group C" from the "Separate groups" singleselect
 148      And I should see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 149      And I should not see "Group A" in the "Teacher 1 -> Post to all" "table_row"
 150      And I should not see "Group B" in the "Teacher 1 -> Post to all" "table_row"
 151      # No point testing the "All participants".
 152  
 153    Scenario: Students in one group can only post in their group
 154      Given I log in as "student1"
 155      And I follow "Course 1"
 156      When I follow "Standard forum name"
 157      Then I should see "Group A"
 158      And I click on "Add a new discussion topic" "button"
 159      And I should see "Group A"
 160      And I should not see "Group B"
 161      And I should not see "Group C"
 162      And I should not see "Post a copy to all groups"
 163      And I set the following fields to these values:
 164        | Subject | Student -> B |
 165        | Message | Student -> B |
 166      And I press "Post to forum"
 167      And I wait to be redirected
 168      And I should see "Group A" in the "Student -> B" "table_row"
 169      And I should not see "Group B" in the "Student -> B" "table_row"
 170  
 171    Scenario: Students in multiple group can post in all of their group individually
 172      Given I log in as "student2"
 173      And I follow "Course 1"
 174      When I follow "Standard forum name"
 175      And I select "Group A" from the "Separate groups" singleselect
 176      And I click on "Add a new discussion topic" "button"
 177      And the "Group" select box should not contain "All participants"
 178      And the "Group" select box should contain "Group A"
 179      And the "Group" select box should contain "Group B"
 180      And the "Group" select box should not contain "Group C"
 181      And I should not see "Post a copy to all groups"
 182      And I set the following fields to these values:
 183        | Subject | Student -> B  |
 184        | Message | Student -> B  |
 185        | Group   | Group B       |
 186      And I press "Post to forum"
 187      And I wait to be redirected
 188      # We should be redirected to the group that we selected when posting.
 189      And the field "Separate groups" matches value "Group B"
 190      And I should see "Group B" in the "Student -> B" "table_row"
 191      And I should not see "Group A" in the "Student -> B" "table_row"
 192      And I select "Group A" from the "Separate groups" singleselect
 193      And I should not see "Student -> B"
 194      # Now try posting in Group A (starting at Group B)
 195      And I select "Group B" from the "Separate groups" singleselect
 196      And I click on "Add a new discussion topic" "button"
 197      And the "Group" select box should not contain "All participants"
 198      And the "Group" select box should contain "Group A"
 199      And the "Group" select box should contain "Group B"
 200      And the "Group" select box should not contain "Group C"
 201      And I should not see "Post a copy to all groups"
 202      And I set the following fields to these values:
 203        | Subject | Student -> A  |
 204        | Message | Student -> A  |
 205        | Group   | Group A       |
 206      And I press "Post to forum"
 207      And I wait to be redirected
 208      # We should be redirected to the group that we selected when posting.
 209      And the field "Separate groups" matches value "Group A"
 210      And I should see "Group A" in the "Student -> A" "table_row"
 211      And I should not see "Group B" in the "Student -> A" "table_row"
 212      And I select "Group B" from the "Separate groups" singleselect
 213      And I should not see "Student -> A"
 214  
 215    Scenario: Teacher in all groups but without accessallgroups can only post in their groups
 216      And I log in as "admin"
 217      And I set the following system permissions of "Non-editing teacher" role:
 218        | moodle/site:accessallgroups | Prohibit |
 219      And I log out
 220      Given I log in as "noneditor1"
 221      And I follow "Course 1"
 222      And I follow "Standard forum name"
 223      When I click on "Add a new discussion topic" "button"
 224      Then the "Group" select box should not contain "All participants"
 225      And the "Group" select box should contain "Group A"
 226      And the "Group" select box should contain "Group B"
 227      And I should see "Post a copy to all groups"
 228  
 229    Scenario: Teacher in some groups and without accessallgroups can only post in their groups
 230      And I log in as "admin"
 231      And I set the following system permissions of "Non-editing teacher" role:
 232        | moodle/site:accessallgroups | Prohibit |
 233      And I log out
 234      Given I log in as "noneditor1"
 235      And I follow "Course 1"
 236      And I follow "Standard forum name"
 237      When I click on "Add a new discussion topic" "button"
 238      Then the "Group" select box should not contain "All participants"
 239      And the "Group" select box should contain "Group A"
 240      And the "Group" select box should contain "Group B"
 241      And I should see "Post a copy to all groups"
 242  
 243    Scenario: Students can view all participants discussions in separate groups mode
 244      Given I log in as "teacher1"
 245      And I follow "Course 1"
 246      When I add a new discussion to "Standard forum name" forum with:
 247        | Subject | Forum post to all participants |
 248        | Message | This is the body |
 249        | Group   | All participants |
 250      And I log out
 251      And I log in as "student1"
 252      And I follow "Course 1"
 253      And I follow "Standard forum name"
 254      Then I should see "Forum post to all participants"


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1