first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,122 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
Feature: Add H5P activity
In order to let students access a H5P package
As a teacher
I need to add H5P activity to a course
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
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
@javascript
Scenario: Add an h5pactivity to a course
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
And I should see "Lorum ipsum"
And I should not see "Reuse"
And I should not see "Rights of use"
And I should not see "Embed"
@javascript
Scenario: Add an h5pactivity with download display option
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
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
And I should not see "Rights of use"
And I should not see "Embed"
@javascript
Scenario: Add an h5pactivity with embed display option
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
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
And I should not see "Rights of use"
And I should see "Embed"
@javascript
Scenario: Add an h5pactivity with copyright display option using a content with copyright
Given the following "activity" exists:
| activity | h5pactivity |
| course | C1 |
| name | Awesome H5P package |
| displayoptions | 6 |
| packagefilepath | h5p/tests/fixtures/guess-the-answer.h5p |
And I change window size to "large"
When I am on the "Awesome H5P package" "h5pactivity activity" page
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
And I should see "Rights of use"
And I should not see "Embed"
And I click on "Rights of use" "button" in the ".h5p-actions" "css_element"
And I should see "Fruits"
And I should see "Attribution (CC BY) 4.0 International (CC BY 4.0)"
And I should see "H5P Author"
And I should see "https://h5p.org (Originator)"
And I should see "2000-2023"
And I should see "This is licence extras information added for testing purposes."
And I should see "Add metadata information, Another user, 01-11-23"
@javascript
Scenario: Add an h5pactivity with copyright display option using a content without copyright
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
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
And I should not see "Rights of use"
And I should not see "Embed"
@javascript
Scenario: Add an h5pactivity with all display options enabled
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
Then I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
And I should see "Rights of use"
And I should see "Embed"
@@ -0,0 +1,82 @@
@mod @mod_h5pactivity @core_h5p
Feature: Attempts review settings.
In order to let users to review attempts
As a teacher
I need to have specific settings to let students access the attempts report
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
| teacher2 | Teacher | 2 | teacher2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | teacher |
Scenario Outline: Attempt review behaviour when accessing an H5P activity
Given the following "activity" exists:
| activity | h5pactivity |
| name | H5P package |
| intro | Test H5P description |
| course | C1 |
| idnumber | h5ppackage |
| enabletracking | <enabletracking> |
| reviewmode | <reviewmode> |
And the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | compound | 0 | 2 | 6 | 1 | 0 |
| student1 | H5P package | 2 | compound | 2 | 2 | 4 | 1 | 1 |
| student2 | H5P package | 1 | compound | 1 | 2 | 8 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as <user>
Then "Attempts report" "link" should <attemptsreportlink> in current page administration
And I should <previewmode> "You are in preview mode."
And I should <attempttracking> "Attempt tracking is not enabled for this activity."
And I should <attempttrackingsettings> "You can enable it in Settings."
And I should <viewattempts> "View attempts (3)"
Examples:
| user | enabletracking | reviewmode | attemptsreportlink | previewmode | attempttracking | attempttrackingsettings | viewattempts |
| student1 | 1 | 1 | exist | not see | not see | not see | not see |
| student1 | 1 | 0 | not exist | not see | not see | not see | not see |
| student1 | 0 | 1 | not exist | not see | not see | not see | not see |
| teacher1 | 1 | 1 | exist | see | not see | not see | see |
| teacher1 | 1 | 0 | exist | see | not see | not see | see |
| teacher1 | 0 | 1 | not exist | see | see | see | not see |
| teacher2 | 0 | 1 | not exist | see | see | not see | not see |
| teacher2 | 1 | 1 | exist | see | not see | not see | see |
Scenario: View link behaviour
Given the following "activity" exists:
| activity | h5pactivity |
| name | H5P package |
| intro | Test H5P description |
| course | C1 |
| idnumber | h5ppackage |
| enabletracking | 1 |
| reviewmode | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as teacher1
# The link is displayed with the correct number of attempts (in that case 0 because there are no attempts yet).
Then I should see "View attempts (0)"
Then I follow "View attempts (0)"
And I should not see "View user attempts"
But the following "mod_h5pactivity > attempt" exists:
| user | student1 |
| h5pactivity | H5P package |
| attempt | 1 |
| interactiontype | compound |
| rawscore | 2 |
| maxscore | 2 |
| duration | 4 |
| completion | 1 |
| success | 1 |
And I am on the "H5P package" "h5pactivity activity" page
And I follow "View attempts (1)"
And I should see "View (1)"
@@ -0,0 +1,104 @@
@mod @mod_h5pactivity @core_h5p @_switch_iframe
Feature: Content bank link in the activity settings form
In order to have direct access to the Content bank
As a teacher
I need to see a Content bank link in the activity settings
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
@javascript
Scenario: The content bank link should go to the course Content bank
When I log in as "teacher1"
And I add an h5pactivity activity to course "Course 1" section "1"
Then I should see "Use the content bank (opens in new window) to manage your H5P files"
And I click on "content bank (opens in new window)" "link" in the "General" "fieldset"
And I switch to a second window
And I should see "Content bank" in the "page-content" "region"
And I should see "filltheblanks.h5p" in the "page-content" "region"
And I close all opened windows
@javascript
Scenario: Content bank is not displayed if the user don't have access to the content bank
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:access | Prevent | editingteacher | Course | C1 |
When I log in as "teacher1"
And I add an h5pactivity activity to course "Course 1" section "1"
Then I should not see "Use the content Bank (opens in new window) to manage your H5P files"
@javascript
Scenario: A different message should be displayed if the package file is a link to the content bank file
Given I log in as "admin"
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added with link to content bank |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Content bank" repository in file picker
And I click on "filltheblanks.h5p" "file" in repository content area
And I click on "Link to the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Of which countries are Berlin, Washington, Beijing, Canberra and Brasilia the capitals?"
And I switch to the main frame
When I navigate to "Settings" in current page administration
Then I should not see "Use the content Bank (opens in new window) to manage your H5P files"
And I should see "Access the H5P file in the content bank (opens in a new window)."
And I follow "Access the H5P file in the content bank"
@javascript
Scenario: The content bank link should go to the course Content bank if the file is a copy to a content bank file
Given I log in as "admin"
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added with link to content bank |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Content bank" repository in file picker
And I click on "filltheblanks.h5p" "file" in repository content area
And I click on "Make a copy of the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Of which countries are Berlin,"
And I switch to the main frame
When I navigate to "Settings" in current page administration
Then I should see "Use the content bank (opens in new window) to manage your H5P files"
@javascript
Scenario: The content bank link should go to the course Content bank if the file is referenced but to another repository
Given the following "user private file" exists:
| user | admin |
| filepath | h5p/tests/fixtures/guess-the-answer.h5p |
When I log in as "admin"
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added with link to content bank |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Private files" repository in file picker
And I click on "guess-the-answer.h5p" "file" in repository content area
And I click on "Link to the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Which fruit is this?"
And I switch to the main frame
And I navigate to "Settings" in current page administration
Then I should see "Use the content bank (opens in new window) to manage your H5P files"
@@ -0,0 +1,50 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
Feature: Set up attempt grading options into H5P activity
In order to use automatic grading in H5P activity
As a teacher
I need to be able to configure the attempt settings
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
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 an h5pactivity activity to course "Course 1" section "1"
Scenario: Default values should have tracking and grading
When the field "Type" matches value "Point"
Then the "Grading method" "select" should be enabled
Scenario: Scale grading should not have a grading method.
When I set the following fields to these values:
| Name | Awesome H5P package |
| Type | Scale |
Then the "Grading method" "select" should be disabled
Scenario: None grading should not have a grading method.
When I set the following fields to these values:
| Name | Awesome H5P package |
| Type | None |
Then the "Grading method" "select" should be disabled
Scenario: Point grading should have a grading method.
When I set the following fields to these values:
| Name | Awesome H5P package |
| Type | Point |
Then the "Grading method" "select" should be enabled
Scenario: Disable tracking should make grading method disappear.
When I set the following fields to these values:
| Name | Awesome H5P package |
| Enable attempt tracking | No |
Then "Grading method" "field" should not be visible
@@ -0,0 +1,230 @@
@mod @mod_h5pactivity @core_h5p @core_xapi
Feature: Report different types of interactions.
In order to let users to review attempts
As a user
I need to view all valid interactions in the report
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
# This test is only about reporting, we don't need to specify any valid H5P file for it.
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| h5pactivity | H5P package | Test H5P description | C1 | h5ppackage |
Scenario: General success attempt information
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "2 out of 2"
And I should see "Pass"
And I should see "4 seconds"
And I should see "This attempt is completed"
Scenario: General failed attempt statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "0 out of 2"
And I should see "Fail"
And I should see "4 seconds"
And I should see "This attempt is completed"
Scenario: View a success choice statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | choice | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Select the correct answers"
And "Correct answer" "icon" should exist in the "This is also a correct answer" "table_row"
And I should see "Score: 2 out of 2"
Scenario: View a failed choice statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | choice | 0 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Select the correct answers"
And "Incorrect answer" "icon" should exist in the "Another wrong answer" "table_row"
And I should see "Score: 0 out of 2"
Scenario: View a success matching statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | matching | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Drag and Drop example 1"
And "Your answer is correct" "icon" should exist in the "Drop item A" "table_row"
And I should see "Score: 2 out of 2"
Scenario: View a failed matching statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | matching | 0 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Drag and Drop example 1"
And "Your answer is incorrect" "icon" should exist in the "Drop item A" "table_row"
And I should see "Score: 0 out of 2"
Scenario: View a success true-false statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | true-false | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "The correct answer is true"
And "Correct answer" "icon" should exist in the "True" "table_row"
And I should see "Score: 2 out of 2"
Scenario: View a failed true-false statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | true-false | 0 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "The correct answer is true"
And "Incorrect answer" "icon" should exist in the "False" "table_row"
And I should see "Score: 0 out of 2"
Scenario: View a success fill-in statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | fill-in | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This an example of missing word text"
And "Your answer is correct" "icon" should exist in the "Gap #1" "table_row"
And I should see "first" in the "Gap #1" "table_row"
And "Your answer is correct" "icon" should exist in the "Gap #2" "table_row"
And I should see "second" in the "Gap #2" "table_row"
And I should see "Score: 2 out of 2"
Scenario: View a failed fill-in statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | fill-in | 0 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This an example of missing word text"
And "Your answer is incorrect" "icon" should exist in the "Gap #1" "table_row"
And I should see "first" in the "Gap #1" "table_row"
And I should see "something" in the "Gap #1" "table_row"
And "Your answer is incorrect" "icon" should exist in the "Gap #2" "table_row"
And I should see "second" in the "Gap #2" "table_row"
And I should see "else" in the "Gap #2" "table_row"
And I should see "Score: 0 out of 2"
Scenario: View a success long-fill-in statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | long-fill-in | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Please describe the novel The Hobbit"
And I should see "The Hobbit is book"
# Fill-in does not have a partial scope indicador, we only check the general one.
And I should see "2 out of 2"
Scenario: View a failed long-fill-in statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | long-fill-in | 0 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Please describe the novel The Hobbit"
And I should see "Who cares?"
# Fill-in does not have a partial scope indicador, we only check the general one.
And I should see "0 out of 2"
# The current H5P implementation does not send a complete sequencing interaction statement
# we check only the warning and the final result.
Scenario: View a success sequencing statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | sequencing | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This interaction (sequencing) does not provide tracking information"
# Sequencing does not have a partial scope indicador, we only check the general one.
And I should see "2 out of 2"
# The current H5P implementation does not send a complete sequencing interaction statement
# we check only the warning and the final result.
Scenario: View a failed sequencing statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | sequencing | 2 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This interaction (sequencing) does not provide tracking information"
# Sequencing does not have a partial scope indicador, we only check the general one.
And I should see "0 out of 2"
# The current H5P implementation does not send a complete sequencing interaction statement
# we check only the warning and the final result.
Scenario: View a success other statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | other | 2 | 2 | 1 | 1 | 1 |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This interaction (other) does not provide tracking information"
# Other does not have a partial scope indicador, we only check the general one.
And I should see "2 out of 2"
# The current H5P implementation does not send a complete sequencing interaction statement
# we check only the warning and the final result.
Scenario: View a failed other statement
Given the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | other | 2 | 2 | 1 | 1 | 0 |
| student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 |
When I am on the "H5P package" "h5pactivity activity" page logged in as student1
And I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This interaction (other) does not provide tracking information"
# Other does not have a partial scope indicador, we only check the general one.
And I should see "0 out of 2"
@@ -0,0 +1,40 @@
@mod @mod_h5pactivity
Feature: Duplicate and delete a h5pactivity
In order to quickly create and delete h5p activities
As a teacher
I need to duplicate or delete h5pactivity inside the same course
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: Duplicate and delete h5p activity
Given the following "activities" exist:
| activity | course | name | packagefilepath |
| h5pactivity | C1 | H5P Activity 1 | h5p/tests/fixtures/filltheblanks.h5p |
And I am on the "H5P Activity 1" "h5pactivity activity" page logged in as teacher1
# Initial confirmation that no error occurs when viewing h5p activity
And I should see "You are in preview mode."
And I am on "Course 1" course homepage with editing mode on
# Duplicate the h5p activity
When I duplicate "H5P Activity 1" activity
# Confirm that h5p activity was duplicated successfully
Then I should see "H5P Activity 1 (copy)"
And I am on the "H5P Activity 1 (copy)" "h5pactivity activity" page
# Confirm there are no errors when viewing duplicate h5p activity
And I should see "You are in preview mode."
And I am on the "Course 1" course page
# Delete the duplicate h5p activity
And I delete "H5P Activity 1 (copy)" activity
# Confirm duplicate was deleted successfully
And I should not see "H5P Activity 1 (copy)"
And I am on the "H5P Activity 1" "h5pactivity activity" page
# Confirm there are no errors on the original h5p activity after deleting the duplicate
And I should see "You are in preview mode."
@@ -0,0 +1,153 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
Feature: Change grading options in an H5P activity
In order to let students do a H5P attempt
As a teacher
I need to define what students attempts are used for grading
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
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 the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | Awesome H5P package | 1 | choice | 0 | 1 | 4 | 1 | 0 |
| student1 | Awesome H5P package | 2 | choice | 1 | 1 | 4 | 1 | 1 |
| student1 | Awesome H5P package | 3 | choice | 0 | 1 | 4 | 1 | 0 |
@javascript
Scenario: Default grading is max attempt grade
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
And I expand all fieldsets
And the field "Grading method" matches value "Highest grade"
And I click on "Save and return to course" "button"
When I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | 100.00 | 100.00 % |
@javascript
Scenario: Change setting to first attempt
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | First attempt |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | 0.00 | 0.00 % |
@javascript
Scenario: Change setting to last attempt
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | Last attempt |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | 0.00 | 0.00 % |
@javascript
Scenario: Change setting to average attempt
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | Average grade |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | 33.33 | 33.33 % |
@javascript
Scenario: Change setting to manual grading
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | Don't calculate a grade |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | - | - |
@javascript
Scenario: Disable tracking
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Enable attempt tracking | No |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | - | - |
@javascript
Scenario: Reescale existing grades changing the maximum grade
# First we set to average and recalculate grades.
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | Average grade |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Awesome H5P package | 33.33 | 0100 | 33.33 % |
# Now we modify the maximum grade with rescaling.
And I am on the "Awesome H5P package" "h5pactivity activity editing" page
And I set the following fields to these values:
| Rescale existing grades | Yes |
| Maximum grade | 50 |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Awesome H5P package | 16.67 | 050 | 33.33 % |
@javascript
Scenario: Change maximum grade without rescaling grade
# First we set to average and recalculate grades.
Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1
When I set the following fields to these values:
| Grading method | Average grade |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Awesome H5P package | 33.33 | 0100 | 33.33 % |
# Now we modify the maximum grade with rescaling.
When I am on the "Awesome H5P package" "h5pactivity activity editing" page
And I set the following fields to these values:
| Rescale existing grades | No |
| Maximum grade | 50 |
And I click on "Save and return to course" "button"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Awesome H5P package | 33.33 | 050 | 66.67 % |
@@ -0,0 +1,41 @@
@mod @mod_h5pactivity @core_5hp
Feature: Control H5P activity availability for students
In order to restrict student access to H5P activity
As a teacher
I need to control the availability of the H5P activity
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| h5pactivity | C1 | H5P Test |
@javascript
Scenario Outline: Restrict H5P activity access by date
Given I am on the "H5P Test" "h5pactivity activity editing" page logged in as teacher1
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the following fields to these values:
| Direction | from |
| x[day] | 1 |
| x[month] | 1 |
| x[year] | <year> |
And I press "Save and return to course"
When I am on the "Course 1" course page logged in as student1
Then I <fromvisibility> see "Available from"
Examples:
| year | fromvisibility |
| ## -1 year ## %Y ## | should not |
| ## +1 year ## %Y ## | should |
@@ -0,0 +1,55 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript @core_completion
Feature: View activity completion information in the h5p activity
In order to have visibility of h5p completion requirements
As a student
I need to be able to view my h5p completion progress
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Vinnie | Student1 | student1@example.com |
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | enablecompletion | showcompletionconditions |
| Course 1 | C1 | 1 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
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 change window size to "large"
And 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
# Student view.
When I am on the "Music history" "h5pactivity activity" page logged in as student1
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
Then 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"
Scenario: Use manual completion
Given I am on the "Music history" "h5pactivity activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Students must manually mark the activity as done" to "1"
And I press "Save and display"
# Teacher view.
And I am on the "Music history" "h5pactivity activity" page
And the manual completion button for "Music history" should be disabled
# 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"
And I toggle the manual completion state of "Music history"
And the manual completion button of "Music history" is displayed as "Done"
@@ -0,0 +1,66 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript @core_completion
Feature: Pass grade activity completion information in the h5p activity
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Vinnie | Student1 | student1@example.com |
| student2 | Vinnie | Student2 | student2@example.com |
| student3 | Vinnie | Student3 | student3@example.com |
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| teacher1 | C1 | editingteacher |
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 |
Scenario: View automatic completion items
# Teacher view.
Given I change window size to "large"
And I am on the "Music history" "h5pactivity activity" page logged in as teacher1
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
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 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
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Brasilia"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 2 of 4\")]" to "Washington"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 3 of 4\")]" to "Berlin"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 4 of 4\")]" to "Canberra"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I switch to the main frame
And I reload the page
Then 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 "done"
And I log out
And I am on the "Music history" "h5pactivity activity" page logged in as student1
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 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
@@ -0,0 +1,51 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
Feature: Undeployed H5P activities packages should be available only to any user that can deploy packages.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| teacher2 | Teacher | 2 | teacher2@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
| student1 | C1 | student |
# Make sure that the teacher2 can update libraries so it show the right info when.
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
# Now create the activity as teacher1.
And the following "activities" exist:
| activity | course | name | username | packagefilepath |
| h5pactivity | C1 | Music history | teacher1 | h5p/tests/fixtures/filltheblanks.h5p |
And I log in as "admin"
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I press "Delete" action in the "Teacher 1" report row
And I click on "Delete" "button" in the "Delete user" "dialogue"
And I should see "Deleted user Teacher 1"
@javascript
Scenario: In an H5P activity, as student I should not be able to deploy the package if not deployed by the teacher
beforehand. Then if a second teacher deploys the package, I can see it.
Given I am on the "Music history" "h5pactivity activity" page logged in as student1
And I switch to "h5p-player" class iframe
And "This file can't be displayed because it has been uploaded by a user without the required capability to deploy H5P content" "text" should exist
And I switch to the main frame
And I log out
# Then teacher2 will be allowed to deploy the package.
And I am on the "Music history" "h5pactivity activity" page logged in as teacher2
And I switch to "h5p-player" class iframe
When I switch to "h5p-iframe" class iframe
Then I should see "Of which countries are Berlin"
And I switch to the main frame
And I log out
# Now student1 should be able to see the package.
And I am on the "Music history" "h5pactivity activity" page logged in as student1
And I switch to "h5p-player" class iframe
When I switch to "h5p-iframe" class iframe
Then I should see "Of which countries are Berlin"
@@ -0,0 +1,100 @@
@mod @mod_h5pactivity @core_h5p
Feature: Teacher can control h5p activity grading setting
In order to set h5p activity grade
As a teacher
I need to be able to control h5p activity grading setting
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
| student4 | Student | 4 | student4@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
@javascript
Scenario: Verify that invalid grades given to students are not saved
Given the following "activities" exist:
| activity | name | course |
| h5pactivity | H5P point | C1 |
# Activity grade settings are not saved using generators so manual setting is necessary.
And I am on the "H5P point" "h5pactivity activity editing" page logged in as teacher1
And I set the following fields to these values:
| grade[modgrade_type] | Point |
| grade[modgrade_point] | 10 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
When I give the grade "50" to the user "Student 1" for the grade item "H5P point"
And I press "Save changes"
And I turn editing mode off
# Confirm that grades are not saved when grade entered is > maximum grade.
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Student 1 | student1@example.com | - |
| Student 2 | student2@example.com | - |
| Student 3 | student3@example.com | - |
| Student 4 | student4@example.com | - |
@javascript
Scenario: Verify that valid grades given to students are saved
Given the following "activities" exist:
| activity | name | course |
| h5pactivity | H5P point | C1 |
# Activity grade settings are not saved using generators so manual setting is necessary.
And I am on the "H5P point" "h5pactivity activity editing" page logged in as teacher1
And I set the following fields to these values:
| grade[modgrade_type] | Point |
| grade[modgrade_point] | 10 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
When I give the grade "10" to the user "Student 1" for the grade item "H5P point"
And I give the grade "5" to the user "Student 2" for the grade item "H5P point"
And I give the grade "0" to the user "Student 3" for the grade item "H5P point"
And I press "Save changes"
And I turn editing mode off
# Confirm that corresponding grades are stored for each student.
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Student 1 | student1@example.com | 10 |
| Student 2 | student2@example.com | 5 |
| Student 3 | student3@example.com | 0 |
| Student 4 | student4@example.com | - |
@javascript
Scenario: Verify that scales given to students are saved
Given the following "activities" exist:
| activity | name | course |
| h5pactivity | H5P scale | C1 |
# Activity grade settings are not saved using generators so manual setting is necessary.
And I am on the "H5P scale" "h5pactivity activity editing" page logged in as teacher1
And I set the following fields to these values:
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | Default competence scale |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "Not yet competent" to the user "Student 1" for the grade item "H5P scale"
And I give the grade "Competent" to the user "Student 2" for the grade item "H5P scale"
And I give the grade "Competent" to the user "Student 4" for the grade item "H5P scale"
When I press "Save changes"
And I turn editing mode off
# Confirm that scale set for student is successfully saved.
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Student 1 | student1@example.com | Not yet competent |
| Student 2 | student2@example.com | Competent |
| Student 3 | student3@example.com | - |
| Student 4 | student4@example.com | Competent |
@@ -0,0 +1,51 @@
@mod @mod_h5pactivity @core_h5p
Feature: Teacher can reset H5P activity grades
As a teacher,
I should be able to reset H5P activity grades
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | One | teacher1@example.com |
| student1 | First | Student | student1@example.com |
| student2 | Second | Student | student2@example.com |
| student3 | Third | Student | student3@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | course | name | grade[modgrade_type] | grade[modgrade_point] |
| h5pactivity | C1 | H5P Activity | point | 10 |
@javascript
Scenario:Teacher can reset H5P activity grades
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "7" to the user "First Student" for the grade item "H5P Activity"
And I give the grade "5" to the user "Second Student" for the grade item "H5P Activity"
And I give the grade "0" to the user "Third Student" for the grade item "H5P Activity"
And I press "Save changes"
# Confirm that grade was sucessfully saved
And I turn editing mode off
And I should see "7.00" in the "First Student" "table_row"
And I should see "5.00" in the "Second Student" "table_row"
And I should see "0.00" in the "Third Student" "table_row"
When I am on the "Course 1" "reset" page
And I expand all fieldsets
# Check `Delete all grades` in course reset page to reset grades
And I click on "Delete all grades" "checkbox"
And I press "Reset"
Then I should see "OK" in the "Gradebook" "table_row"
And I press "Continue"
# Confirm that previously saved grades are gone
And I navigate to "View > Grader report" in the course gradebook
And I should not see "7.00" in the "First Student" "table_row"
And I should not see "5.00" in the "Second Student" "table_row"
And I should not see "0.00" in the "Third Student" "table_row"
@@ -0,0 +1,194 @@
@mod @mod_h5pactivity @core_h5p @_switch_iframe
Feature: Inline editing H5P content
In order to edit an existing H5P activity file
As a teacher
I need to see the button and access to the H5P editor
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| teacher2 | Teacher | 2 | teacher2@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
| student1 | C1 | student |
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
@javascript
Scenario: Add H5P activity using link to content bank file
Given the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | teacher1 | Greeting card | /h5p/tests/fixtures/greeting-card.h5p |
And I log in as "admin"
# Add the navigation block.
And I am on "Course 1" course homepage with editing mode on
And the following config values are set as admin:
| unaddableblocks | | theme_boost|
And I add the "Navigation" block if not present
# Create an H5P activity with a link to the content-bank file.
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added as link to content bank |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Content bank" repository in file picker
And I click on "Greeting card" "file" in repository content area
And I click on "Link to the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Hello world!"
And I switch to the main frame
# Modify the H5P content using the edit button (which opens the H5P editor).
And I follow "Edit H5P content"
And I should see "This content may be in use in other places."
And I switch to "h5p-editor-iframe" class iframe
And I set the field "Greeting text" to "It's a Wonderful Life!"
And I switch to the main frame
And I click on "Save changes" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
# Check the H5P content has changed.
And I should not see "Hello world!"
And I should see "It's a Wonderful Life!"
And I switch to the main frame
# Check the H5P has also changed into the content bank.
And I am on "Course 1" course homepage
And I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I click on "Greeting card" "link"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should not see "Hello world!"
And I should see "It's a Wonderful Life!"
And I switch to the main frame
And I log out
# Check teacher1 can see the Edit button (because she is the author of this file in the content bank).
And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher1
And I should see "Edit H5P content"
And I log out
# Check teacher2 can't see the Edit button (because the file was created by the teacher1).
When I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher2
Then I should not see "Edit H5P content"
And I log out
# Check student1 can't see the Edit button.
And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as student1
And I should not see "Edit H5P content"
@javascript
Scenario: Add H5P activity using copy to content bank file
Given the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p |
And I log in as "admin"
# Add the navigation block.
And I am on "Course 1" course homepage with editing mode on
And the following config values are set as admin:
| unaddableblocks | | theme_boost|
And I add the "Navigation" block if not present
# Create an H5P activity with a copy to the content-bank file.
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added as copy to content bank |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Content bank" repository in file picker
And I click on "Greeting card" "file" in repository content area
And I click on "Make a copy of the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Hello world!"
And I switch to the main frame
# Modify the H5P content using the edit button (which opens the H5P editor).
And I follow "Edit H5P content"
And I should not see "This content may be in use in other places."
And I switch to "h5p-editor-iframe" class iframe
And I set the field "Greeting text" to "The nightmare before Christmas"
And I switch to the main frame
And I click on "Save changes" "button"
# Check the H5P content has changed.
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should not see "Hello world!"
And I should see "The nightmare before Christmas"
And I switch to the main frame
# Check the H5P has also changed into the content bank.
And I am on "Course 1" course homepage
And I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I click on "Greeting card" "link"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Hello world!"
And I should not see "The nightmare before Christmas"
And I switch to the main frame
And I log out
# Check teacher1 can see the Edit button (because the file is a copy).
And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher1
And I should see "Edit H5P content"
And I log out
# Check teacher2 can also see the Edit button (because the file is a copy).
When I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher2
Then I should see "Edit H5P content"
And I log out
# Check student1 can't see the Edit button.
And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as student1
And I should not see "Edit H5P content"
@javascript
Scenario: Add H5P activity using private user file
Given the following "user private file" exists:
| user | teacher1 |
| filepath | h5p/tests/fixtures/greeting-card.h5p |
# Create an H5P activity with a private user file.
When I log in as "teacher1"
And I add an h5pactivity activity to course "Course 1" section "1"
And I set the following fields to these values:
| Name | H5P package added as private user file |
| Description | Description |
And I click on "Add..." "button" in the "Package file" "form_row"
And I select "Private files" repository in file picker
And I click on "greeting-card.h5p" "file" in repository content area
And I click on "Link to the file" "radio"
And I click on "Select this file" "button"
And I click on "Save and display" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Hello world!"
And I switch to the main frame
# Modify the H5P content using the edit button (which opens the H5P editor).
And I follow "Edit H5P content"
And I should see "This content may be in use in other places."
And I switch to "h5p-editor-iframe" class iframe
And I set the field "Greeting text" to "Little women"
And I switch to the main frame
And I click on "Save changes" "button"
# Check the H5P content has changed.
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should not see "Hello world!"
And I should see "Little women"
And I switch to the main frame
And I log out
# Check admin can't see the Edit button (because the file belongs to teacher1).
And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as admin
And I should not see "Edit H5P content"
And I log out
# Check teacher2 can't see the Edit button (because the file belongs to teacher1).
When I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as teacher2
Then I should not see "Edit H5P content"
And I log out
# Check student1 can't see the Edit button.
And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as student1
And I should not see "Edit H5P content"
@@ -0,0 +1,95 @@
@mod @mod_h5pactivity @core_h5p
Feature: Add H5P activity context locking
In order to let users access a H5P attempts
As a user
I need to access attempts reports even if no more users can submit attempts
Background:
Given the following config values are set as admin:
| contextlocking | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
# This test is only about reporting, we don't need to specify any valid H5P file for it.
And the following "activity" exists:
| activity | h5pactivity |
| name | H5P package |
| intro | Test H5P description |
| course | C1 |
| idnumber | h5ppackage |
And the following "mod_h5pactivity > attempt" exists:
| user | student1 |
| h5pactivity | H5P package |
| attempt | 1 |
| interactiontype | compound |
| rawscore | 2 |
| maxscore | 2 |
| duration | 4 |
| completion | 1 |
| success | 1 |
Scenario: Access participants report on a freeze context
Given the "h5ppackage" "Activity module" is context frozen
And I am on the "H5P package" "h5pactivity activity" page logged in as admin
When I navigate to "Attempts report" in current page administration
Then I should see "Student 1"
And I should see "View (1)" in the "Student 1" "table_row"
And I should see "Student 2"
And I should not see "Teacher 1"
Scenario: Access own attempts on a freeze context
Given the "h5ppackage" "Activity module" is context frozen
And I am on the "H5P package" "h5pactivity activity" page logged in as student1
When I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Attempt #1: Student 1"
And I should see "This attempt is completed"
Scenario: Access participants report without any user with submit capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/h5pactivity:submit | Prohibit | student | System | |
And I am on the "H5P package" "h5pactivity activity" page logged in as admin
When I navigate to "Attempts report" in current page administration
Then I should see "Student 1"
And I should see "View (1)" in the "Student 1" "table_row"
And I should see "Student 2"
And I should not see "Teacher 1"
Scenario: Access participant report to list students with submit capability but no view one
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/h5pactivity:view | Prohibit | student | System | |
And I am on the "H5P package" "h5pactivity activity" page logged in as admin
When I navigate to "Attempts report" in current page administration
Then I should see "No participants to display"
Scenario: Access participant report but with no users with view or submit capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/h5pactivity:submit | Prohibit | student | System | |
| mod/h5pactivity:view | Prohibit | student | System | |
And I am on the "H5P package" "h5pactivity activity" page logged in as admin
When I navigate to "Attempts report" in current page administration
Then I should see "No participants to display"
Scenario: Access participant report in a hidden activity
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I click on "Hide" "link" in the "H5P package" activity
When I am on the "H5P package" "h5pactivity activity" page
And I navigate to "Attempts report" in current page administration
Then I should see "Student 1"
And I should see "View (1)"
And I should see "Student 2"
And I should not see "Teacher 1"
@@ -0,0 +1,69 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
Feature: Users can see the H5P recent activity from the recent activity block
In order to quickly see the updates from H5P activity in my course
As a user
I need to be able to see the recent activity in the recent activity block
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
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 the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| recent_activity | Course | C1 | course-view-* | side-pre |
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
# The H5P content needs some time to be displayed (so better to wait for 1 second to avoid random errors).
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
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 am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2
# The H5P content needs some time to be displayed (so better to wait for 1 second to avoid random errors).
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I click on "Correct 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
Scenario: Student see only his own activity
Given I am on the "Course 1" course page logged in as student1
And I should see "H5P submitted:" in the "Recent activity" "block"
And I should see "Student 1" in the "Recent activity" "block"
And I should not see "Grade:" in the "Recent activity" "block"
And I should not see "Student 2" in the "Recent activity" "block"
When I click on "Full report of recent activity" "link"
Then I should see "H5P Awesome H5P package"
And I should see "Student 1 - "
And I should not see "Grade:"
And I should not see "Student 2 - "
Scenario: Teacher see each student activity
Given I am on the "Course 1" course page logged in as teacher1
And I should see "H5P submitted:" in the "Recent activity" "block"
And I should see "Student 1" in the "Recent activity" "block"
And I should not see "Grade:" in the "Recent activity" "block"
And I should see "Student 2" in the "Recent activity" "block"
When I click on "Full report of recent activity" "link"
Then I should see "H5P Awesome H5P package"
And I should see "Student 1 - "
And I should see "Grade:"
And I should see "Student 2 - "
@@ -0,0 +1,39 @@
@mod @mod_h5pactivity @core_h5p
Feature: Reporting information in the h5p activity
In order to let teachers view a report on the attempts made in the h5p activity
As a teacher
I can access the report page and see the attempts made by the students
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
# This test is only about reporting, we don't need to specify any valid H5P file for it.
And the following "activity" exists:
| activity | h5pactivity |
| name | H5P package |
| intro | Test H5P description |
| course | C1 |
| idnumber | h5ppackage |
And the following "mod_h5pactivity > attempts" exist:
| user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success |
| student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 |
| student2 | H5P package | 1 | choice | 2 | 2 | 4 | 1 | 1 |
| student1 | H5P package | 2 | compound | 2 | 2 | 4 | 1 | 1 |
Scenario: Access the report page and check the label for the attempts and attempt headers
Given I am on the "H5P package" "h5pactivity activity" page logged in as teacher1
When I navigate to "Attempts report" in current page administration
Then I should see "View (2)" in the "Student 1" "table_row"
And I should see "View (1)" in the "Student 2" "table_row"
And I should see "Attempts (3)" in the "table" "table"
@@ -0,0 +1,49 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
Feature: View fill the blanks attempt report
In order to let users to review a fill the blanks attempt
As a user
I need to view fill in interactions in the report
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
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
# Do an attempt.
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Brigadoon"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 2 of 4\")]" to "Emerald city"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 3 of 4\")]" to "Narnia"
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 4 of 4\")]" to "Canberra"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I switch to the main frame
And I reload the page
# Check attempt.
When I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "Of which countries are Berlin, Washington, Beijing, Canberra and Brasilia the capitals?"
And I should see "Brigadoon" in the "Brasilia" "table_row"
And "Your answer is incorrect" "icon" should exist in the "Brasilia" "table_row"
And I should see "Emerald city" in the "Washington" "table_row"
And I should see "Narnia" in the "Berlin" "table_row"
And "Your answer is incorrect" "icon" should exist in the "Berlin" "table_row"
And "Your answer is correct" "icon" should exist in the "Canberra" "table_row"
And I should not see "<p>"
@@ -0,0 +1,41 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
Feature: View essay attempt report
In order to let users to review an essay attempt
As a user
I need to view long fill in interactions in the report
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
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.
Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I change window size to "large"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I set the field with xpath "//textarea" to "This is a smurfing smurf"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I switch to the main frame
And I reload the page
# Check attempt.
When I navigate to "Attempts report" in current page administration
And I follow "View report"
Then I should see "This is a smurfing smurf"
And I should not see "<strong>smurf</strong>"
@@ -0,0 +1,160 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
Feature: Users can save the current state of an H5P activity
In order to continue an H5P activity where I left
As a user
I need to be able to save the current state
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| teacher1 | C1 | editingteacher |
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/filltheblanks.h5p |
Scenario: Content state is not saved when enablesavestate is disabled
Given the following config values are set as admin:
| enablesavestate | 0 | mod_h5pactivity|
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
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I switch to the main frame
And I am on the "Course 1" course page
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
Scenario: Content state is saved when enablesavestate is enabled
Given the following config values are set as admin:
| enablesavestate | 1 | mod_h5pactivity|
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
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I switch to the main frame
And I am on the "Course 1" course page
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
Scenario: Content state is not saved for teachers when enablesavestate is enabled
Given the following config values are set as admin:
| enablesavestate | 1 | mod_h5pactivity|
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I switch to the main frame
And I am on the "Course 1" course page
When I am on the "Awesome H5P package" "h5pactivity activity" page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
Scenario: Content state is reseted when content changes
Given the following config values are set as admin:
| enablesavestate | 1 | mod_h5pactivity|
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
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I switch to the main frame
And I am on the "Course 1" course page
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as admin
# Change the content.
And I follow "Edit H5P content"
And I switch to "h5p-editor-iframe" class iframe
And I set the field "Title" to "Capitals"
And I switch to the main frame
And I click on "Save changes" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Check"
# Check the content state has been reseted.
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
Then I should see "Data Reset"
And I should see "This content has changed since you last used it."
And I click on "OK" "button"
And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
Scenario: Content state is not reseted when content edition is cancelled
Given the following config values are set as admin:
| enablesavestate | 1 | mod_h5pactivity|
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
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I switch to the main frame
And I am on the "Course 1" course page
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as admin
# Start content edition.
And I follow "Edit H5P content"
And I switch to "h5p-editor-iframe" class iframe
And I set the field "Title" to "Capitals"
And I switch to the main frame
And I click on "Cancel" "button"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Check"
# Check the content state hasn't been reseted.
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I should see "Awesome H5P package"
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
Then I should not see "Data Reset"
And I should not see "This content has changed since you last used it."
And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
Scenario: Content state is removed when an attempt is created
Given the following config values are set as admin:
| enablesavestate | 1 | mod_h5pactivity|
# Save state content for student2, to check this data is not removed when student1 finishes their attempt.
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Vallhonesta"
# Confirm the content state has been saved properly.
And I reload the page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Vallhonesta"
# Create an attempt for student1.
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I should not see "Attempts report"
When I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
And I click on "Check" "button"
# Check the state content has been removed.
And I reload the page
Then I should see "Attempts report"
And I am on the "Awesome H5P package" "h5pactivity activity" page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
And I switch to the main frame
# Check the state content for student2 is still there.
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Vallhonesta"
@@ -0,0 +1,86 @@
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
Feature: Do a H5P attempt
In order to let students do a H5P attempt
As a teacher
I need to list students attempts on various reports
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
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 |
| grademethod | 2 |
Scenario: View an H5P as a teacher
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1
Then I should see "You are in preview mode."
@javascript
Scenario: Do an attempt and check on course log report
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I should not see "You are in preview mode."
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
And I click on "Correct 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 am on the "Course 1" course page logged in as teacher1
And I navigate to course participants
And I follow "Student 1"
Then I follow "Today's logs"
And I should see "xAPI statement received"
@javascript
Scenario: Do various attempts and check them with the attempts and user grades reports
Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I should not see "You are in preview mode."
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
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 click on "Retry" "button" in the ".h5p-question-buttons" "css_element"
# We need to wait 1 second here because, in very quick environments, the 2nd
# attempts happen too close to the 1st one and it's not sent properly. See MDL-76010.
And I wait "1" seconds
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
# H5P does not allow to Retry if the user checks the correct answer, we need to refresh the page.
And I switch to the main frame
And I reload the page
And I switch to "h5p-player" class iframe
And I switch to "h5p-iframe" class iframe
# Because of the steps above, the 2nd and 3rd attempts are enough "separated" and we don't
# need to add any wait here.
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 click on "Retry" "button" in the ".h5p-question-buttons" "css_element"
# Again, the wait between 3rd and 4th attempt, to separate them a little bit.
And I wait "1" seconds
And I click on "Correct 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
When I navigate to "Attempts report" in current page administration
And "1" row "Score" column of "table" table should contain "0"
And "2" row "Score" column of "table" table should contain "1"
And "3" row "Score" column of "table" table should contain "0"
And "4" row "Score" column of "table" table should contain "1"
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
| Awesome H5P package | 50.00 | 50.00 % |