Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_data
2
Feature: Users can use mod_data without editing the templates
3
  In order to use the database module
4
  As a teacher
5
  I need to manage fields and entries using always the default templates.
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | teacher1 | Teacher   | 1        | teacher1@example.com |
11
    And the following "courses" exist:
12
      | fullname | shortname | category |
13
      | Course 1 | C1        | 0        |
14
    And the following "course enrolments" exist:
15
      | user     | course | role           |
16
      | teacher1 | C1     | editingteacher |
17
    And the following "activities" exist:
18
      | activity | name               | intro          | course | idnumber |
19
      | data     | Test database name | Database intro | C1     | data1    |
20
    And the following "mod_data > fields" exist:
21
      | database | type | name   | description              |
22
      | data1    | text | field1 | Test field description   |
23
      | data1    | text | field2 | Test field 2 description |
24
    And the following "mod_data > entries" exist:
25
      | database | field1          | field2         |
26
      | data1    | Student entry 1 | Some content 1 |
27
      | data1    | Student entry 2 | Some content 2 |
28
    And I am on the "Test database name" "data activity" page logged in as teacher1
29
 
30
  @javascript
31
  Scenario: The default view templates should be updated when a field is added.
32
    Given I navigate to "Database" in current page administration
33
    And I should see "field1"
34
    And I should see "field2"
35
    And I should see "Student entry 1"
36
    And I should see "Some content 1"
37
    And I should see "Student entry 2"
38
    And I should see "Some content 2"
39
    And I set the field "View mode tertiary navigation" to "Single view"
40
    And I should see "field1"
41
    And I should see "field2"
42
    And I should see "Student entry 1"
43
    And I should see "Some content 1"
44
    And I should not see "Student entry 2"
45
    And I should not see "Some content 2"
46
    When the following "mod_data > fields" exist:
47
      | database | type | name   | description              |
48
      | data1    | text | field3 | Test field 3 description |
49
    Then I navigate to "Database" in current page administration
50
    And I should see "field1"
51
    And I should see "field2"
52
    And I should see "field3"
53
    And I should see "Student entry 1"
54
    And I should see "Some content 1"
55
    And I should see "Student entry 2"
56
    And I should see "Some content 2"
57
    And I set the field "View mode tertiary navigation" to "Single view"
58
    And I should see "field1"
59
    And I should see "field2"
60
    And I should see "field3"
61
    And I should see "Student entry 1"
62
    And I should see "Some content 1"
63
    And I should not see "Student entry 2"
64
    And I should not see "Some content 2"
65
 
66
  Scenario: The default add templates should be updated when a field is added.
67
    Given I navigate to "Database" in current page administration
68
    And I click on "Add entry" "button"
69
    And I should see "field1"
70
    And I should see "field2"
71
    When the following "mod_data > fields" exist:
72
      | database | type | name   | description              |
73
      | data1    | text | field3 | Test field 3 description |
74
    Then I navigate to "Database" in current page administration
75
    And I click on "Add entry" "button"
76
    And I should see "field1"
77
    And I should see "field2"
78
    And I should see "field3"
79
 
80
  @javascript
81
  Scenario: The default view templates should be updated when a field is deleted.
82
    Given I navigate to "Database" in current page administration
83
    And I should see "field1"
84
    And I should see "field2"
85
    And I should see "Student entry 1"
86
    And I should see "Some content 1"
87
    And I should see "Student entry 2"
88
    And I should see "Some content 2"
89
    And I set the field "View mode tertiary navigation" to "Single view"
90
    And I should see "field1"
91
    And I should see "field2"
92
    And I should see "Student entry 1"
93
    And I should see "Some content 1"
94
    And I should not see "Student entry 2"
95
    And I should not see "Some content 2"
96
    When I navigate to "Fields" in current page administration
97
    And I click on "Actions" "button" in the "field2" "table_row"
98
    And I choose "Delete" in the open action menu
99
    And I click on "Continue" "button"
100
    Then I navigate to "Database" in current page administration
101
    And I should see "field1"
102
    And I should not see "field2"
103
    And I should see "Student entry 1"
104
    And I should not see "Some content 1"
105
    And I should see "Student entry 2"
106
    And I should not see "Some content 2"
107
    And I set the field "View mode tertiary navigation" to "Single view"
108
    And I should see "field1"
109
    And I should not see "field2"
110
    And I should see "Student entry 1"
111
    And I should not see "Some content 1"
112
    And I should not see "Student entry 2"
113
    And I should not see "Some content 2"
114
 
115
  Scenario: The default add templates should be updated when a field is deleted.
116
    Given I navigate to "Database" in current page administration
117
    And I click on "Add entry" "button"
118
    And I should see "field1"
119
    And I should see "field2"
120
    When I navigate to "Fields" in current page administration
121
    And I click on "Delete" "link" in the "field2" "table_row"
122
    And I click on "Continue" "button"
123
    Then I navigate to "Database" in current page administration
124
    And I click on "Add entry" "button"
125
    And I should see "field1"
126
    And I should not see "field2"
127
 
128
  @javascript
129
  Scenario: The dynamic default templates can be reset after a manual edition.
130
    Given I navigate to "Templates" in current page administration
131
    And I set the field "Templates tertiary navigation" to "List view template"
132
    And I set the following fields to these values:
133
      | Header         | New header!                  |
134
      | Repeated entry | This is the template content |
135
      | Footer         | New footer!                  |
136
    And I click on "Save" "button" in the "sticky-footer" "region"
137
    And I navigate to "Database" in current page administration
138
    And I should see "New header!"
139
    And I should see "This is the template content"
140
    And I should see "New footer!"
141
    And I should not see "Student entry 1"
142
    And I should not see "Some content 1"
143
    When I navigate to "Templates" in current page administration
144
    And I set the field "Templates tertiary navigation" to "List view template"
145
    And I click on "Actions" "button"
146
    And I choose "Reset current template" in the open action menu
147
    And I click on "Reset" "button" in the "Reset template?" "dialogue"
148
    And I should see "Template reset"
149
    And I navigate to "Database" in current page administration
150
    And I should not see "New header!"
151
    And I should not see "This is the template content"
152
    And I should not see "New footer!"
153
    And I should see "Student entry 1"
154
    And I should see "Some content 1"
155
    Then the following "mod_data > fields" exist:
156
      | database | type | name   | description              |
157
      | data1    | text | field3 | Test field 3 description |
158
    And I navigate to "Database" in current page administration
159
    And I click on "Add entry" "button"
160
    And I should see "field1"
161
    And I should see "field2"
162
    And I should see "field3"