1 |
efrain |
1 |
@core @core_course @core_customfield @javascript
|
|
|
2 |
Feature: Managers can manage categories for course custom fields
|
|
|
3 |
In order to have additional data on the course
|
|
|
4 |
As a manager
|
|
|
5 |
I need to create, edit, remove and sort custom field's categories
|
|
|
6 |
|
|
|
7 |
Scenario: Create a category for custom course fields
|
|
|
8 |
Given I log in as "admin"
|
|
|
9 |
When I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
10 |
And I press "Add a new category"
|
|
|
11 |
And I wait until the page is ready
|
|
|
12 |
Then I should see "Other fields" in the "#customfield_catlist" "css_element"
|
|
|
13 |
And I navigate to "Reports > Logs" in site administration
|
|
|
14 |
And I press "Get these logs"
|
|
|
15 |
|
|
|
16 |
Scenario: Edit a category name for custom course fields
|
|
|
17 |
Given the following "custom field categories" exist:
|
|
|
18 |
| name | component | area | itemid |
|
|
|
19 |
| Category for test | core_course | course | 0 |
|
|
|
20 |
And I log in as "admin"
|
|
|
21 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
22 |
And I set the field "Edit category name" in the "//div[contains(@class,'categoryinstance') and contains(.,'Category for test')]" "xpath_element" to "Good fields"
|
|
|
23 |
Then I should not see "Category for test" in the "#customfield_catlist" "css_element"
|
|
|
24 |
And "New value for Category for test" "field" should not exist
|
|
|
25 |
And I should see "Good fields" in the "#customfield_catlist" "css_element"
|
|
|
26 |
And I navigate to "Reports > Logs" in site administration
|
|
|
27 |
And I press "Get these logs"
|
|
|
28 |
|
|
|
29 |
Scenario: Delete a category for custom course fields
|
|
|
30 |
Given the following "custom field categories" exist:
|
|
|
31 |
| name | component | area | itemid |
|
|
|
32 |
| Category for test | core_course | course | 0 |
|
|
|
33 |
And the following "custom fields" exist:
|
|
|
34 |
| name | category | type | shortname |
|
|
|
35 |
| Field 1 | Category for test | text | f1 |
|
|
|
36 |
And I log in as "admin"
|
|
|
37 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
38 |
And I click on "[data-role='deletecategory']" "css_element"
|
|
|
39 |
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
|
|
40 |
And I wait until the page is ready
|
|
|
41 |
And I wait until "Test category" "text" does not exist
|
|
|
42 |
Then I should not see "Test category" in the "#customfield_catlist" "css_element"
|
|
|
43 |
And I navigate to "Reports > Logs" in site administration
|
|
|
44 |
And I press "Get these logs"
|
|
|
45 |
|
|
|
46 |
Scenario: Move field in the course custom fields to another category
|
|
|
47 |
Given the following "custom field categories" exist:
|
|
|
48 |
| name | component | area | itemid |
|
|
|
49 |
| Category1 | core_course | course | 0 |
|
|
|
50 |
| Category2 | core_course | course | 0 |
|
|
|
51 |
| Category3 | core_course | course | 0 |
|
|
|
52 |
And the following "custom fields" exist:
|
|
|
53 |
| name | category | type | shortname |
|
|
|
54 |
| Field1 | Category1 | text | f1 |
|
|
|
55 |
| Field2 | Category2 | text | f2 |
|
|
|
56 |
When I log in as "admin"
|
|
|
57 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
58 |
Then "Field1" "text" should appear after "Category1" "text"
|
|
|
59 |
And "Category2" "text" should appear after "Field1" "text"
|
|
|
60 |
And "Field2" "text" should appear after "Category2" "text"
|
|
|
61 |
And "Category3" "text" should appear after "Field2" "text"
|
|
|
62 |
And I press "Move \"Field1\""
|
|
|
63 |
And I follow "To the top of category Category2"
|
|
|
64 |
And "Category2" "text" should appear after "Category1" "text"
|
|
|
65 |
And "Field1" "text" should appear after "Category2" "text"
|
|
|
66 |
And "Field2" "text" should appear after "Field1" "text"
|
|
|
67 |
And "Category3" "text" should appear after "Field2" "text"
|
|
|
68 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
69 |
And "Category2" "text" should appear after "Category1" "text"
|
|
|
70 |
And "Field1" "text" should appear after "Category2" "text"
|
|
|
71 |
And "Field2" "text" should appear after "Field1" "text"
|
|
|
72 |
And "Category3" "text" should appear after "Field2" "text"
|
|
|
73 |
And I press "Move \"Field1\""
|
|
|
74 |
And I follow "After field Field2"
|
|
|
75 |
And "Field1" "text" should appear after "Field2" "text"
|
|
|
76 |
|
|
|
77 |
Scenario: Reorder course custom field categories
|
|
|
78 |
Given the following "custom field categories" exist:
|
|
|
79 |
| name | component | area | itemid |
|
|
|
80 |
| Category1 | core_course | course | 0 |
|
|
|
81 |
| Category2 | core_course | course | 0 |
|
|
|
82 |
| Category3 | core_course | course | 0 |
|
|
|
83 |
And the following "custom fields" exist:
|
|
|
84 |
| name | category | type | shortname |
|
|
|
85 |
| Field1 | Category1 | text | f1 |
|
|
|
86 |
When I log in as "admin"
|
|
|
87 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
88 |
Then "Field1" "text" should appear after "Category1" "text"
|
|
|
89 |
And "Category2" "text" should appear after "Field1" "text"
|
|
|
90 |
And "Category3" "text" should appear after "Category2" "text"
|
|
|
91 |
And I press "Move \"Category2\""
|
|
|
92 |
And I follow "After \"Category3\""
|
|
|
93 |
And "Field1" "text" should appear after "Category1" "text"
|
|
|
94 |
And "Category3" "text" should appear after "Field1" "text"
|
|
|
95 |
And "Category2" "text" should appear after "Category3" "text"
|
|
|
96 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
97 |
And "Field1" "text" should appear after "Category1" "text"
|
|
|
98 |
And "Category3" "text" should appear after "Field1" "text"
|
|
|
99 |
And "Category2" "text" should appear after "Category3" "text"
|
|
|
100 |
And I press "Move \"Category2\""
|
|
|
101 |
And I follow "After \"Category1\""
|
|
|
102 |
And "Field1" "text" should appear after "Category1" "text"
|
|
|
103 |
And "Category2" "text" should appear after "Field1" "text"
|
|
|
104 |
And "Category3" "text" should appear after "Category2" "text"
|