Skip to content

Commit

Permalink
MDL-69331 core_h5p: Add missing library files to behat tests
Browse files Browse the repository at this point in the history
Some of the pre-existing behat tests were creating content into the
content bank using the generator but the H5P content-type libraries
weren't uploaded.
Since MDL-69331, libraries need to be deployed previously (so fake
H5P content-type won't be displayed if these libraries don't exist).
  • Loading branch information
sarjona committed Apr 15, 2021
1 parent 39fa45e commit f3d43c7
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 43 deletions.
13 changes: 9 additions & 4 deletions backup/util/ui/tests/behat/import_contentbank_content.feature
@@ -1,11 +1,15 @@
@core @core_backup @core_contentbank
@core @core_backup @core_contentbank @_file_upload @javascript
Feature: Import course content bank content
In order to import content from a course contentbank
As a teacher
I need to confirm that errors will not happen

Background:
Given the following "courses" exist:
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
Expand All @@ -17,8 +21,9 @@ Feature: Import course content bank content
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| Course | C1 | contenttype_h5p | teacher1 | ipsums.h5p |
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | teacher1 | ipsums.h5p | /h5p/tests/fixtures/ipsums.h5p |
And I log out
And I log in as "teacher1"

Scenario: Import content bank content to another course
Expand Down
15 changes: 10 additions & 5 deletions contentbank/contenttype/h5p/tests/behat/manage_content.feature
Expand Up @@ -5,7 +5,13 @@ Feature: Manage H5P content from the content bank
I need to be able to edit any H5P content in the content bank

Background:
Given the following "users" exist:
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
Expand All @@ -15,10 +21,9 @@ Feature: Manage H5P content from the content bank
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| Course | C1 | contenttype_h5p | admin | filltheblanks.h5p |
| Course | C1 | contenttype_h5p | teacher1 | ipsums.h5p |
And I log in as "admin"
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| Course | C1 | contenttype_h5p | teacher1 | ipsums.h5p | /h5p/tests/fixtures/ipsums.h5p |
And I am on "Course 1" course homepage with editing mode on
And I add the "Navigation" block if not present
And I log out
Expand Down
Expand Up @@ -5,7 +5,13 @@ Feature: Replace H5P file from an existing content requires special capabilities
I need to be able to replace the content only if certain capabilities are allowed

Background:
Given the following "users" exist:
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "categories" exist:
Expand All @@ -21,6 +27,7 @@ Feature: Replace H5P file from an existing content requires special capabilities
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | admincontent | /h5p/tests/fixtures/ipsums.h5p |
| Course | C1 | contenttype_h5p | teacher1 | teachercontent | /h5p/tests/fixtures/filltheblanks.h5p |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Navigation" block if not present
Expand Down
Expand Up @@ -37,7 +37,14 @@ Feature: H5P file upload to content bank for non admins
Then I should see "Content bank"

Scenario: Teachers can upload .h5p extension files to course content bank
Given I am on "Course 1" course homepage with editing mode on
Given I log out
And I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Navigation" block if not present
When I expand "Site pages" node
And I click on "Content bank" "link"
Expand All @@ -52,7 +59,14 @@ Feature: H5P file upload to content bank for non admins
And I should see "filltheblanks.h5p"

Scenario: Other teachers can see uploaded H5P contents
Given I am on "Course 1" course homepage with editing mode on
Given I log out
And I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Navigation" block if not present
When I expand "Site pages" node
And I click on "Content bank" "link"
Expand Down
7 changes: 6 additions & 1 deletion contentbank/tests/behat/edit_content.feature
Expand Up @@ -117,7 +117,12 @@ Feature: Content bank use editor feature
Then the field "Title" matches value "New title"

Scenario: Teachers can edit their own content in the content bank
Given the following "users" exist:
Given I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
Expand Down
12 changes: 8 additions & 4 deletions contentbank/tests/behat/events.feature
Expand Up @@ -5,14 +5,18 @@ Feature: Confirm content bank events are triggered
I need to be able to check triggered events

Background:
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| Course | C1 | contenttype_h5p | admin | Existing |
And I log in as "admin"
And I follow "Manage private files..."
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | Existing | /h5p/tests/fixtures/filltheblanks.h5p |
And I am on site homepage
And I follow "Private files"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on "Course 1" course homepage with editing mode on
Expand Down
27 changes: 15 additions & 12 deletions contentbank/tests/behat/search_content.feature
Expand Up @@ -5,20 +5,23 @@ Feature: Search content in the content bank
I need to be able to search content in the content bank

Background:
Given the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| System | | contenttype_h5p | admin | santjordi.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p |
| System | | contenttype_h5p | admin | SantJordi_book |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p |
| System | | contenttype_h5p | admin | princess.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p |
| System | | contenttype_h5p | admin | historybook.h5p |
| System | | contenttype_h5p | admin | santvicenc.h5p |
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname | filepath |
| System | | contenttype_h5p | admin | santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | SantJordi_book | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | princess.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | historybook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | santvicenc.h5p | /h5p/tests/fixtures/filltheblanks.h5p |

Scenario: Admins can search content in the content bank
Given I log in as "admin"
And I am on site homepage
Given I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I expand "Site pages" node
Expand Down
28 changes: 15 additions & 13 deletions contentbank/tests/behat/sort_content.feature
@@ -1,28 +1,31 @@
@core @core_contentbank @contentbank_h5p @javascript
@core @core_contentbank @contentbank_h5p @_file_upload @javascript
Feature: Sort content in the content bank
In order to temporarily organise the content of the content bank
As an admin
I need to be able to sort the content bank in various ways

Background:
Given the following "users" exist:
Given I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
And the following "users" exist:
| username | firstname | lastname | email |
| manager | Max | Manager | man@example.com |
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| manager | manager | System | |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p |
| System | | contenttype_h5p | manager | historybook.h5p |
| System | | contenttype_h5p | admin | santjordi.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p |
| System | | contenttype_h5p | admin | SantJordi_book |
| contextlevel | reference | contenttype | user | contentname | filepath |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | manager | historybook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| System | | contenttype_h5p | admin | SantJordi_book | /h5p/tests/fixtures/filltheblanks.h5p |

Scenario: Admins can order content in the content bank
Given I log in as "admin"
And I am on site homepage
Given I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I expand "Site pages" node
Expand All @@ -38,8 +41,7 @@ Feature: Sort content in the content bank
Then "santjordi_rose.h5p" "text" should appear before "SantJordi_book" "text"

Scenario: Admins can order content depending on the author
Given I log in as "admin"
And I am on site homepage
Given I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I expand "Site pages" node
Expand Down
5 changes: 4 additions & 1 deletion contentbank/tests/behat/visibility.feature
@@ -1,4 +1,4 @@
@core @core_contentbank @contentbank_h5p @javascript
@core @core_contentbank @contentbank_h5p @_file_upload @javascript
Feature: Make content public or unlisted
In order to make content public or unlisted
As a user
Expand All @@ -13,6 +13,9 @@ Feature: Make content public or unlisted
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"

Scenario: Users can make their content public or unlisted
Given the following "contentbank content" exist:
Expand Down

0 comments on commit f3d43c7

Please sign in to comment.