AutorÃa | Ultima modificación | Ver Log |
@customfield @customfield_text @javascriptFeature: Managers can manage course custom fields textIn order to have additional data on the courseAs a managerI need to create, edit, remove and sort custom fieldsBackground:Given the following "custom field categories" exist:| name | component | area | itemid || Category for test | core_course | course | 0 |And I log in as "admin"And I navigate to "Courses > Default settings > Course custom fields" in site administrationScenario: Create a custom course text fieldWhen I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | Test field || Short name | testfield |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"Then I should see "Test field"And I log outScenario: Edit a custom course text fieldWhen I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | Test field || Short name | testfield |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"And I click on "Edit" "link" in the "Test field" "table_row"And I set the following fields to these values:| Name | Edited field |And I click on "Save changes" "button" in the "Updating Test field" "dialogue"Then I should see "Edited field"And I navigate to "Reports > Logs" in site administrationAnd I press "Get these logs"And I log outScenario: Delete a custom course text fieldWhen I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | Test field || Short name | testfield |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"And I click on "Delete" "link" in the "Test field" "table_row"And I click on "Yes" "button" in the "Confirm" "dialogue"And I wait until the page is readyAnd I wait until "Test field" "text" does not existThen I should not see "Test field"And I log outScenario: A text field with a link setting must show link on course listingGiven the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | Example 1 | teacher1@example.com |And the following "courses" exist:| fullname | shortname | format || Course 1 | C1 | topics |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher |And I navigate to "Courses > Default settings > Course custom fields" in site administrationAnd I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | See more on website || Short name | testfield || Visible to | Everyone || Link | https://www.moodle.org/$$ |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"And I log outThen I log in as "teacher1"And I am on "Course 1" course homepageAnd I navigate to "Settings" in current page administrationAnd I set the following fields to these values:| See more on website | course/view.php?id=35 |And I press "Save and display"And I am on site homepageThen I should see "course/view.php?id=35" in the ".customfields-container .customfieldvalue a" "css_element"Then I should see "See more on website" in the ".customfields-container .customfieldname" "css_element"Scenario: A text field with a max length must validate it on course edit formGiven the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | Example 1 | teacher1@example.com |And the following "courses" exist:| fullname | shortname | format || Course 1 | C1 | topics |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher |And I navigate to "Courses > Default settings > Course custom fields" in site administrationAnd I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | Test field || Short name | testfield || Maximum number of characters | 3 |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"And I log outThen I log in as "teacher1"And I am on "Course 1" course homepageAnd I navigate to "Settings" in current page administrationAnd I set the following fields to these values:| Test field | 1234 |And I press "Save and display"Then I should see "The maximum number of characters allowed in this field is 3."Scenario: A text field with a default value must be shown on listing but allow empty values that will not be shownGiven the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | Example 1 | teacher1@example.com |And the following "courses" exist:| fullname | shortname | format || Course 1 | C1 | topics |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher |And I navigate to "Courses > Default settings > Course custom fields" in site administrationAnd I click on "Add a new custom field" "link"And I click on "Short text" "link"And I set the following fields to these values:| Name | Test field || Short name | testfield || Default value | testdefault |And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"And I log outThen I log in as "teacher1"When I am on site homepageThen I should see "Test field: testdefault"When I am on "Course 1" course homepageAnd I navigate to "Settings" in current page administrationThen the "value" attribute of "#id_customfield_testfield" "css_element" should contain "testdefault"When I set the following fields to these values:| Test field | |And I press "Save and display"And I am on site homepageAnd I should not see "Test field"