[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_forum
   2  Feature: Posting to all groups in a visible group discussion is restricted to users with access to all groups
   3    In order to post to all groups in a forum with visible 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        | student1 | Student | 1 | student1@example.com |
  12        | student2 | Student | 2 | student2@example.com |
  13      And the following "courses" exist:
  14        | fullname | shortname | category |
  15        | Course 1 | C1 | 0 |
  16      And the following "course enrolments" exist:
  17        | user | course | role |
  18        | teacher1 | C1 | editingteacher |
  19        | student1 | C1 | student |
  20        | student2 | C1 | student |
  21      And the following "groups" exist:
  22        | name | course | idnumber |
  23        | Group A | C1 | G1 |
  24        | Group B | C1 | G2 |
  25        | Group C | C1 | G3 |
  26      And the following "group members" exist:
  27        | user | group |
  28        | teacher1 | G1 |
  29        | teacher1 | G2 |
  30        | student1 | G1 |
  31        | student2 | G1 |
  32        | student2 | G2 |
  33      And the following "activities" exist:
  34        | activity   | name                   | intro                         | course | idnumber     | groupmode |
  35        | forum      | Standard forum name    | Standard forum description    | C1     | groups       | 2         |
  36  
  37    Scenario: Teacher with accessallgroups can view all groups
  38      Given I log in as "teacher1"
  39      And I follow "Course 1"
  40      When I follow "Standard forum name"
  41      Then the "Visible groups" select box should contain "All participants"
  42      Then the "Visible groups" select box should contain "Group A"
  43      Then the "Visible groups" select box should contain "Group B"
  44      Then the "Visible groups" select box should contain "Group C"
  45  
  46    Scenario: Teacher with accessallgroups can select any group when posting
  47      Given I log in as "teacher1"
  48      And I follow "Course 1"
  49      And I follow "Standard forum name"
  50      When I click on "Add a new discussion topic" "button"
  51      Then the "Group" select box should contain "All participants"
  52      And the "Group" select box should contain "Group A"
  53      And the "Group" select box should contain "Group B"
  54      And the "Group" select box should contain "Group C"
  55      And I should see "Post a copy to all groups"
  56  
  57    Scenario: Teacher with accessallgroups can post in groups they are a member of
  58      Given I log in as "teacher1"
  59      And I follow "Course 1"
  60      And I follow "Standard forum name"
  61      And I select "Group A" from the "Visible groups" singleselect
  62      When I click on "Add a new discussion topic" "button"
  63      Then I should see "Post a copy to all groups"
  64      And I set the following fields to these values:
  65        | Subject | Teacher 1 -> Group B  |
  66        | Message | Teacher 1 -> Group B  |
  67        # Change the group in the post form.
  68        | Group   | Group B               |
  69      And I press "Post to forum"
  70      And I wait to be redirected
  71      # We should be redirected to the group that we selected when posting.
  72      And the field "Visible groups" matches value "Group B"
  73      And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
  74      And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
  75      And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
  76      # It should also be displayed under All participants
  77      And I select "All participants" from the "Visible groups" singleselect
  78      And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
  79      And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
  80      And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
  81      # It should not be displayed in Groups A, or C.
  82      And I select "Group A" from the "Visible groups" singleselect
  83      And I should not see "Teacher 1 -> Group B"
  84      And I select "Group C" from the "Visible groups" singleselect
  85      And I should not see "Teacher 1 -> Group B"
  86  
  87    Scenario: Teacher with accessallgroups can post in groups they are not a member of
  88      Given I log in as "teacher1"
  89      And I follow "Course 1"
  90      And I follow "Standard forum name"
  91      And I select "Group A" from the "Visible groups" singleselect
  92      When I click on "Add a new discussion topic" "button"
  93      Then I should see "Post a copy to all groups"
  94      And I set the following fields to these values:
  95        | Subject | Teacher 1 -> Group C  |
  96        | Message | Teacher 1 -> Group C  |
  97        | Group   | Group C               |
  98      And I press "Post to forum"
  99      And I wait to be redirected
 100      # We should be redirected to the group that we selected when posting.
 101      And the field "Visible groups" matches value "Group C"
 102      # We redirect to the group posted in automatically.
 103      And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
 104      And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
 105      And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
 106      # It should also be displayed under All participants
 107      And I select "All participants" from the "Visible groups" singleselect
 108      And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
 109      And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
 110      And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
 111      # It should not be displayed in Groups A, or B.
 112      And I select "Group A" from the "Visible groups" singleselect
 113      And I should not see "Teacher 1 -> Group C"
 114      And I select "Group B" from the "Visible groups" singleselect
 115      And I should not see "Teacher 1 -> Group C"
 116  
 117    Scenario: Teacher with accessallgroups can post to all groups
 118      Given I log in as "teacher1"
 119      And I follow "Course 1"
 120      And I follow "Standard forum name"
 121      When I click on "Add a new discussion topic" "button"
 122      And I set the following fields to these values:
 123        | Subject                   | Teacher 1 -> Post to all  |
 124        | Message                   | Teacher 1 -> Post to all  |
 125        | Post a copy to all groups | 1                       |
 126      And I press "Post to forum"
 127      And I wait to be redirected
 128      # Posting to all groups means that we should be redirected to the page we started from.
 129      And the field "Visible groups" matches value "All participants"
 130      And I select "Group A" from the "Visible groups" singleselect
 131      Then I should see "Group A" in the "Teacher 1 -> Post to all" "table_row"
 132      And I should not see "Group B" in the "Teacher 1 -> Post to all" "table_row"
 133      And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 134      And I select "Group B" from the "Visible groups" singleselect
 135      And I should see "Group B" in the "Teacher 1 -> Post to all" "table_row"
 136      And I should not see "Group A" in the "Teacher 1 -> Post to all" "table_row"
 137      And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 138      And I select "Group C" from the "Visible groups" singleselect
 139      And I should see "Group C" in the "Teacher 1 -> Post to all" "table_row"
 140      And I should not 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      # No point testing the "All participants".
 143  
 144    Scenario: Students can view all groups
 145      Given I log in as "student1"
 146      And I follow "Course 1"
 147      When I follow "Standard forum name"
 148      Then the "Visible groups" select box should contain "All participants"
 149      Then the "Visible groups" select box should contain "Group A"
 150      Then the "Visible groups" select box should contain "Group B"
 151      Then the "Visible groups" select box should contain "Group C"
 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 "Visible 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 "Visible 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 "Visible 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 "Visible 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 "Visible 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 "Visible groups" singleselect
 213      And I should not see "Student -> A"


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