Show
Setup
Upload the test-h5p.html file to the $CFG->wwwroot.
Login as admin.
Go to the dashboard.
Access to the private files block.
Create the following folder: "Folder with spaces".
Upload the files arithmetic-quiz.h5p, invalid.h5p and latex-demo.h5p to the root folder.
Upload the course-presentation.h5p to the "Folder with spaces" folder.
Save the changes.
Create a student (s1).
Create a course "Course 1".
Access to the course.
Create a "Folder" resource.
Upload the interactive-video.h5p to the "Folder".
Create a "Forum" activity (forum1).
Testing scenario 1. Valid H5P file
In the Private files block, copy the URL for the file arithmetic-quiz.h5p in the root (you'll get it right-clicking over the filename). It should be something like http://moodle.server/pluginfile.php/5/user/private/arithmetic-quiz.h5p?forcedownload=1
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected. It should show some multiplications, like this: https://h5p.org/arithmetic-quiz
Check a sound is played when an answer is given regardless if it's right or wrong.
Check there isn't a grey bar below the H5P content.
Testing scenario 2. Invalid H5P file
In the Private files block, copy the URL for the file invalid.h5p in the root.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the following exception is displayed: " not-in-whitelist : File "content/phet.html" not allowed. Only files with the following extensions are allowed: json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 m4a wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile vtt webvtt. ".
Testing scenario 3. Valid H5P file in a folder with spaces, with the action bar displayed
In the Private files block, copy the URL for the file course-presentation.h5p in "Folder with spaces".
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Select all the checkboxes (frame, embed, export and copyright).
Click the Display button.
Check the H5P content is displayed and working as expected. It should show a presentation like this: https://h5p.org/presentation
Check a grey bar is displayed below the H5P content with the following buttons: "Reuse", "Rights of use", "Embed".
Click the "Reuse" button.
Check you can download an H5P file.
Click the "Rights of use" button.
Check a new popup is opened with information about some files used in the presentation.
Click the "Embed" button.
Check a popup is displayed with the code for embedding this H5P content.
Copy this code.
Access to "Course 1" and create a Page
In the Content field, display all the Atto buttons (clicking the first button) and click the HTML one (usually it's the last one with a symbol like this </>).
Paste the code copied in #14.
Save the page.
Check the H5P content is displayed on the page.
Check there isn't a grey bar below the H5P content.
Upload the file downloaded in step #9 to the root of the private files.
Copy the URL for this file from the Private files block.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected.
Check there isn't a grey bar below the H5P content.
Testing scenario 4. H5P content with addon
In the Private files block, copy the URL for the latex-demo.h5p in the root.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected, and the formulas are rendered correctly. It should show a presentation like this: https://h5p.org/presentation
Testing scenario 5. User permissions accessing to the H5P content
In the Private files block, copy the URL for the file arithmetic-quiz.h5p in the root.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected. It should show some multiplications, like this: https://h5p.org/arithmetic-quiz
Copy the URL.
Open a different browser (for instance, if you're using Chrome, open Firefox).
Paste the previous URL.
Check the following error message is displayed: "This H5P content can't be displayed because you don't have access to the .h5p file."
Open a new tab in the browser2.
Login as s1 (for now, this student isn't enrolled in Course 1).
Reload the first tab in browser2.
Check the following error message is displayed: "This H5P content can't be displayed because you don't have access to the .h5p file."
Access to the first browser (the one where admin user is logged-in).
Go to the "Course 1".
Click on the "Folder" resource and copy the URL for the interactive-video.h5p file.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed.
Copy the URL.
Access to the second browser (the one where s1 is logged-in).
Paste the previous URL.
Check the following error message is displayed: "Course or activity not accessible. (Not enrolled)"
Access to the first browser (the one where admin user is logged-in).
Enrol s1 to the "Course1".
Access to the second browser (the one where s1 is logged-in).
Reload the page.
Check the H5P content is displayed and working as expected. It should show the Smoothie interactive video: https://h5p.org/interactive-video
Access to the first browser (the one where admin user is logged-in).
Hide the "Folder" resource.
Access to the second browser (the one where s1 is logged-in).
Reload the page.
Check the following error message is displayed: "Course or activity not accessible. (Activity is hidden)".
Close the second browser.
Access to the first browser (the one where admin user is logged-in).
Show the "Folder" resource.
Testing scenario 6. H5P content for guests
In the Private files block, copy the URL for the file arithmetic-quiz.h5p in the root.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected.
Copy the URL.
Open a different browser (for instance, if you're using Chrome, open Firefox).
Paste the previous URL.
Check the following error message is displayed: "This H5P content can't be displayed because you don't have access to the .h5p file."
Open a new tab in the browser2.
Login as guest.
Access to the previous page and reload the page.
Check the following error message is displayed: "This H5P content can't be displayed because you don't have access to the .h5p file."
Access to the first browser (the one where admin user is logged-in).
Go to the "Course 1".
Click on the "Folder" resource and copy the URL for the interactive-video.h5p file.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed.
Copy the URL.
Access to the second browser (the one where the guest is logged-in).
Paste the previous URL.
Check the following error message is displayed: "Course or activity not accessible. (Not enrolled)".
Access to the first browser (the one where admin user is logged-in).
Enable access for guests (Participants / Enrolment methods / Guest access)
Access to the second browser (the one where the guest is logged-in).
Reload the page.
Check the H5P content is displayed and working as expected
Testing scenario 7. Change display options depending on the permissions
Login as admin.
Go to the "Course 1".
Click on the "Folder" resource and copy the URL for the interactive-video.h5p file.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Select the checkboxes embed and copyright.
Click the Display button.
Check the H5P content is displayed and working as expected.
Check a grey bar is displayed below the H5P content with the following buttons: "Rights of use", "Embed".
Open again $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the H5P content is displayed and working as expected.
Check there isn't a grey bar below the H5P content.
Open a different browser (for instance, if you're using Chrome, open Firefox).
Login as s1.
Open $CFG->wwwroot/test-h5p.html
Paste the previous URL into the "H5P file URL" form field.
Select all the checkboxes (frame, embed, export and copyright).
Click the Display button.
Check the H5P content is displayed and working as expected.
Check there isn't a grey bar below the H5P content.
Testing scenario 8. Deploy H5P content depending on the permissions
Login as s1.
Go to the "Course 1".
Post a message to the forum1 and add the interactive-video.h5p file as an attachment.
Copy the URL for the interactive-video.h5p file attached to the forum post.
Open $CFG->wwwroot/test-h5p.html in a new tab.
Paste the previous URL into the "H5P file URL" form field.
Click the Display button.
Check the following error message is displayed: "This file can't be displayed because it has been uploaded by a user without the required capability to deploy H5P content."
Open a different browser (for instance, if you're using Chrome, open Firefox).
Log in as admin.
Edit the Forum activity (forum1) permissions.
Add the "Student" to the Roles with permission for the "Allow to deploy H5P content" capability.
Access to the first browser (the one where admin user is logged-in).
Reload the page.
Check the H5P content is displayed and working as expected.