Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz
2
Feature: Quiz group override
3
  In order to grant a group special access to a quiz
4
  As a teacher
5
  I need to create an override for that group.
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname  | lastname  | email                |
10
      | teacher1 | Terry 1    | Teacher 1 | teacher1@example.com |
11
      | student1 | Sam 1      | Student 1 | student1@example.com |
12
      | teacher2 | Terry 2    | Teacher 2 | teacher2@example.com |
13
      | student2 | Sam 2      | Student 2 | student2@example.com |
14
      | teacher3 | Terry 3    | Teacher 3 | teacher3@example.com |
15
      | student3 | Sam 3      | Student 3 | student3@example.com |
16
      | helper   | Exam       | Helper    | helper@example.com   |
17
    And the following "courses" exist:
18
      | fullname | shortname | category |
19
      | Course 1 | C1        | 0        |
20
    And the following "course enrolments" exist:
21
      | user     | course | role           |
22
      | teacher1 | C1     | editingteacher |
23
      | student1 | C1     | student        |
24
      | teacher2 | C1     | editingteacher |
25
      | student2 | C1     | student        |
26
      | teacher3 | C1     | editingteacher |
27
      | student3 | C1     | student        |
28
      | helper   | C1     | teacher        |
29
    And the following "groups" exist:
30
      | name    | course | idnumber |
31
      | Group 1 | C1     | G1       |
32
      | Group 2 | C1     | G2       |
33
      | Group 3 | C1     | G3       |
34
    And the following "group members" exist:
35
      | user     | group |
36
      | student1 | G1    |
37
      | teacher1 | G1    |
38
      | teacher1 | G3    |
39
      | student2 | G2    |
40
      | teacher2 | G2    |
41
      | teacher2 | G3    |
42
      | student3 | G3    |
43
      | helper   | G1    |
44
      | helper   | G2    |
45
      | helper   | G3    |
46
    And the following "activities" exist:
47
      | activity | name      | intro                 | course | idnumber | groupmode |
48
      | quiz     | Test quiz | Test quiz description | C1     | quiz1    | 1         |
49
 
50
  Scenario: Override Group 1 as teacher of Group 1
51
    Given the following "permission overrides" exist:
52
      | capability                  | permission | role           | contextlevel | reference |
53
      | moodle/site:accessallgroups | Prevent    | editingteacher | Course       | C1        |
54
    When I am on the "Test quiz" "mod_quiz > Group overrides" page logged in as "teacher1"
55
    And I press "Add group override"
56
    Then the "Override group" select box should contain "Group 1"
57
    And the "Override group" select box should not contain "Group 2"
58
 
59
  Scenario: Add button disabled if there are no groups
60
    Given the following "permission overrides" exist:
61
      | capability                  | permission | role           | contextlevel | reference |
62
      | moodle/site:accessallgroups | Prevent    | editingteacher | Course       | C1        |
63
    When I am on the "Test quiz" "mod_quiz > Group overrides" page logged in as "teacher3"
64
    Then I should see "No groups you can access."
65
    And the "Add group override" "button" should be disabled
66
 
67
  Scenario: A teacher can create an override
68
    When I am on the "Test quiz" "mod_quiz > Group overrides" page logged in as "teacher1"
69
    And I press "Add group override"
70
    And I set the following fields to these values:
71
      | Override group   | Group 1 |
72
      | Attempts allowed | 2       |
73
    And I press "Save and enter another override"
74
    And I set the following fields to these values:
75
      | Override group   | Group 3 |
76
      | Attempts allowed | 2       |
77
    And I press "Save"
78
    Then "Group 1" "table_row" should exist
79
    # Check all column headers are present.
80
    And I should see "Group" in the "Overrides" "table_row"
81
    And I should see "Action" in the "Overrides" "table_row"
82
 
83
  Scenario: A teacher with accessallgroups permission should see all group overrides
84
    Given the following "mod_quiz > group overrides" exist:
85
      | quiz      | group | attempts |
86
      | Test quiz | G1    | 2        |
87
      | Test quiz | G2    | 2        |
88
    When I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher1"
89
    Then I should see "Settings overrides exist (Groups: 2)"
90
    And I follow "Groups: 2"
91
    And "Group 1" "table_row" should exist
92
    And "Group 2" "table_row" should exist
93
 
94
  Scenario: A teacher without accessallgroups permission should only see the group overrides within his/her groups, when the activity's group mode is "separate groups"
95
    Given the following "permission overrides" exist:
96
      | capability                  | permission | role           | contextlevel | reference |
97
      | moodle/site:accessallgroups | Prevent    | editingteacher | Course       | C1        |
98
    And the following "mod_quiz > group overrides" exist:
99
      | quiz      | group | attempts |
100
      | Test quiz | G1    | 2        |
101
      | Test quiz | G2    | 2        |
102
    When I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher1"
103
    Then I should see "Settings overrides exist (Groups: 1) for your groups"
104
    And I follow "Groups: 1"
105
    Then "Group 1" "table_row" should exist
106
    And "Group 2" "table_row" should not exist
107
 
108
  Scenario: A non-editing teacher can see the overrides, but not change them
109
    Given the following "mod_quiz > group overrides" exist:
110
      | quiz      | group | attempts |
111
      | Test quiz | G1    | 2        |
112
      | Test quiz | G2    | 2        |
113
    When I am on the "Test quiz" "mod_quiz > Group overrides" page logged in as "helper"
114
    Then "Group 1" "table_row" should exist
115
    And "Group 2" "table_row" should exist
116
    And "Add group override" "button" should not exist
117
    And "Edit" "link" should not exist in the "Group 1" "table_row"
118
    And "Copy" "link" should not exist in the "Group 1" "table_row"
119
    And "Delete" "link" should not exist in the "Group 1" "table_row"
120
 
121
  Scenario: "Not visible" groups should not be available for group overrides
122
    Given the following "groups" exist:
123
      | name                                 | course | idnumber | visibility | participation |
124
      | Visible to everyone/Participation         | C1     | VP       | 0          | 1             |
125
      | Only visible to members/Participation     | C1     | MP       | 1          | 1             |
126
      | Only see own membership                   | C1     | O        | 2          | 0             |
127
      | Not visible                          | C1     | N        | 3          | 0             |
128
      | Visible to everyone/Non-Participation     | C1     | VN       | 0          | 0             |
129
      | Only visible to members/Non-Participation | C1     | MN       | 1          | 0             |
130
    When I am on the "quiz1" Activity page logged in as teacher1
131
    And I navigate to "Overrides" in current page administration
132
    And I select "Group overrides" from the "jump" singleselect
133
    And I press "Add group override"
134
    Then I should see "Visible to everyone/Participation" in the "Override group" "select"
135
    And I should see "Visible to everyone/Non-Participation" in the "Override group" "select"
136
    And I should see "Only visible to members" in the "Override group" "select"
137
    And I should see "Only visible to members/Non-Participation" in the "Override group" "select"
138
    And I should see "Only see own membership" in the "Override group" "select"
139
    And I should not see "Not visible" in the "Override group" "select"