11 |
efrain |
1 |
@editor @editor_tiny @tiny_h5p @javascript
|
1 |
efrain |
2 |
Feature: Use the TinyMCE editor to upload an h5p package
|
|
|
3 |
In order to work with h5p
|
|
|
4 |
As a content creator
|
|
|
5 |
I need to be able to embed H5P packages
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| shortname | fullname |
|
|
|
10 |
| C1 | Course 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
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 | introformat | course | content | contentformat | idnumber |
|
|
|
19 |
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
|
|
20 |
And the "displayh5p" filter is "on"
|
|
|
21 |
And the following config values are set as admin:
|
|
|
22 |
| allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p |
|
|
|
23 |
|
|
|
24 |
@javascript @external
|
|
|
25 |
Scenario: TinyMCE can be used to embed an H5P activity
|
|
|
26 |
Given I change window size to "large"
|
|
|
27 |
And I am on the PageName1 "page activity editing" page logged in as admin
|
1441 |
ariadna |
28 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
29 |
And I set the field "H5P URL or file upload" to "https://moodle.h5p.com/content/1290772960722742119"
|
|
|
30 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
31 |
When I click on "Save and display" "button"
|
|
|
32 |
Then ".h5p-placeholder" "css_element" should exist
|
|
|
33 |
And I switch to "h5pcontent" iframe
|
|
|
34 |
And I should see "Lorum ipsum"
|
|
|
35 |
|
|
|
36 |
@javascript
|
|
|
37 |
Scenario: TinyMCE can be used to upload and embed an H5P activity
|
11 |
efrain |
38 |
Given the following "user private file" exists:
|
|
|
39 |
| user | admin |
|
|
|
40 |
| filepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
1 |
efrain |
41 |
And I change window size to "large"
|
11 |
efrain |
42 |
And I am on the "PageName1" "page activity editing" page logged in as "admin"
|
1441 |
ariadna |
43 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
44 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
45 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
46 |
And I click on "guess-the-answer.h5p" "link"
|
|
|
47 |
And I click on "Select this file" "button"
|
|
|
48 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
49 |
When I click on "Save and display" "button"
|
|
|
50 |
Then ".h5p-placeholder" "css_element" should exist
|
|
|
51 |
|
|
|
52 |
@javascript
|
1441 |
ariadna |
53 |
Scenario: Permissions can be configured to control access to H5P
|
|
|
54 |
Given the following "users" exist:
|
|
|
55 |
| username | firstname | lastname | email |
|
|
|
56 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
57 |
And the following "roles" exist:
|
|
|
58 |
| name | shortname | description | archetype |
|
|
|
59 |
| Custom teacher | custom1 | Limited permissions | editingteacher |
|
|
|
60 |
And the following "course enrolments" exist:
|
|
|
61 |
| user | course | role |
|
|
|
62 |
| teacher2 | C1 | custom1 |
|
|
|
63 |
And the following "activity" exists:
|
|
|
64 |
| activity | assign |
|
|
|
65 |
| course | C1 |
|
|
|
66 |
| name | Test assignment |
|
|
|
67 |
And the following "permission overrides" exist:
|
|
|
68 |
| capability | permission | role | contextlevel | reference |
|
|
|
69 |
| tiny/h5p:use | Prohibit | custom1 | Course | C1 |
|
|
|
70 |
# Check plugin access as a role with prohibited permissions.
|
|
|
71 |
And I log in as "teacher2"
|
|
|
72 |
And I am on the "Test assignment" Activity page
|
|
|
73 |
And I navigate to "Settings" in current page administration
|
|
|
74 |
When I click on the "Insert" menu item for the "Activity instructions" TinyMCE editor
|
|
|
75 |
Then I should not see "Insert H5P content"
|
|
|
76 |
# Check plugin access as a role with allowed permissions.
|
|
|
77 |
And I log in as "teacher1"
|
|
|
78 |
And I am on the "Test assignment" Activity page
|
|
|
79 |
And I navigate to "Settings" in current page administration
|
|
|
80 |
And I click on the "Insert" menu item for the "Activity instructions" TinyMCE editor
|
|
|
81 |
And I should see "Insert H5P content"
|
1 |
efrain |
82 |
|
|
|
83 |
@javascript
|
|
|
84 |
Scenario: When a user does not have the Upload H5P capability, they can embed but not upload H5P content with TinyMCE
|
|
|
85 |
Given the following "permission overrides" exist:
|
|
|
86 |
| capability | permission | role | contextlevel | reference |
|
|
|
87 |
| moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
|
|
|
88 |
When I am on the PageName1 "page activity editing" page logged in as teacher1
|
1441 |
ariadna |
89 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
90 |
Then I should not see "H5P file upload" in the "Insert H5P content" "dialogue"
|
|
|
91 |
And I should see "H5P URL" in the "Insert H5P content" "dialogue"
|
|
|
92 |
And I should not see "H5P options" in the "Insert H5P content" "dialogue"
|
|
|
93 |
|
|
|
94 |
@javascript @external
|
|
|
95 |
Scenario: A user can edit H5P content embedding with TinyMCE
|
11 |
efrain |
96 |
Given the following "user private file" exists:
|
|
|
97 |
| user | admin |
|
|
|
98 |
| filepath | h5p/tests/fixtures/drag.h5p |
|
|
|
99 |
And I am on the "PageName1" "page activity editing" page logged in as "admin"
|
1441 |
ariadna |
100 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
101 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
102 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
103 |
And I click on "drag" "link"
|
|
|
104 |
And I click on "Select this file" "button"
|
|
|
105 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
106 |
When I click on "Save and display" "button"
|
|
|
107 |
And I switch to "h5pcontent" iframe
|
|
|
108 |
And I switch to "h5p-iframe" class iframe
|
|
|
109 |
Then I should not see "reveal"
|
|
|
110 |
And I should see "Cloudberries"
|
|
|
111 |
And I switch to the main frame
|
|
|
112 |
And I navigate to "Settings" in current page administration
|
|
|
113 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
1441 |
ariadna |
114 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
115 |
And I set the field "H5P URL or file upload" to "https://moodle.h5p.com/content/1290772960722742119"
|
|
|
116 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
117 |
And I wait "1" seconds
|
|
|
118 |
And I click on "Save and display" "button"
|
|
|
119 |
And I switch to "h5pcontent" iframe
|
|
|
120 |
And I should see "Lorum ipsum"
|
|
|
121 |
And I should not see "Cloudberries"
|
|
|
122 |
|
|
|
123 |
@javascript
|
|
|
124 |
Scenario: Enable/disable H5P options tiny
|
11 |
efrain |
125 |
Given the following "user private file" exists:
|
|
|
126 |
| user | admin |
|
|
|
127 |
| filepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
|
|
128 |
And I am on the "PageName1" "page activity editing" page logged in as "admin"
|
1441 |
ariadna |
129 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
130 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
131 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
132 |
And I click on "guess-the-answer.h5p" "link"
|
|
|
133 |
And I click on "Select this file" "button"
|
|
|
134 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
135 |
When I click on "Save and display" "button"
|
|
|
136 |
And I switch to "h5pcontent" iframe
|
|
|
137 |
And I switch to "h5p-iframe" class iframe
|
|
|
138 |
Then ".h5p-actions" "css_element" should not exist
|
|
|
139 |
And I switch to the main frame
|
|
|
140 |
And I navigate to "Settings" in current page administration
|
|
|
141 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
1441 |
ariadna |
142 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
143 |
And I click on "H5P options" "link"
|
|
|
144 |
And I click on "Allow download" "checkbox"
|
|
|
145 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
146 |
And I wait "1" seconds
|
|
|
147 |
And I click on "Save and display" "button"
|
|
|
148 |
And I switch to "h5pcontent" iframe
|
|
|
149 |
And I switch to "h5p-iframe" class iframe
|
|
|
150 |
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
|
|
|
151 |
And I should not see "Embed"
|
|
|
152 |
And I should not see "Rights of use"
|
|
|
153 |
And I switch to the main frame
|
|
|
154 |
And I navigate to "Settings" in current page administration
|
|
|
155 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
1441 |
ariadna |
156 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
157 |
And I click on "Allow download" "checkbox"
|
|
|
158 |
And I click on "Embed button" "checkbox"
|
|
|
159 |
And I click on "Copyright button" "checkbox"
|
|
|
160 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
161 |
And I wait "1" seconds
|
|
|
162 |
And I click on "Save and display" "button"
|
|
|
163 |
And I switch to "h5pcontent" iframe
|
|
|
164 |
And I switch to "h5p-iframe" class iframe
|
|
|
165 |
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
|
|
166 |
And I should see "Embed"
|
|
|
167 |
And I should see "Rights of use"
|
|
|
168 |
|
|
|
169 |
@javascript @external
|
|
|
170 |
Scenario: H5P options are ignored for H5P URLs
|
|
|
171 |
Given I change window size to "large"
|
|
|
172 |
And I am on the PageName1 "page activity editing" page logged in as admin
|
1441 |
ariadna |
173 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
174 |
And I set the field "H5P URL or file upload" to "https://moodle.h5p.com/content/1291366510035871129"
|
|
|
175 |
And I click on "H5P options" "link"
|
|
|
176 |
And I click on "Embed button" "checkbox"
|
|
|
177 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
178 |
When I click on "Save and display" "button"
|
|
|
179 |
Then ".h5p-placeholder" "css_element" should exist
|
|
|
180 |
And I switch to "h5pcontent" iframe
|
|
|
181 |
And I should see "Far far away"
|
|
|
182 |
And I should not see "Embed"
|
|
|
183 |
And I switch to the main frame
|
|
|
184 |
And I navigate to "Settings" in current page administration
|
|
|
185 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
1441 |
ariadna |
186 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
187 |
And I click on "H5P options" "link"
|
1441 |
ariadna |
188 |
And the field "Embed button" matches value "1"
|
1 |
efrain |
189 |
|
|
|
190 |
@javascript
|
1441 |
ariadna |
191 |
Scenario: Enable/disable display options
|
|
|
192 |
Given the following "user private file" exists:
|
|
|
193 |
| user | admin |
|
|
|
194 |
| filepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
|
|
195 |
When I am on the "PageName1" "page activity editing" page logged in as "admin"
|
|
|
196 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
|
|
197 |
Then "Auto-play in the mobile app" "field" should exist
|
|
|
198 |
And the field "Auto-play in the mobile app" matches value "0"
|
|
|
199 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
200 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
201 |
And I click on "guess-the-answer.h5p" "link"
|
|
|
202 |
And I click on "Select this file" "button"
|
|
|
203 |
And I click on "Display options" "link"
|
|
|
204 |
And I click on "Auto-play in the mobile app" "checkbox"
|
|
|
205 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
206 |
And I click on "Save and display" "button"
|
|
|
207 |
And ".h5p-placeholder[data-mobileapp-autoplay=true]" "css_element" should exist
|
|
|
208 |
And I navigate to "Settings" in current page administration
|
|
|
209 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
|
|
210 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
|
|
211 |
And the field "Auto-play in the mobile app" matches value "1"
|
|
|
212 |
And I click on "Auto-play in the mobile app" "checkbox"
|
|
|
213 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
|
|
214 |
And I wait "1" seconds
|
|
|
215 |
And I click on "Save and display" "button"
|
|
|
216 |
And ".h5p-placeholder:not([data-mobileapp-autoplay=true])" "css_element" should exist
|
|
|
217 |
And I navigate to "Settings" in current page administration
|
|
|
218 |
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
|
|
219 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
|
|
220 |
And the field "Auto-play in the mobile app" matches value "0"
|
|
|
221 |
|
|
|
222 |
@javascript
|
1 |
efrain |
223 |
Scenario: Private H5P files are shown to students
|
|
|
224 |
Given the following "users" exist:
|
|
|
225 |
| username | firstname | lastname | email |
|
|
|
226 |
| student1 | Student | 1 | student1@example.com |
|
|
|
227 |
And the following "course enrolments" exist:
|
|
|
228 |
| user | course | role |
|
|
|
229 |
| student1 | C1 | student |
|
11 |
efrain |
230 |
And the following "user private file" exists:
|
|
|
231 |
| user | admin |
|
|
|
232 |
| filepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
|
|
233 |
And I am on the "PageName1" "page activity editing" page logged in as "admin"
|
1441 |
ariadna |
234 |
And I click on the "Insert H5P content" button for the "Page content" TinyMCE editor
|
1 |
efrain |
235 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
236 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
237 |
And I click on "guess-the-answer.h5p" "link"
|
|
|
238 |
And I click on "Select this file" "button"
|
|
|
239 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
240 |
And I click on "Save and display" "button"
|
|
|
241 |
When I am on the PageName1 "page activity" page logged in as student1
|
|
|
242 |
Then I switch to "h5pcontent" iframe
|
|
|
243 |
And I switch to "h5p-iframe" class iframe
|
|
|
244 |
And I should see "reveal"
|