Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@editor @editor_atto @atto @atto_h5p @core_h5p @_file_upload @_switch_iframe
2
Feature: Add h5ps to Atto
3
  To write rich text - I need to add h5ps.
4
 
5
  Background:
6
    Given the following "courses" exist:
7
      | shortname | fullname |
8
      | C1        | Course 1 |
9
    And the following "users" exist:
10
      | username | firstname | lastname | email |
11
      | teacher1 | Teacher | 1 | teacher1@example.com |
12
    And the following "course enrolments" exist:
13
      | user | course | role |
14
      | teacher1 | C1 | editingteacher |
15
    And the following "activities" exist:
16
      | activity | name       | intro      | introformat | course | content  | contentformat | idnumber |
17
      | page     | PageName1  | PageDesc1  | 1           | C1     | H5Ptest  | 1             | 1        |
18
    And the "displayh5p" filter is "on"
19
    And the following config values are set as admin:
20
      | allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p |
21
    And the following "blocks" exist:
22
      | blockname     | contextlevel | reference | pagetypepattern | defaultregion |
23
      | private_files | System       | 1         | my-index        | side-post     |
24
 
25
  @javascript @external
26
  Scenario: Insert an embedded h5p
27
    Given I change window size to "large"
28
    And I am on the PageName1 "page activity editing" page logged in as admin
29
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
30
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119"
31
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
32
    And I wait until the page is ready
33
    When I click on "Save and display" "button"
34
    Then ".h5p-placeholder" "css_element" should exist
35
    And I wait until the page is ready
36
    And I switch to "h5pcontent" iframe
37
    And I should see "Lorum ipsum"
38
 
39
  @javascript
40
  Scenario: Insert an h5p file
41
    Given I log in as "admin"
42
    And I follow "Manage private files..."
43
    And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
44
    And I click on "Save changes" "button"
45
    And I am on the PageName1 "page activity editing" page
46
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
47
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
48
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
49
    And I click on "guess-the-answer.h5p" "link"
50
    And I click on "Select this file" "button"
51
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
52
    And I wait until the page is ready
53
    When I click on "Save and display" "button"
54
    Then ".h5p-placeholder" "css_element" should exist
55
 
56
  @javascript
57
  Scenario: Test an invalid url
58
    Given I change window size to "large"
59
    And I am on the PageName1 "page activity editing" page logged in as admin
60
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
61
#   This is not a real external URL, so this scenario shouldn't be labeled as external.
62
    And I set the field with xpath "//input[@data-region='h5pfile']" to "ftp://moodle.h5p.com/content/1290772960722742119"
63
    When I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
64
    And I wait until the page is ready
65
    Then I should see "Invalid URL" in the "Insert H5P" "dialogue"
66
 
67
  @javascript
68
  Scenario: No h5p capabilities
69
    Given the following "permission overrides" exist:
70
    | capability | permission | role | contextlevel | reference |
71
    | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
72
    | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
73
    When I am on the PageName1 "page activity editing" page logged in as teacher1
74
    Then "Insert H5P" "button" should not exist
75
 
76
  @javascript
77
  Scenario: No embed h5p capabilities
78
    Given the following "permission overrides" exist:
79
    | capability | permission | role | contextlevel | reference |
80
    | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
81
    And I am on the PageName1 "page activity editing" page logged in as teacher1
82
    And I click on "Insert H5P" "button"
83
    Then I should not see "H5P URL" in the "Insert H5P" "dialogue"
84
    And I should see "H5P file upload" in the "Insert H5P" "dialogue"
85
    And I should see "H5P options" in the "Insert H5P" "dialogue"
86
 
87
  @javascript
88
  Scenario: No upload h5p capabilities
89
    Given the following "permission overrides" exist:
90
    | capability | permission | role | contextlevel | reference |
91
    | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
92
    When I am on the PageName1 "page activity editing" page logged in as teacher1
93
    And I click on "Insert H5P" "button"
94
    Then I should not see "H5P file upload" in the "Insert H5P" "dialogue"
95
    And I should see "H5P URL" in the "Insert H5P" "dialogue"
96
    And I should not see "H5P options" in the "Insert H5P" "dialogue"
97
 
98
  @javascript @external
99
  Scenario: Edit H5P content
100
    Given I log in as "admin"
101
    And I follow "Manage private files..."
102
    And I upload "lib/editor/atto/tests/fixtures/drag.h5p" file to "Files" filemanager
103
    And I click on "Save changes" "button"
104
    And I am on the PageName1 "page activity editing" page
105
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
106
#   H5P file content
107
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
108
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
109
    And I click on "drag" "link"
110
    And I click on "Select this file" "button"
111
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
112
    And I wait until the page is ready
113
    When I click on "Save and display" "button"
114
    And I switch to "h5pcontent" iframe
115
    And I switch to "h5p-iframe" class iframe
116
    Then I should not see "reveal"
117
    And I should see "Cloudberries"
118
    And I switch to the main frame
119
    And I navigate to "Settings" in current page administration
120
    And I click on ".h5p-placeholder" "css_element"
121
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
122
#   External URL
123
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119"
124
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
125
    And I wait until the page is ready
126
    And I click on "Save and display" "button"
127
    And I wait until the page is ready
128
    And I switch to "h5pcontent" iframe
129
    And I should see "Lorum ipsum"
130
    And I should not see "Cloudberries"
131
 
132
  @javascript
133
  Scenario: Enable/disable H5P options atto
134
    Given I log in as "admin"
135
    And I follow "Manage private files..."
136
    And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
137
    And I click on "Save changes" "button"
138
    And I am on the PageName1 "page activity editing" page
139
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
140
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
141
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
142
    And I click on "guess-the-answer.h5p" "link"
143
    And I click on "Select this file" "button"
144
#   No display option button displayed
145
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
146
    When I click on "Save and display" "button"
147
    And I wait until the page is ready
148
    And I switch to "h5pcontent" iframe
149
    And I switch to "h5p-iframe" class iframe
150
    Then ".h5p-actions" "css_element" should not exist
151
    And I switch to the main frame
152
    And I navigate to "Settings" in current page administration
153
    And I click on ".h5p-placeholder" "css_element"
154
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
155
    And I click on "H5P options" "link"
156
#   Only Allow Download button displayed
157
    And I click on "Allow download" "checkbox"
158
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
159
    And I click on "Save and display" "button"
160
    And I switch to "h5pcontent" iframe
161
    And I switch to "h5p-iframe" class iframe
162
    And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
163
    And I should not see "Embed"
164
    And I should not see "Rights of use"
165
    And I switch to the main frame
166
    And I navigate to "Settings" in current page administration
167
    And I click on ".h5p-placeholder" "css_element"
168
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
169
#   Embed and copyright buttons displayed. Download not displayed
170
    And I click on "Allow download" "checkbox"
171
    And I click on "Embed button" "checkbox"
172
    And I click on "Copyright button" "checkbox"
173
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
174
    And I click on "Save and display" "button"
175
    And I switch to "h5pcontent" iframe
176
    And I switch to "h5p-iframe" class iframe
177
    And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
178
    And I should see "Embed"
179
    And I should see "Rights of use"
180
 
181
  @javascript @external
182
  Scenario: H5P options are ignored for H5P URLs
183
    Given I change window size to "large"
184
    And I am on the PageName1 "page activity editing" page logged in as admin
185
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
186
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1291366510035871129"
187
    And I click on "H5P options" "link"
188
    And I click on "Embed button" "checkbox"
189
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
190
    When I click on "Save and display" "button"
191
    Then ".h5p-placeholder" "css_element" should exist
192
    And I switch to "h5pcontent" iframe
193
    And I should see "Far far away"
194
    And I should not see "Embed"
195
    And I switch to the main frame
196
    And I navigate to "Settings" in current page administration
197
    And I click on ".h5p-placeholder" "css_element"
198
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
199
    And I click on "H5P options" "link"
200
    And "input[aria-label=\"Embed button\"]:not([checked=checked])" "css_element" should exist
201
 
202
  @javascript
203
  Scenario: Private H5P files are shown to students
204
    Given the following "users" exist:
205
      | username | firstname | lastname | email |
206
      | student1 | Student   | 1 | student1@example.com |
207
    And the following "course enrolments" exist:
208
      | user | course | role |
209
      | student1 | C1 | student |
210
    And I log in as "admin"
211
    And I follow "Manage private files..."
212
    And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
213
    And I click on "Save changes" "button"
214
    And I am on the PageName1 "page activity editing" page
215
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
216
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
217
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
218
    And I click on "guess-the-answer.h5p" "link"
219
    And I click on "Select this file" "button"
220
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
221
    And I wait until the page is ready
222
    And I click on "Save and display" "button"
223
    And I log out
224
    When I am on the PageName1 "page activity" page logged in as student1
225
    Then I switch to "h5pcontent" iframe
226
    And I switch to "h5p-iframe" class iframe
227
    And I should see "reveal"