11 |
efrain |
1 |
@editor @filter @filter_displayh5p @core_h5p @_switch_iframe
|
1 |
efrain |
2 |
Feature: Inline editing H5P content anywhere
|
|
|
3 |
In order to edit an existing H5P content
|
|
|
4 |
As a user
|
|
|
5 |
I need to see the button and access to the H5P editor
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
12 |
| student1 | Student | 1 | student1@example.com |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category |
|
|
|
15 |
| Course 1 | C1 | 0 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
| teacher2 | C1 | teacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
And the following "contentbank content" exist:
|
|
|
22 |
| contextlevel | reference | contenttype | user | contentname | filepath |
|
|
|
23 |
| Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p |
|
|
|
24 |
And the following "activities" exist:
|
|
|
25 |
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
|
|
26 |
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
|
|
27 |
And the "displayh5p" filter is "on"
|
|
|
28 |
# Override this capability to let teachers and students to Turn editing on.
|
|
|
29 |
And the following "permission overrides" exist:
|
|
|
30 |
| capability | permission | role | contextlevel | reference |
|
|
|
31 |
| moodle/course:update | Allow | teacher | System | |
|
|
|
32 |
| moodle/course:update | Allow | student | System | |
|
|
|
33 |
|
|
|
34 |
@javascript @mod @mod_page
|
|
|
35 |
Scenario: Edit H5P content from a page using link to private file
|
|
|
36 |
Given the following "permission overrides" exist:
|
|
|
37 |
| capability | permission | role | contextlevel | reference |
|
|
|
38 |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
|
11 |
efrain |
39 |
And the following "user private file" exists:
|
|
|
40 |
| user | teacher1 |
|
|
|
41 |
| filepath | h5p/tests/fixtures/greeting-card.h5p |
|
1 |
efrain |
42 |
# Add H5P content to the page.
|
11 |
efrain |
43 |
And I am on the "PageName1" "page activity" page logged in as "teacher1"
|
1 |
efrain |
44 |
And I navigate to "Settings" in current page administration
|
1441 |
ariadna |
45 |
And I click on "Insert H5P content" "button" in the "#fitem_id_page" "css_element"
|
11 |
efrain |
46 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
47 |
And I select "Private files" repository in file picker
|
|
|
48 |
And I click on "greeting-card.h5p" "file" in repository content area
|
|
|
49 |
And I click on "Link to the file" "radio"
|
|
|
50 |
And I click on "Select this file" "button"
|
11 |
efrain |
51 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
52 |
And I click on "Save and display" "button"
|
|
|
53 |
And I switch to "h5p-iframe" class iframe
|
|
|
54 |
And I switch to "h5p-iframe" class iframe
|
|
|
55 |
And I should see "Hello world!"
|
|
|
56 |
And I switch to the main frame
|
|
|
57 |
# The Edit button is only displayed when editing mode is on.
|
|
|
58 |
And I should not see "Edit H5P content"
|
|
|
59 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
60 |
And I am on the "PageName1" "page activity" page
|
|
|
61 |
Then I should see "Edit H5P content"
|
|
|
62 |
And I log out
|
|
|
63 |
# Check admin can't see the Edit button (it's a private file and only the author can edit it).
|
|
|
64 |
And I log in as "admin"
|
|
|
65 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
66 |
And I am on the "PageName1" "page activity" page
|
|
|
67 |
And I should not see "Edit H5P content"
|
|
|
68 |
And I log out
|
|
|
69 |
# Check teacher2 (non-editing teacher) can't see the Edit button.
|
|
|
70 |
And I log in as "teacher2"
|
|
|
71 |
And I turn editing mode on
|
|
|
72 |
And I am on "Course 1" course homepage
|
|
|
73 |
And I am on the "PageName1" "page activity" page
|
|
|
74 |
And I should not see "Edit H5P content"
|
|
|
75 |
And I log out
|
|
|
76 |
# Check student1 can't see the Edit button.
|
|
|
77 |
And I log in as "student1"
|
|
|
78 |
And I turn editing mode on
|
|
|
79 |
And I am on "Course 1" course homepage
|
|
|
80 |
And I am on the "PageName1" "page activity" page
|
|
|
81 |
And I should not see "Edit H5P content"
|
|
|
82 |
|
|
|
83 |
@javascript @mod @mod_page @repository_contentbank
|
|
|
84 |
Scenario: Edit H5P content from a page using link to content bank file
|
|
|
85 |
Given I am on the "C1" "Course" page logged in as "admin"
|
|
|
86 |
# Add H5P content to the page.
|
|
|
87 |
And I am on the "PageName1" "page activity" page
|
|
|
88 |
And I navigate to "Settings" in current page administration
|
1441 |
ariadna |
89 |
And I click on "Insert H5P content" "button" in the "#fitem_id_page" "css_element"
|
11 |
efrain |
90 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
91 |
And I select "Content bank" repository in file picker
|
|
|
92 |
And I click on "Greeting card" "file" in repository content area
|
|
|
93 |
And I click on "Link to the file" "radio"
|
|
|
94 |
And I click on "Select this file" "button"
|
11 |
efrain |
95 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
96 |
And I click on "Save and display" "button"
|
|
|
97 |
And I switch to "h5p-iframe" class iframe
|
|
|
98 |
And I switch to "h5p-iframe" class iframe
|
|
|
99 |
And I should see "Hello world!"
|
|
|
100 |
And I switch to the main frame
|
|
|
101 |
# The Edit button is only displayed when editing mode is on.
|
|
|
102 |
And I should not see "Edit H5P content"
|
|
|
103 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
104 |
And I am on the "PageName1" "page activity" page
|
|
|
105 |
Then I should see "Edit H5P content"
|
|
|
106 |
And I log out
|
|
|
107 |
# Check teacher1 can see the Edit button too.
|
|
|
108 |
And I log in as "teacher1"
|
|
|
109 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
110 |
And I am on the "PageName1" "page activity" page
|
|
|
111 |
And I should not see "Edit H5P content"
|
|
|
112 |
And I log out
|
|
|
113 |
# Check teacher2 (non-editing teacher) can't see the Edit button.
|
|
|
114 |
And I log in as "teacher2"
|
|
|
115 |
And I turn editing mode on
|
|
|
116 |
And I am on "Course 1" course homepage
|
|
|
117 |
And I am on the "PageName1" "page activity" page
|
|
|
118 |
And I should not see "Edit H5P content"
|
|
|
119 |
And I log out
|
|
|
120 |
# Check student1 can't see the Edit button.
|
|
|
121 |
And I log in as "student1"
|
|
|
122 |
And I turn editing mode on
|
|
|
123 |
And I am on "Course 1" course homepage
|
|
|
124 |
And I am on the "PageName1" "page activity" page
|
|
|
125 |
And I should not see "Edit H5P content"
|
|
|
126 |
|
|
|
127 |
@javascript @mod @mod_page @repository_contentbank
|
|
|
128 |
Scenario: Edit H5P content from a page using copy to content bank file
|
|
|
129 |
Given I am on the "C1" "Course" page logged in as "admin"
|
|
|
130 |
# Add H5P content to the page.
|
|
|
131 |
And I am on the "PageName1" "page activity" page
|
|
|
132 |
And I navigate to "Settings" in current page administration
|
1441 |
ariadna |
133 |
And I click on "Insert H5P content" "button" in the "#fitem_id_page" "css_element"
|
11 |
efrain |
134 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
135 |
And I select "Content bank" repository in file picker
|
|
|
136 |
And I click on "Greeting card" "file" in repository content area
|
|
|
137 |
And I click on "Make a copy of the file" "radio"
|
|
|
138 |
And I click on "Select this file" "button"
|
11 |
efrain |
139 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
140 |
And I click on "Save and display" "button"
|
|
|
141 |
And I switch to "h5p-iframe" class iframe
|
|
|
142 |
And I switch to "h5p-iframe" class iframe
|
|
|
143 |
And I should see "Hello world!"
|
|
|
144 |
And I switch to the main frame
|
|
|
145 |
# The Edit button is only displayed when editing mode is on.
|
|
|
146 |
And I should not see "Edit H5P content"
|
|
|
147 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
148 |
And I am on the "PageName1" "page activity" page
|
|
|
149 |
Then I should see "Edit H5P content"
|
|
|
150 |
And I log out
|
|
|
151 |
# Check teacher1 can see the Edit button too.
|
|
|
152 |
And I log in as "teacher1"
|
|
|
153 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
154 |
And I am on the "PageName1" "page activity" page
|
|
|
155 |
And I should see "Edit H5P content"
|
|
|
156 |
And I log out
|
|
|
157 |
# Check teacher2 (non-editing teacher) can't see the Edit button.
|
|
|
158 |
And I log in as "teacher2"
|
|
|
159 |
And I turn editing mode on
|
|
|
160 |
And I am on "Course 1" course homepage
|
|
|
161 |
And I am on the "PageName1" "page activity" page
|
|
|
162 |
And I should not see "Edit H5P content"
|
|
|
163 |
And I log out
|
|
|
164 |
# Check student1 can't see the Edit button.
|
|
|
165 |
And I log in as "student1"
|
|
|
166 |
And I turn editing mode on
|
|
|
167 |
And I am on "Course 1" course homepage
|
|
|
168 |
And I am on the "PageName1" "page activity" page
|
|
|
169 |
And I should not see "Edit H5P content"
|
|
|
170 |
|
|
|
171 |
@javascript @mod @mod_page
|
|
|
172 |
Scenario: Edit H5P content from a page using external URL
|
|
|
173 |
Given the following config values are set as admin:
|
|
|
174 |
| allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p |
|
|
|
175 |
And I am on the "C1" "Course" page logged in as "admin"
|
|
|
176 |
# Add H5P content to the page.
|
|
|
177 |
And I am on the "PageName1" "page activity" page
|
|
|
178 |
And I navigate to "Settings" in current page administration
|
1441 |
ariadna |
179 |
And I click on "Insert H5P content" "button" in the "#fitem_id_page" "css_element"
|
11 |
efrain |
180 |
And I set the field "H5P URL or file upload" to "https://moodle.h5p.com/content/1290772960722742119"
|
|
|
181 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
182 |
And I click on "Save and display" "button"
|
|
|
183 |
And ".h5p-placeholder" "css_element" should exist
|
|
|
184 |
And I switch to "h5pcontent" iframe
|
|
|
185 |
And I should see "Lorum ipsum"
|
|
|
186 |
And I switch to the main frame
|
|
|
187 |
# The Edit button is never displayed (because it's not a local file).
|
|
|
188 |
And I should not see "Edit H5P content"
|
|
|
189 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
190 |
And I am on the "PageName1" "page activity" page
|
|
|
191 |
Then I should not see "Edit H5P content"
|
|
|
192 |
And I log out
|
|
|
193 |
# Check teacher1 can't see the Edit button.
|
|
|
194 |
And I log in as "teacher1"
|
|
|
195 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
196 |
And I am on the "PageName1" "page activity" page
|
|
|
197 |
And I should not see "Edit H5P content"
|
|
|
198 |
And I log out
|
|
|
199 |
# Check teacher2 (non-editing teacher) can't see the Edit button.
|
|
|
200 |
And I log in as "teacher2"
|
|
|
201 |
And I turn editing mode on
|
|
|
202 |
And I am on "Course 1" course homepage
|
|
|
203 |
And I am on the "PageName1" "page activity" page
|
|
|
204 |
And I should not see "Edit H5P content"
|
|
|
205 |
And I log out
|
|
|
206 |
# Check student1 can't see the Edit button.
|
|
|
207 |
And I log in as "student1"
|
|
|
208 |
And I turn editing mode on
|
|
|
209 |
And I am on "Course 1" course homepage
|
|
|
210 |
And I am on the "PageName1" "page activity" page
|
|
|
211 |
And I should not see "Edit H5P content"
|
|
|
212 |
|
|
|
213 |
@javascript @block @block_html @core_block @repository_contentbank
|
|
|
214 |
Scenario: Edit H5P content from a block using copy to content bank file
|
|
|
215 |
Given I am on the "C1" "Course" page logged in as "admin"
|
|
|
216 |
# Add H5P content to the block.
|
|
|
217 |
And I turn editing mode on
|
|
|
218 |
And I add the "Text" block to the default region with:
|
|
|
219 |
| Text block title | H5PTest |
|
|
|
220 |
| Content | - |
|
|
|
221 |
And I configure the "H5PTest" block
|
1441 |
ariadna |
222 |
And I click on "Insert H5P content" "button" in the "//div[contains(@id,'fitem_id_config_text')]" "xpath_element"
|
11 |
efrain |
223 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
224 |
And I select "Content bank" repository in file picker
|
|
|
225 |
And I click on "Greeting card" "file" in repository content area
|
|
|
226 |
And I click on "Make a copy of the file" "radio"
|
|
|
227 |
And I click on "Select this file" "button"
|
11 |
efrain |
228 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
229 |
And I click on "Save changes" "button" in the "Configure H5PTest block" "dialogue"
|
|
|
230 |
And I switch to "h5p-iframe" class iframe
|
|
|
231 |
And I switch to "h5p-iframe" class iframe
|
|
|
232 |
And I should see "Hello world!"
|
|
|
233 |
And I switch to the main frame
|
|
|
234 |
# The Edit button is only displayed when editing mode is on.
|
|
|
235 |
And I should see "Edit H5P content"
|
|
|
236 |
When I turn editing mode off
|
|
|
237 |
Then I should not see "Edit H5P content"
|
|
|
238 |
And I log out
|
|
|
239 |
# Check teacher1 can see the Edit button too.
|
|
|
240 |
And I log in as "teacher1"
|
|
|
241 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
242 |
And I should see "Edit H5P content"
|
|
|
243 |
And I log out
|
|
|
244 |
# Check teacher2 (non-editing teacher) can't see the Edit button.
|
|
|
245 |
And I log in as "teacher2"
|
|
|
246 |
And I turn editing mode on
|
|
|
247 |
And I am on "Course 1" course homepage
|
|
|
248 |
And I should not see "Edit H5P content"
|
|
|
249 |
And I log out
|
|
|
250 |
# Check student1 can't see the Edit button.
|
|
|
251 |
And I log in as "student1"
|
|
|
252 |
And I turn editing mode on
|
|
|
253 |
And I am on "Course 1" course homepage
|
|
|
254 |
And I should not see "Edit H5P content"
|