From 70e47fdc2aef192e0da47b543e8c8b46dadc8a62 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 5 Dec 2019 15:00:46 +0100 Subject: [PATCH] MDL-67464 core_h5p: use h5p.com URLs in behat tests The H5P content used in behat for validating external URLs behaviour shouldn't point h5p.org because it may stop working (it's not for real content). These content have been moved to moodle.h5p.com (payment account). Besides, the scenarios loading content from external URLs have been labelel with @external. --- .../displayh5p/tests/behat/h5p_filter.feature | 9 ++++++--- .../atto/plugins/h5p/tests/behat/h5p.feature | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/filter/displayh5p/tests/behat/h5p_filter.feature b/filter/displayh5p/tests/behat/h5p_filter.feature index 97c56fb9ae5..ff62186664f 100644 --- a/filter/displayh5p/tests/behat/h5p_filter.feature +++ b/filter/displayh5p/tests/behat/h5p_filter.feature @@ -19,14 +19,16 @@ Feature: Render H5P content using filters | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | | page | PageName2 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | And the "displayh5p" filter is "on" + And the following config values are set as admin: + | allowedsources | https://moodle.h5p.com/content/[id]/embed | filter_displayh5p | - @javascript + @javascript @external Scenario: Render an external H5P content URL. Given I log in as "teacher1" And I am on "Course 1" course homepage And I follow "PageName1" And I navigate to "Edit settings" in current page administration - And I set the field "Page content" to "
Go for it
https://h5p.org/h5p/embed/576651" + And I set the field "Page content" to "
Go for it
https://moodle.h5p.com/content/1290772960722742119/embed" When I click on "Save and display" "button" And I wait until the page is ready And I switch to "h5p-iframe" class iframe @@ -38,7 +40,8 @@ Feature: Render H5P content using filters And I am on "Course 1" course homepage And I follow "PageName1" And I navigate to "Edit settings" in current page administration - And I set the field "Page content" to "Go to https://h5p.org/h5p/embed/576651" +# This content won't be displayed, so this scenario shouldn't be labeled as external. + And I set the field "Page content" to "Go to https://moodle.h5p.com/content/1290772960722742119/embed" When I click on "Save and display" "button" And I wait until the page is ready Then ".h5p-iframe" "css_element" should not exist diff --git a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature index 452912c0249..4ea2e13b538 100644 --- a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature +++ b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature @@ -16,8 +16,10 @@ Feature: Add h5ps to Atto | activity | name | intro | introformat | course | content | contentformat | idnumber | | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | And the "displayh5p" filter is "on" + And the following config values are set as admin: + | allowedsources | https://moodle.h5p.com/content/[id]/embed | filter_displayh5p | - @javascript + @javascript @external Scenario: Insert an embedded h5p Given I log in as "admin" And I change window size to "large" @@ -25,11 +27,14 @@ Feature: Add h5ps to Atto 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 set the field with xpath "//textarea[@data-region='h5purl']" to "https://h5p.org/h5p/embed/576651" + And I set the field with xpath "//textarea[@data-region='h5purl']" to "https://moodle.h5p.com/content/1290772960722742119/embed" 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" Then ".h5p-placeholder" "css_element" should exist + And I wait until the page is ready + And I switch to "h5pcontent" iframe + And I should see "Lorum ipsum" @javascript Scenario: Insert an h5p file @@ -58,7 +63,8 @@ Feature: Add h5ps to Atto 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 set the field with xpath "//textarea[@data-region='h5purl']" to "ftp://h5p.org/h5p/embed/576651" +# This is not a real external URL, so this scenario shouldn't be labeled as external. + And I set the field with xpath "//textarea[@data-region='h5purl']" to "ftp://moodle.h5p.com/content/1290772960722742119/embed" When I click on "Insert H5P" "button" in the "Insert H5P" "dialogue" And I wait until the page is ready Then I should see "Invalid URL" in the "Insert H5P" "dialogue" @@ -99,7 +105,7 @@ Feature: Add h5ps to Atto And I click on "Insert H5P" "button" Then I should not see "H5P file upload" in the "Insert H5P" "dialogue" - @javascript + @javascript @external Scenario: Edit H5P content Given I log in as "admin" And I follow "Manage private files..." @@ -126,10 +132,11 @@ Feature: Add h5ps to Atto And I click on ".h5p-placeholder" "css_element" And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" # External URL - And I set the field with xpath "//textarea[@data-region='h5purl']" to "https://h5p.org/h5p/embed/576651" + And I set the field with xpath "//textarea[@data-region='h5purl']" to "https://moodle.h5p.com/content/1290772960722742119/embed" 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" + And I wait until the page is ready And I switch to "h5pcontent" iframe And I should see "Lorum ipsum" And I should not see "Cloudberries"