Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@customfield @customfield_text @javascript
2
Feature: Managers can manage course custom fields text
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 > Default settings > Course custom fields" in site administration
13
 
14
  Scenario: Create a custom course text field
15
    When I click on "Add a new custom field" "link"
16
    And I click on "Short text" "link"
17
    And I set the following fields to these values:
18
      | Name       | Test field |
19
      | Short name | testfield  |
20
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
21
    Then I should see "Test field"
22
    And I log out
23
 
24
  Scenario: Edit a custom course text field
25
    When I click on "Add a new custom field" "link"
26
    And I click on "Short text" "link"
27
    And I set the following fields to these values:
28
      | Name       | Test field |
29
      | Short name | testfield  |
30
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
31
    And I click on "Edit" "link" in the "Test field" "table_row"
32
    And I set the following fields to these values:
33
      | Name | Edited field |
34
    And I click on "Save changes" "button" in the "Updating Test field" "dialogue"
35
    Then I should see "Edited field"
36
    And I navigate to "Reports > Logs" in site administration
37
    And I press "Get these logs"
38
    And I log out
39
 
40
  Scenario: Delete a custom course text field
41
    When I click on "Add a new custom field" "link"
42
    And I click on "Short text" "link"
43
    And I set the following fields to these values:
44
      | Name       | Test field |
45
      | Short name | testfield  |
46
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
47
    And I click on "Delete" "link" in the "Test field" "table_row"
48
    And I click on "Yes" "button" in the "Confirm" "dialogue"
49
    And I wait until the page is ready
50
    And I wait until "Test field" "text" does not exist
51
    Then I should not see "Test field"
52
    And I log out
53
 
54
  Scenario: A text field with a link setting must show link on course listing
55
    Given the following "users" exist:
56
      | username | firstname | lastname  | email                |
57
      | teacher1 | Teacher   | Example 1 | teacher1@example.com |
58
    And the following "courses" exist:
59
      | fullname | shortname | format |
60
      | Course 1 | C1        | topics |
61
    And the following "course enrolments" exist:
62
      | user     | course | role           |
63
      | teacher1 | C1     | editingteacher |
64
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
65
    And I click on "Add a new custom field" "link"
66
    And I click on "Short text" "link"
67
    And I set the following fields to these values:
68
      | Name       | See more on website       |
69
      | Short name | testfield                 |
70
      | Visible to | Everyone                  |
71
      | Link       | https://www.moodle.org/$$ |
72
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
73
    And I log out
74
    Then I log in as "teacher1"
75
    And I am on "Course 1" course homepage
76
    And I navigate to "Settings" in current page administration
77
    And I set the following fields to these values:
78
      | See more on website | course/view.php?id=35 |
79
    And I press "Save and display"
80
    And I am on site homepage
81
    Then I should see "course/view.php?id=35" in the ".customfields-container .customfieldvalue a" "css_element"
82
    Then I should see "See more on website" in the ".customfields-container .customfieldname" "css_element"
83
 
84
  Scenario: A text field with a max length must validate it on course edit form
85
    Given the following "users" exist:
86
      | username | firstname | lastname  | email                |
87
      | teacher1 | Teacher   | Example 1 | teacher1@example.com |
88
    And the following "courses" exist:
89
      | fullname | shortname | format |
90
      | Course 1 | C1        | topics |
91
    And the following "course enrolments" exist:
92
      | user     | course | role           |
93
      | teacher1 | C1     | editingteacher |
94
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
95
    And I click on "Add a new custom field" "link"
96
    And I click on "Short text" "link"
97
    And I set the following fields to these values:
98
      | Name       | Test field |
99
      | Short name | testfield  |
100
      | Maximum number of characters | 3          |
101
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
102
    And I log out
103
    Then I log in as "teacher1"
104
    And I am on "Course 1" course homepage
105
    And I navigate to "Settings" in current page administration
106
    And I set the following fields to these values:
107
      | Test field | 1234 |
108
    And I press "Save and display"
109
    Then I should see "The maximum number of characters allowed in this field is 3."
110
 
111
  Scenario: A text field with a default value must be shown on listing but allow empty values that will not be shown
112
    Given the following "users" exist:
113
      | username | firstname | lastname  | email                |
114
      | teacher1 | Teacher   | Example 1 | teacher1@example.com |
115
    And the following "courses" exist:
116
      | fullname | shortname | format |
117
      | Course 1 | C1        | topics |
118
    And the following "course enrolments" exist:
119
      | user     | course | role           |
120
      | teacher1 | C1     | editingteacher |
121
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
122
    And I click on "Add a new custom field" "link"
123
    And I click on "Short text" "link"
124
    And I set the following fields to these values:
125
      | Name          | Test field  |
126
      | Short name    | testfield   |
127
      | Default value | testdefault |
128
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
129
    And I log out
130
    Then I log in as "teacher1"
131
    When I am on site homepage
132
    Then I should see "Test field: testdefault"
133
    When I am on "Course 1" course homepage
134
    And I navigate to "Settings" in current page administration
135
    Then the "value" attribute of "#id_customfield_testfield" "css_element" should contain "testdefault"
136
    When I set the following fields to these values:
137
      | Test field |  |
138
    And I press "Save and display"
139
    And I am on site homepage
140
    And I should not see "Test field"