1 |
efrain |
1 |
@core @core_group @core_customfield @javascript
|
|
|
2 |
Feature: Add and use group custom fields
|
|
|
3 |
In order to store an extra information about groups
|
|
|
4 |
As an admin
|
|
|
5 |
I need to create group customs fields and be able to populate them on group creation
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "custom field categories" exist:
|
|
|
9 |
| name | component | area | itemid |
|
|
|
10 |
| Category for group1 | core_group | group | 0 |
|
|
|
11 |
| Category for grouping1 | core_group | grouping | 0 |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "users" exist:
|
|
|
16 |
| username | firstname | lastname | email |
|
|
|
17 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role |
|
|
|
20 |
| teacher1 | C1 | editingteacher |
|
|
|
21 |
|
|
|
22 |
Scenario: Create a new group custom field and use the field for a new group
|
|
|
23 |
When I log in as "admin"
|
|
|
24 |
And I navigate to "Courses > Groups > Group custom fields" in site administration
|
|
|
25 |
Then I should see "Category for group1"
|
|
|
26 |
And I click on "Add a new custom field" "link"
|
|
|
27 |
And I click on "Short text" "link"
|
|
|
28 |
And I set the following fields to these values:
|
|
|
29 |
| Name | Test field |
|
|
|
30 |
| Short name | testfield |
|
|
|
31 |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
|
|
32 |
Then the following should exist in the "generaltable" table:
|
|
|
33 |
| Custom field | Short name | Type |
|
|
|
34 |
| Test field | testfield | Short text |
|
|
|
35 |
Then I log in as "teacher1"
|
|
|
36 |
And I am on the "Course 1" "groups" page
|
|
|
37 |
And I press "Create group"
|
|
|
38 |
Then I should see "Category for group1"
|
|
|
39 |
And I should see "Test field"
|
|
|
40 |
And I set the following fields to these values:
|
|
|
41 |
| Group name | My new group |
|
|
|
42 |
| Test field | Custom field text |
|
|
|
43 |
And I press "Save changes"
|
|
|
44 |
Then the "groups" select box should contain "My new group (0)"
|
|
|
45 |
And I set the field "groups" to "My new group (0)"
|
|
|
46 |
And I press "Edit group settings"
|
|
|
47 |
And the field "Test field" matches value "Custom field text"
|
|
|
48 |
|
|
|
49 |
Scenario: Create a new grouping custom field and use the field for a new grouping
|
|
|
50 |
When I log in as "admin"
|
|
|
51 |
And I navigate to "Courses > Groups > Grouping custom fields" in site administration
|
|
|
52 |
Then I should see "Category for grouping1"
|
|
|
53 |
And I click on "Add a new custom field" "link"
|
|
|
54 |
And I click on "Short text" "link"
|
|
|
55 |
And I set the following fields to these values:
|
|
|
56 |
| Name | Test field |
|
|
|
57 |
| Short name | testfield |
|
|
|
58 |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
|
|
59 |
Then the following should exist in the "generaltable" table:
|
|
|
60 |
| Custom field | Short name | Type |
|
|
|
61 |
| Test field | testfield | Short text |
|
|
|
62 |
Then I log in as "teacher1"
|
|
|
63 |
And I am on the "Course 1" "groupings" page
|
|
|
64 |
And I press "Create grouping"
|
|
|
65 |
Then I should see "Category for grouping1"
|
|
|
66 |
And I should see "Test field"
|
|
|
67 |
And I set the following fields to these values:
|
|
|
68 |
| Grouping name | My new grouping |
|
|
|
69 |
| Test field | Custom field text |
|
|
|
70 |
And I press "Save changes"
|
|
|
71 |
Then I should see "My new grouping"
|
|
|
72 |
And I click on "Edit" "link" in the "My new grouping" "table_row"
|
|
|
73 |
And the field "Test field" matches value "Custom field text"
|