MDL-66405 core_h5p: Fix behat tests

This commit is contained in:
Sara Arjona
2019-11-11 12:01:47 +01:00
parent 3ab419ad5a
commit 9bb296deb0
2 changed files with 93 additions and 5 deletions
@@ -17,6 +17,7 @@ Feature: Render H5P content using filters
And the following "activities" exist:
| activity | name | intro | introformat | course | content | contentformat | idnumber |
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
| page | PageName2 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
And the "displayh5p" filter is "on"
@javascript
@@ -43,8 +44,8 @@ Feature: Render H5P content using filters
Then ".h5p-iframe" "css_element" should not exist
@javascript
Scenario: Render a server H5P file
Given I log in as "teacher1"
Scenario: Render a local H5P file as admin
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "File" to section "1"
And I set the following fields to these values:
@@ -78,3 +79,90 @@ Feature: Render H5P content using filters
And I switch to "h5p-iframe" class iframe
And I should not see "you don't have access"
And I should see "Lorum ipsum"
@javascript
Scenario: Render a local H5P file as teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "File" to section "1"
And I set the following fields to these values:
| Name | ipsumFile |
And I upload "filter/displayh5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
And I click on "ipsumFile (File)" "link"
And I click on "ipsums.h5p" "link"
And I click on "Select this file" "button"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
And I wait until the page is ready
When I click on "Save and display" "button"
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
Then I should see "Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries."
And I should see "missing-required-library"
@javascript
Scenario: Render a local H5P file with existing libraries
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "File" to section "1"
And I set the following fields to these values:
| Name | ipsumFileTeacher |
And I upload "filter/displayh5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
And I click on "ipsumFileTeacher (File)" "link"
And I click on "ipsums.h5p" "link"
And I click on "Select this file" "button"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
And I wait until the page is ready
And I click on "Save and display" "button"
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
# Libraries don't exist, so an error should be displayed.
And I should see "missing-required-library"
And I switch to the main frame
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "File" to section "1"
And I set the following fields to these values:
| Name | ipsumFile |
And I upload "filter/displayh5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName2"
And I navigate to "Edit settings" in current page administration
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
And I click on "ipsumFile (File)" "link"
And I click on "ipsums.h5p" "link"
And I click on "Select this file" "button"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
And I wait until the page is ready
And I click on "Save and display" "button"
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
# Switch to iframe created by embed.php page
And I switch to "h5p-iframe" class iframe
# Libraries have been installed.
And I should see "Lorum ipsum"
And I switch to the main frame
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
# Switch to iframe created by embed.php page
And I switch to "h5p-iframe" class iframe
Then I should not see "missing-required-library"
And I should see "Lorum ipsum"
@@ -101,7 +101,7 @@ Feature: Add h5ps to Atto
@javascript
Scenario: Edit H5P content
Given I log in as "teacher1"
Given I log in as "admin"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/drag.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
@@ -136,7 +136,7 @@ Feature: Add h5ps to Atto
@javascript
Scenario: Enable/disable H5P options
Given I log in as "teacher1"
Given I log in as "admin"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
@@ -200,7 +200,7 @@ Feature: Add h5ps to Atto
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And I log in as "teacher1"
And I log in as "admin"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
And I click on "Save changes" "button"