Merge branch 'MDL-74861-master' of https://github.com/andelacruz/moodle

This commit is contained in:
Ilya Tregubov
2022-08-31 11:53:15 +04:00
9 changed files with 93 additions and 128 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
@@ -16,24 +16,20 @@ Feature: View activity completion information in the h5p activity
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
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 | Music history |
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
| Require grade | 1 |
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 | Music history |
| completion | 2 |
| completionview | 1 |
| completionusegrade | 1 |
| packagefilepath | h5p/tests/fixtures/filltheblanks.h5p |
Scenario: View automatic completion items
Given I am on the "Music history" "h5pactivity activity" page logged in as teacher1
# Teacher view.
And "Music history" should have the "View" completion condition
And "Music history" should have the "Receive a grade" completion condition
And I log out
# Student view.
When I am on the "Music history" "h5pactivity activity" page logged in as student1
And I switch to "h5p-player" class iframe
@@ -51,7 +47,6 @@ Feature: View activity completion information in the h5p activity
# Teacher view.
And I am on the "Music history" "h5pactivity activity" page
And the manual completion button for "Music history" should be disabled
And I log out
# Student view.
When I am on the "Music history" "h5pactivity activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
@@ -17,47 +17,38 @@ Feature: Pass grade activity completion information in the h5p activity
| student2 | C1 | student |
| student3 | C1 | student |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
And I am on the "Course 1" "Course" page logged in as "admin"
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the following fields to these values:
| Enable completion tracking | Yes |
| Show activity completion conditions | Yes |
And I press "Save and display"
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 | Music history |
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
| Require grade | 1 |
| completionpassgrade | 1 |
| gradepass | 25 |
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Package file" filemanager
And I click on "Save and display" "button"
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Music history |
| completion | 2 |
| completionview | 1 |
| completionusegrade | 1 |
| completionpassgrade | 1 |
| gradepass | 25 |
| packagefilepath | h5p/tests/fixtures/filltheblanks.h5p |
And I log out
Scenario: View automatic completion items
# Teacher view.
Given I am on the "Music history" "h5pactivity activity" page logged in as teacher1
# Given I log in as "teacher1"
# And I am on "Course 1" course homepage
# And I follow "Music history"
And "Music history" should have the "View" completion condition
And "Music history" should have the "Receive a grade" completion condition
And "Music history" should have the "Receive a passing grade" completion condition
And I log out
# Student view.
When I am on the "Music history" "h5pactivity activity" page logged in as student1
# When I log in as "student1"
# And I am on "Course 1" course homepage
# And I follow "Music history"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I reload the page
And I log out
And I am on the "Music history" "h5pactivity activity" page logged in as student2
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
@@ -76,9 +67,7 @@ Feature: Pass grade activity completion information in the h5p activity
And the "View" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "done"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "failed"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" "course" page logged in as "teacher1"
And "Vinnie Student1" user has completed "Music history" activity
And "Vinnie Student2" user has completed "Music history" activity
And "Vinnie Student3" user has not completed "Music history" activity
@@ -21,14 +21,13 @@ Feature: Users can see the H5P recent activity from the recent activity block
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
And the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| packagefilepath | h5p/tests/fixtures/multiple-choice-2-6.h5p |
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 return to course" "button"
And I add the "Recent activity" block
And I log out
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
@@ -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;