Merge branch 'MDL-74861-39' of https://github.com/andelacruz/moodle into MOODLE_39_STABLE

This commit is contained in:
Ilya Tregubov
2022-08-31 11:51:54 +04:00
6 changed files with 68 additions and 86 deletions
@@ -22,13 +22,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity to a course
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | H5P activity Description |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
And I wait until the page is ready
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| intro | H5P activity Description |
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
Then I should see "H5P activity Description"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -40,13 +40,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity with download
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Allow download | 1 |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 12 |
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I wait until the page is ready
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -57,13 +57,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity with embed
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Embed button | 1 |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 10 |
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I wait until the page is ready
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -74,13 +74,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity with copyright
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Copyright button | 1 |
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 6 |
| packagefilepath | h5p/tests/fixtures/guess-the-answer.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I wait until the page is ready
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -91,13 +91,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity with copyright in a content without copyright
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Copyright button | 1 |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 6 |
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I wait until the page is ready
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -108,15 +108,13 @@ Feature: Add H5P activity
@javascript
Scenario: Add a h5pactivity activity to a course with all display options enabled
When I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Allow download | 1 |
| Embed button | 1 |
| Copyright button | 1 |
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 0 |
| packagefilepath | h5p/tests/fixtures/guess-the-answer.h5p |
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I wait until the page is ready
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -19,15 +19,11 @@ Feature: Change grading options in an H5P activity
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
And I upload "h5p/tests/fixtures/multiple-choice-2-6.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
And I log out
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| packagefilepath | h5p/tests/fixtures/multiple-choice-2-6.h5p |
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -44,7 +40,6 @@ Feature: Change grading options in an H5P activity
And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I switch to the main frame
And I log out
@javascript
Scenario: Default grading is max attempt grade
@@ -17,16 +17,12 @@ Feature: View fill the blanks attempt report
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Grading method | Average grade |
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
And I log out
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| grademethod | 2 |
| packagefilepath | h5p/tests/fixtures/filltheblanks.h5p |
Scenario: View attempt in a fill the blanks content
Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
@@ -17,16 +17,12 @@ Feature: View essay attempt report
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
| Grading method | Average grade |
And I upload "h5p/tests/fixtures/basic_essay.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
And I log out
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| grademethod | 2 |
| packagefilepath | h5p/tests/fixtures/basic_essay.h5p |
Scenario: View attempt essay content
# Do an attempt.
@@ -19,25 +19,20 @@ Feature: Do a H5P attempt
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
| Name | Awesome H5P package |
| Description | Description |
And I upload "h5p/tests/fixtures/multiple-choice-2-6.h5p" file to "Package file" filemanager
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| packagefilepath | h5p/tests/fixtures/multiple-choice-2-6.h5p |
@javascript
Scenario: View an H5P as a teacher
When I click on "Save and display" "button"
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1
And I wait until the page is ready
Then I should see "This content is displayed in preview mode"
@javascript
Scenario: To an attempts and check on course log report
When I click on "Save and return to course" "button"
And I log out
Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I wait until the page is ready
And I should not see "This content is displayed in preview mode"
And I switch to "h5p-player" class iframe
+2
View File
@@ -55,6 +55,8 @@ class mod_h5pactivity_generator extends testing_module_generator {
// Fill in optional values if not specified.
if (!isset($record->packagefilepath)) {
$record->packagefilepath = $CFG->dirroot.'/h5p/tests/fixtures/h5ptest.zip';
} else if (strpos($record->packagefilepath, $CFG->dirroot) !== 0) {
$record->packagefilepath = "{$CFG->dirroot}/{$record->packagefilepath}";
}
if (!isset($record->grade)) {
$record->grade = 100;