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 preview presets
3
  In order to find the preset I am looking for
4
  As a teacher
5
  I need to preview the database activity presets
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 "tags" exist:
12
      | name | isstandard |
13
      | Tag1 | 1          |
14
    And the following "courses" exist:
15
      | fullname | shortname | category |
16
      | Course 1 | C1        | 0        |
17
    And the following "course enrolments" exist:
18
      | user     | course | role           |
19
      | teacher1 | C1     | editingteacher |
20
    And the following "activities" exist:
21
      | activity | name               | intro          | course | idnumber |
22
      | data     | Test database name | Database intro | C1     | data1    |
23
    And I am on the "Test database name" "data activity" page logged in as teacher1
24
 
25
  @javascript @_file_upload
26
  Scenario: Preview a user preset as list view template in database
27
    Given I follow "Presets"
28
    And I click on "Actions" "button"
29
    And I choose "Import preset" in the open action menu
30
    And I upload "mod/data/tests/fixtures/behat_preset.zip" file to "Preset file" filemanager
31
    When I click on "Import preset and apply" "button"
32
    And I follow "Templates"
33
    And I click on "Actions" "button"
34
    And I choose "Publish preset on this site" in the open action menu
35
    And I set the field "Name" to "Saved preset by teacher1"
36
    And I set the field "Description" to "Behat test preset"
37
    And I click on "Save" "button" in the "Save all fields and templates and publish as preset on this site" "dialogue"
38
    When I follow "Presets"
39
    And I click on "Saved preset by teacher1" "link"
40
    # Check list template preview fields.
41
    Then I should see "Saved preset by teacher1"
42
    And I should see "List header" in the "template-preview" "region"
43
    And I should see "List footer" in the "template-preview" "region"
44
    And I should see "List template content" in the "template-preview" "region"
45
    And I should see "My text field" in the "template-preview" "region"
46
    And I should see "This is a short text" in the "template-preview" "region"
47
    And I should see "My multiple selection" in the "template-preview" "region"
48
    And I should see "Multi 1" in the "template-preview" "region"
49
    And I should see "My date field" in the "template-preview" "region"
50
    And I should see "My checkbox field" in the "template-preview" "region"
51
    And I should see "Check 2" in the "template-preview" "region"
52
    And I should see "My geo field" in the "template-preview" "region"
53
    And I should see "41.3912°N 2.1639°E" in the "template-preview" "region"
54
    And I should see "My menu field" in the "template-preview" "region"
55
    And I should see "Menu 2" in the "template-preview" "region"
56
    And I should see "My number field" in the "template-preview" "region"
57
    And I should see "1234" in the "template-preview" "region"
58
    And I should see "My radio field" in the "template-preview" "region"
59
    And I should see "Radio 2" in the "template-preview" "region"
60
    And I should see "My text area field" in the "template-preview" "region"
61
    And I should see "This is a text area" in the "template-preview" "region"
62
    And I should see "My URL field" in the "template-preview" "region"
63
    And I should see "https://example.com" in the "template-preview" "region"
64
    And I should see "My file field" in the "template-preview" "region"
65
    And "Comma-separated values" "icon" should exist in the "template-preview" "region"
66
    And I should see "samplefile.csv" in the "template-preview" "region"
67
    And I should see "My picture field" in the "template-preview" "region"
68
    # Test CSS and JS templates.
69
    And I should not see "This content should not be displayed" in the "template-preview" "region"
70
    And I should not see "This text should change" in the "template-preview" "region"
71
    And I should see "New value" in the "template-preview" "region"
72
 
73
  @javascript @_file_upload
74
  Scenario: Preview a user preset as single view template in database
75
    Given I follow "Presets"
76
    And I click on "Actions" "button"
77
    And I choose "Import preset" in the open action menu
78
    And I upload "mod/data/tests/fixtures/behat_preset.zip" file to "Preset file" filemanager
79
    When I click on "Import preset and apply" "button"
80
    And I follow "Templates"
81
    And I click on "Actions" "button"
82
    And I choose "Publish preset on this site" in the open action menu
83
    And I set the field "Name" to "Saved preset by teacher1"
84
    And I set the field "Description" to "Behat test preset"
85
    And I click on "Save" "button" in the "Save all fields and templates and publish as preset on this site" "dialogue"
86
    When I follow "Presets"
87
    And I click on "Saved preset by teacher1" "link"
88
    And I set the field "Templates tertiary navigation" to "Single view template"
89
    # Check single view template preview fields.
90
    Then I should see "Saved preset by teacher1"
91
    And I should see "Single template content" in the "template-preview" "region"
92
    And I should see "My text field" in the "template-preview" "region"
93
    And I should see "This is a short text" in the "template-preview" "region"
94
    And I should see "My multiple selection" in the "template-preview" "region"
95
    And I should see "Multi 2" in the "template-preview" "region"
96
    And I should see "My date field" in the "template-preview" "region"
97
    And I should see "My checkbox field" in the "template-preview" "region"
98
    And I should see "Check 2" in the "template-preview" "region"
99
    And I should see "My geo field" in the "template-preview" "region"
100
    And I should see "41.3912°N 2.1639°E" in the "template-preview" "region"
101
    And I should see "My menu field" in the "template-preview" "region"
102
    And I should see "Menu 2" in the "template-preview" "region"
103
    And I should see "My number field" in the "template-preview" "region"
104
    And I should see "1234" in the "template-preview" "region"
105
    And I should see "My radio field" in the "template-preview" "region"
106
    And I should see "Radio 2" in the "template-preview" "region"
107
    And I should see "My text area field" in the "template-preview" "region"
108
    And I should see "This is a text area" in the "template-preview" "region"
109
    And I should see "My URL field" in the "template-preview" "region"
110
    And I should see "https://example.com" in the "template-preview" "region"
111
    And I should see "My file field" in the "template-preview" "region"
112
    And "Comma-separated values" "icon" should exist in the "template-preview" "region"
113
    And I should see "samplefile.csv" in the "template-preview" "region"
114
    And I should see "My picture field" in the "template-preview" "region"
115
    # Test CSS and JS templates.
116
    And I should not see "This content should not be displayed" in the "template-preview" "region"
117
    And I should not see "This text should change" in the "template-preview" "region"
118
    And I should see "New value" in the "template-preview" "region"
119
 
120
  @javascript
121
  Scenario: Preview a plugin preset in database
122
    Given I follow "Presets"
123
    When I click on "Journal" "link"
124
    Then I should see "Journal"
125
    And I should see "This is a short text"
126
    And I should see "This is a text area"
127
    And I select "Single view template" from the "Templates tertiary navigation" singleselect
128
    And I should see "This is a short text"
129
    And I should see "This is a text area"
130
    And I should see "This is a short text" in the "template-preview" "region"
131
 
132
  @javascript
133
  Scenario: Use back button to return to the presets page in database
134
    Given I follow "Presets"
135
    And I click on "Image gallery" "link"
136
    And I should see "Image gallery"
137
    When I click on "Back" "button"
138
    Then I should see "Choose a preset to use as a starting point."
139
 
140
  @javascript
141
  Scenario: Apply plugin preset from preview in database
142
    Given I follow "Presets"
143
    And I click on "Image gallery" "link"
144
    When I click on "Use this preset" "button"
145
    Then I should see "image"
146
    And I should see "title"
147
 
148
  @javascript @_file_upload
149
  Scenario: Apply user preset from preview in database
150
    Given I follow "Presets"
151
    And I click on "Actions" "button"
152
    And I choose "Import preset" in the open action menu
153
    And I upload "mod/data/tests/fixtures/behat_preset.zip" file to "Preset file" filemanager
154
    When I click on "Import preset and apply" "button"
155
    And I follow "Templates"
156
    And I click on "Actions" "button"
157
    And I choose "Publish preset on this site" in the open action menu
158
    And I set the field "Name" to "Saved preset by teacher1"
159
    And I set the field "Description" to "Behat test preset"
160
    And I click on "Save" "button" in the "Save all fields and templates and publish as preset on this site" "dialogue"
161
    When I follow "Presets"
162
    And I click on "Saved preset by teacher1" "link"
163
    And I click on "Use this preset" "button"
164
    Then I should see "Preset applied"
165
    And I should see "My URL field"