| 1 | efrain | 1 | @mod @mod_wiki
 | 
        
           |  |  | 2 | Feature: Groups can have separate content on a wiki
 | 
        
           |  |  | 3 |   In order to create a wiki with my group
 | 
        
           |  |  | 4 |   As a user
 | 
        
           |  |  | 5 |   I need to view and add wiki pages by group
 | 
        
           |  |  | 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 |       | student3 | Student   | 3        | student1@example.com |
 | 
        
           |  |  | 14 |       | student4 | Student   | 4        | 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 |       | student1 | C1     | student        |
 | 
        
           |  |  | 22 |       | student2 | C1     | student        |
 | 
        
           |  |  | 23 |       | student3 | C1     | student        |
 | 
        
           |  |  | 24 |       | student4 | C1     | student        |
 | 
        
           |  |  | 25 |     Given the following "groups" exist:
 | 
        
           |  |  | 26 |       | name    | course | idnumber | participation |
 | 
        
           |  |  | 27 |       | Group 1 | C1     | G1       | 1             |
 | 
        
           |  |  | 28 |       | Group 2 | C1     | G2       | 1             |
 | 
        
           |  |  | 29 |       | Group 3 | C1     | G3       | 0             |
 | 
        
           |  |  | 30 |     And the following "group members" exist:
 | 
        
           |  |  | 31 |       | user     | group |
 | 
        
           |  |  | 32 |       | student1 | G1    |
 | 
        
           |  |  | 33 |       | student2 | G2    |
 | 
        
           |  |  | 34 |       | student3 | G3    |
 | 
        
           |  |  | 35 |     And the following "activities" exist:
 | 
        
           |  |  | 36 |       | activity | course | name          | idnumber | wikimode      | firstpagetitle  | groupmode |
 | 
        
           |  |  | 37 |       | wiki     | C1     | Separate wiki | wiki1    | collaborative | Separate page 1 | 1         |
 | 
        
           |  |  | 38 |       | wiki     | C1     | Visible wiki  | wiki2    | collaborative | Visible page 1  | 2         |
 | 
        
           |  |  | 39 |     And the following wiki pages exist:
 | 
        
           |  |  | 40 |       | wiki  | title           | content      | group |
 | 
        
           |  |  | 41 |       | wiki1 | Separate page 1 | Group 1 page | G1    |
 | 
        
           |  |  | 42 |       | wiki1 | Separate page 1 | Group 2 page | G2    |
 | 
        
           |  |  | 43 |       | wiki2 | Visible page 1  | Group 1 page | G1    |
 | 
        
           |  |  | 44 |       | wiki2 | Visible page 1  | Group 2 page | G2    |
 | 
        
           |  |  | 45 |     And the following wiki pages exist:
 | 
        
           |  |  | 46 |       | wiki  | title           | content       |
 | 
        
           |  |  | 47 |       | wiki1 | Separate page 1 | No group page |
 | 
        
           |  |  | 48 |       | wiki2 | Visible page 1  | No group page |
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 |   Scenario Outline: Teacher can see all participation group wikis
 | 
        
           |  |  | 51 |     Given I am on the "<wiki>" "wiki activity" page logged in as teacher1
 | 
        
           |  |  | 52 |     And I should see "All participants" in the "<mode> groups" "select"
 | 
        
           |  |  | 53 |     And I should see "Group 1" in the "<mode> groups" "select"
 | 
        
           |  |  | 54 |     And I should see "Group 2" in the "<mode> groups" "select"
 | 
        
           |  |  | 55 |     And I should not see "Group 3" in the "<mode> groups" "select"
 | 
        
           |  |  | 56 |     And I should see "No group page"
 | 
        
           |  |  | 57 |     And I should not see "Group 1 page"
 | 
        
           |  |  | 58 |     And I should not see "Group 2 page"
 | 
        
           |  |  | 59 |     When I select "Group 1" from the "<mode> groups" singleselect
 | 
        
           |  |  | 60 |     Then I should not see "No group page"
 | 
        
           |  |  | 61 |     And I should see "Group 1 page"
 | 
        
           |  |  | 62 |     And I should not see "Group 2 page"
 | 
        
           |  |  | 63 |   | 
        
           |  |  | 64 |     Examples:
 | 
        
           |  |  | 65 |       | wiki  | mode     |
 | 
        
           |  |  | 66 |       | wiki1 | Separate |
 | 
        
           |  |  | 67 |       | wiki2 | Visible  |
 | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 |   Scenario Outline: Teacher can add a page to any participation group's wiki
 | 
        
           |  |  | 70 |     Given I am on the "<wiki>" "wiki activity" page logged in as teacher1
 | 
        
           |  |  | 71 |     And I select "Edit" from the "jump" singleselect
 | 
        
           |  |  | 72 |     And I set the field "HTML format" to "[[Internal link]]"
 | 
        
           |  |  | 73 |     And I press "Save"
 | 
        
           |  |  | 74 |     When I follow "Internal link"
 | 
        
           |  |  | 75 |     And I should see "New page"
 | 
        
           |  |  | 76 |     Then I should see "All participants" in the "Group" "select"
 | 
        
           |  |  | 77 |     And I should see "Group 1" in the "Group" "select"
 | 
        
           |  |  | 78 |     And I should see "Group 2" in the "Group" "select"
 | 
        
           |  |  | 79 |     And I should not see "Group 3" in the "Group" "select"
 | 
        
           |  |  | 80 |   | 
        
           |  |  | 81 |     Examples:
 | 
        
           |  |  | 82 |       | wiki  |
 | 
        
           |  |  | 83 |       | wiki1 |
 | 
        
           |  |  | 84 |       | wiki2 |
 | 
        
           |  |  | 85 |   | 
        
           |  |  | 86 |   Scenario Outline: Students should only see their participation groups' own wiki in separate groups mode
 | 
        
           |  |  | 87 |     Given I am on the "wiki1" "wiki activity" page logged in as <user>
 | 
        
           |  |  | 88 |     Then I should see "Separate groups: <group>"
 | 
        
           |  |  | 89 |     And "Separate groups" "select" should not exist
 | 
        
           |  |  | 90 |     And I should see "<page>"
 | 
        
           |  |  | 91 |   | 
        
           |  |  | 92 |     Examples:
 | 
        
           |  |  | 93 |       | user     | group            | page           |
 | 
        
           |  |  | 94 |       | student1 | Group 1          | Group 1 page   |
 | 
        
           |  |  | 95 |       | student2 | Group 2          | Group 2 page   |
 | 
        
           |  |  | 96 |       # The view page throws an exception if the user is not in a group, so we cannot test
 | 
        
           |  |  | 97 |       # student3 and student4.
 | 
        
           |  |  | 98 |   | 
        
           |  |  | 99 |   Scenario Outline: Students can see all participation groups' own wikis in visible groups mode
 | 
        
           |  |  | 100 |     Given I am on the "wiki2" "wiki activity" page logged in as <user>
 | 
        
           |  |  | 101 |     And I should see "All participants" in the "Visible groups" "select"
 | 
        
           |  |  | 102 |     And I should see "Group 1" in the "Visible groups" "select"
 | 
        
           |  |  | 103 |     And I should see "Group 2" in the "Visible groups" "select"
 | 
        
           |  |  | 104 |     And I should not see "Group 3" in the "Visible groups" "select"
 | 
        
           |  |  | 105 |     And I should see "<page>"
 | 
        
           |  |  | 106 |   | 
        
           |  |  | 107 |     Examples:
 | 
        
           |  |  | 108 |       | user     | page         |
 | 
        
           |  |  | 109 |       | student1 | Group 1 page |
 | 
        
           |  |  | 110 |       | student2 | Group 2 page |
 | 
        
           |  |  | 111 |       | student3 | Group 1 page |
 | 
        
           |  |  | 112 |       | student4 | Group 1 page |
 |