Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@customfield @customfield_date @javascript
2
Feature: Managers can manage course custom fields date
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 date field
15
    When I click on "Add a new custom field" "link"
16
    And I click on "Date and time" "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 Date and time" "dialogue"
21
    Then I should see "Test field"
22
    And I log out
23
 
24
  Scenario: Edit a custom course date field
25
    When I click on "Add a new custom field" "link"
26
    And I click on "Date and time" "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 Date and time" "dialogue"
31
    And I click on "[data-role='editfield']" "css_element"
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 log out
37
 
38
  Scenario: Delete a custom course date field
39
    When I click on "Add a new custom field" "link"
40
    And I click on "Date and time" "link"
41
    And I set the following fields to these values:
42
      | Name       | Test field |
43
      | Short name | testfield  |
44
    And I click on "Save changes" "button" in the "Adding a new Date and time" "dialogue"
45
    And I click on "[data-role='deletefield']" "css_element"
46
    And I click on "Yes" "button" in the "Confirm" "dialogue"
47
    Then I should not see "Test field"
48
    And I log out
49
 
50
  Scenario: A date field makerd to include time must show those fields on course form
51
    Given the following "users" exist:
52
      | username | firstname | lastname  | email                |
53
      | teacher1 | Teacher   | Example 1 | teacher1@example.com |
54
    And the following "courses" exist:
55
      | fullname | shortname | format |
56
      | Course 1 | C1        | topics |
57
    And the following "course enrolments" exist:
58
      | user     | course | role           |
59
      | teacher1 | C1     | editingteacher |
60
    When I click on "Add a new custom field" "link"
61
    And I click on "Date and time" "link"
62
    And I set the following fields to these values:
63
      | Name         | Test field |
64
      | Short name   | testfield  |
65
      | Include time | 1          |
66
    And I click on "Save changes" "button" in the "Adding a new Date and time" "dialogue"
67
    And I log out
68
    Then I log in as "teacher1"
69
    When I am on site homepage
70
    When I am on "Course 1" course homepage
71
    And I navigate to "Settings" in current page administration
72
    And I expand all fieldsets
73
    Then "#id_customfield_testfield_hour" "css_element" should be visible
74
    Then "#id_customfield_testfield_minute" "css_element" should be visible
75
    And I log out
76
 
77
  Scenario: A date field makerd to not include time must not show those fields on course form
78
    Given the following "users" exist:
79
      | username | firstname | lastname  | email                |
80
      | teacher1 | Teacher   | Example 1 | teacher1@example.com |
81
    And the following "courses" exist:
82
      | fullname | shortname | format |
83
      | Course 1 | C1        | topics |
84
    And the following "course enrolments" exist:
85
      | user     | course | role           |
86
      | teacher1 | C1     | editingteacher |
87
    When I click on "Add a new custom field" "link"
88
    And I click on "Date and time" "link"
89
    And I set the following fields to these values:
90
      | Name         | Test field |
91
      | Short name   | testfield  |
92
      | Include time |            |
93
    And I click on "Save changes" "button" in the "Adding a new Date and time" "dialogue"
94
    And I log out
95
    Then I log in as "teacher1"
96
    When I am on site homepage
97
    When I am on "Course 1" course homepage
98
    And I navigate to "Settings" in current page administration
99
    And I expand all fieldsets
100
    Then "#id_customfield_testfield_hour" "css_element" should not be visible
101
    Then "#id_customfield_testfield_minute" "css_element" should not be visible
102
    And I log out