1@customfield @customfield_select @javascript 2Feature: Managers can manage course custom fields select 3 In order to have additional data on the course 4 As a manager 5 I need to create, edit, remove and sort custom fields 6 7 Background: 8 Given the following "custom field categories" exist: 9 | name | component | area | itemid | 10 | Category for test | core_course | course | 0 | 11 And I log in as "admin" 12 And I navigate to "Courses > Course custom fields" in site administration 13 14 Scenario: Create a custom course select field 15 When I click on "Add a new custom field" "link" 16 And I click on "Dropdown menu" "link" 17 And I set the following fields to these values: 18 | Name | Test field | 19 | Short name | testfield | 20 And I set the field "Menu options (one per line)" to multiline: 21 """ 22 a 23 b 24 """ 25 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 26 Then I should see "Test field" 27 And I log out 28 29 Scenario: Edit a custom course select field 30 When I click on "Add a new custom field" "link" 31 And I click on "Dropdown menu" "link" 32 And I set the following fields to these values: 33 | Name | Test field | 34 | Short name | testfield | 35 And I set the field "Menu options (one per line)" to multiline: 36 """ 37 a 38 b 39 """ 40 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 41 And I click on "Edit" "link" in the "Test field" "table_row" 42 And I set the following fields to these values: 43 | Name | Edited field | 44 And I click on "Save changes" "button" in the "Updating Test field" "dialogue" 45 Then I should see "Edited field" 46 And I should not see "Test field" 47 And I log out 48 49 Scenario: Delete a custom course select field 50 When I click on "Add a new custom field" "link" 51 And I click on "Dropdown menu" "link" 52 And I set the following fields to these values: 53 | Name | Test field | 54 | Short name | testfield | 55 And I set the field "Menu options (one per line)" to multiline: 56 """ 57 a 58 b 59 """ 60 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 61 And I click on "Delete" "link" in the "Test field" "table_row" 62 And I click on "Yes" "button" in the "Confirm" "dialogue" 63 Then I should not see "Test field" 64 And I log out 65 66 Scenario: Validation of custom course select field configuration 67 When I click on "Add a new custom field" "link" 68 And I click on "Dropdown menu" "link" 69 And I set the following fields to these values: 70 | Name | Test field | 71 | Short name | testfield | 72 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 73 And I should see "Please provide at least two options, with each on a new line." in the "Menu options (one per line)" "form_row" 74 And I set the field "Menu options (one per line)" to multiline: 75 """ 76 a 77 b 78 """ 79 And I set the field "Default value" to "c" 80 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 81 And I should see "The default value must be one of the options from the list above" in the "Default value" "form_row" 82 And I set the field "Default value" to "b" 83 And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" 84 And "testfield" "text" should exist in the "Test field" "table_row" 85 And I log out 86