1 |
efrain |
1 |
@mod @mod_data
|
|
|
2 |
Feature: Group data activity
|
|
|
3 |
In order to create a database with my group
|
|
|
4 |
As a student
|
|
|
5 |
I need to add and view entries for the groups I am a member of
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
And the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Test Course 1 | C1 |
|
|
|
11 |
And the following "groups" exist:
|
|
|
12 |
| name | course | idnumber | participation |
|
|
|
13 |
| Group 1 | C1 | G1 | 1 |
|
|
|
14 |
| Group 2 | C1 | G2 | 1 |
|
|
|
15 |
| Group 3 | C1 | G3 | 0 |
|
|
|
16 |
And the following "users" exist:
|
|
|
17 |
| username | firstname | lastname | email |
|
|
|
18 |
| teacher1 | TeacherG1 | 1 | teacher1@example.com |
|
|
|
19 |
| user1 | User1G1 | 1 | user1@example.com |
|
|
|
20 |
| user2 | User2G2 | 2 | user2@example.com |
|
|
|
21 |
| user3 | User3None | 3 | user3@example.com |
|
|
|
22 |
| user4 | User4NPgroup | 4 | user4@example.com |
|
|
|
23 |
And the following "course enrolments" exist:
|
|
|
24 |
| user | course | role |
|
|
|
25 |
| teacher1 | C1 | editingteacher |
|
|
|
26 |
| user1 | C1 | student |
|
|
|
27 |
| user2 | C1 | student |
|
|
|
28 |
| user3 | C1 | student |
|
|
|
29 |
| user4 | C1 | student |
|
|
|
30 |
And the following "group members" exist:
|
|
|
31 |
| user | group |
|
|
|
32 |
| teacher1 | G1 |
|
|
|
33 |
| user1 | G1 |
|
|
|
34 |
| user2 | G2 |
|
|
|
35 |
| user4 | G3 |
|
|
|
36 |
And the following "activities" exist:
|
|
|
37 |
| activity | name | intro | course | idnumber | groupmode |
|
|
|
38 |
| data | Separate data | Data with separate groups | C1 | data1 | 1 |
|
|
|
39 |
| data | Visible data | Data with visible groups | C1 | data2 | 2 |
|
|
|
40 |
And the following "mod_data > fields" exist:
|
|
|
41 |
| database | type | name |
|
|
|
42 |
| data1 | shorttext | separatetext |
|
|
|
43 |
| data2 | shorttext | visibletext |
|
|
|
44 |
And the following "mod_data > entries" exist:
|
|
|
45 |
| database | user | group | separatetext |
|
|
|
46 |
| data1 | user1 | G1 | I am user 1 |
|
|
|
47 |
| data1 | user2 | G2 | I am user 2 |
|
|
|
48 |
And the following "mod_data > entries" exist:
|
|
|
49 |
| database | user | separatetext |
|
|
|
50 |
| data1 | user3 | I am user 3 |
|
|
|
51 |
And the following "mod_data > entries" exist:
|
|
|
52 |
| database | user | group | visibletext |
|
|
|
53 |
| data2 | user1 | G1 | I am user 1 |
|
|
|
54 |
| data2 | user2 | G2 | I am user 2 |
|
|
|
55 |
And the following "mod_data > entries" exist:
|
|
|
56 |
| database | user | visibletext |
|
|
|
57 |
| data2 | user3 | I am user 3 |
|
|
|
58 |
| data2 | user4 | I am user 4 |
|
|
|
59 |
|
|
|
60 |
Scenario Outline: Users should see their own participation groups in "separate groups" mode, and all
|
|
|
61 |
participation groups in "visible groups" mode.
|
|
|
62 |
Given I am on the "<data>" "data activity" page logged in as "<user>"
|
|
|
63 |
Then I <all> "All participants"
|
|
|
64 |
And I <G1> "Group 1"
|
|
|
65 |
And I <user1> "I am user 1"
|
|
|
66 |
And I <G2> "Group 2"
|
|
|
67 |
And I <user2> "I am user 2"
|
|
|
68 |
# All users should see entries with no group.
|
|
|
69 |
And I should see "I am user 3"
|
|
|
70 |
# No-one should see non-participation groups.
|
|
|
71 |
And I should not see "Group 3"
|
|
|
72 |
|
|
|
73 |
Examples:
|
|
|
74 |
| data | user | all | G1 | G2 | user1 | user2 |
|
|
|
75 |
| data1 | teacher1 | should see | should see | should see | should see | should see |
|
|
|
76 |
| data1 | user1 | should not see | should see | should not see | should see | should not see |
|
|
|
77 |
| data1 | user2 | should not see | should not see | should see | should not see | should see |
|
|
|
78 |
| data1 | user3 | should see | should not see | should not see | should not see | should not see |
|
|
|
79 |
| data1 | user4 | should see | should not see | should not see | should not see | should not see |
|
|
|
80 |
| data2 | teacher1 | should see | should see | should see | should see | should see |
|
|
|
81 |
| data2 | user1 | should see | should see | should see | should see | should not see |
|
|
|
82 |
| data2 | user2 | should see | should see | should see | should not see | should see |
|
|
|
83 |
| data2 | user3 | should see | should see | should see | should see | should not see |
|
|
|
84 |
| data2 | user4 | should see | should see | should see | should see | should not see |
|
|
|
85 |
|
|
|
86 |
Scenario Outline: When viewing a database in visible groups mode,
|
|
|
87 |
a user should only have the "Add entry" button for their own participation groups
|
|
|
88 |
Given I am on the "data2" "data activity" page logged in as "<user>"
|
|
|
89 |
And I select "<mygroup>" from the "group" singleselect
|
|
|
90 |
And I should see "Add entry"
|
|
|
91 |
When I select "<othergroup>" from the "group" singleselect
|
|
|
92 |
Then I should not see "Add entry"
|
|
|
93 |
|
|
|
94 |
Examples:
|
|
|
95 |
| user | mygroup | othergroup |
|
|
|
96 |
| user1 | Group 1 | Group 2 |
|
|
|
97 |
| user2 | Group 2 | Group 1 |
|
|
|
98 |
| user1 | All participants | Group 2 |
|
|
|
99 |
| user2 | All participants | Group 1 |
|
|
|
100 |
|
|
|
101 |
Scenario Outline: Users in no groups or non-participation groups should not be able to add entries
|
|
|
102 |
Given I am on the "<data>" "data activity" page logged in as "<user>"
|
|
|
103 |
Then I should not see "Add entry"
|
|
|
104 |
|
|
|
105 |
Examples:
|
|
|
106 |
| data | user |
|
|
|
107 |
| data1 | user3 |
|
|
|
108 |
| data1 | user4 |
|
|
|
109 |
| data2 | user3 |
|
|
|
110 |
| data2 | user4 |
|