From de6cd6766ca14ec5cee2dfdfc0121b05e1113716 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 21 Oct 2025 14:23:20 +0800 Subject: [PATCH] MDL-86908 core_contentbank: Behat to set supported files of contentbank --- .../tests/behat/admin_upload_content.feature | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/public/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature b/public/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature index b4a74c2672d..f4d6e7a7261 100644 --- a/public/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature +++ b/public/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature @@ -1,4 +1,4 @@ -@core @core_contentbank @core_h5p @contenttype_h5p @_switch_iframe @javascript +@core @core_contentbank @core_h5p @contenttype_h5p @_switch_iframe Feature: H5P file upload to content bank for admins In order import new H5P content to content bank As an admin @@ -16,6 +16,7 @@ Feature: H5P file upload to content bank for admins And I expand "Site pages" node And I click on "Content bank" "link" + @javascript Scenario: Admins can upload .h5p extension files to content bank Given I should not see "filltheblanks.h5p" When I click on "Upload" "link" @@ -27,6 +28,7 @@ Feature: H5P file upload to content bank for admins And I wait until the page is ready Then I should see "filltheblanks.h5p" + @javascript Scenario: Admins can see uploaded H5P contents Given I should not see "filltheblanks.h5p" When I click on "Upload" "link" @@ -40,6 +42,7 @@ Feature: H5P file upload to content bank for admins And I switch to "h5p-iframe" class iframe Then I should see "Of which countries" + @javascript Scenario: Users can't see content managed by disabled plugins Given I click on "Upload" "link" And I click on "Choose a file..." "button" @@ -55,6 +58,7 @@ Feature: H5P file upload to content bank for admins When I navigate to "Plugins > Content bank" in site administration Then I should not see "filltheblanks.h5p" + @javascript Scenario: Contents in a context are not available from other contexts Given the following "courses" exist: | fullname | shortname | category | @@ -75,6 +79,7 @@ Feature: H5P file upload to content bank for admins And I click on "Content bank" "link" And I should not see "filltheblanks.h5p" + @javascript Scenario: Admins can upload and deployed content types when libraries are not installed Given I navigate to "H5P > Manage H5P content types" in site administration And I should not see "Fill in the Blanks" @@ -95,6 +100,7 @@ Feature: H5P file upload to content bank for admins And I navigate to "H5P > Manage H5P content types" in site administration And I should see "Fill in the Blanks" + @javascript Scenario: Uploading invalid packages throws error Given the following "user private files" exist: | user | filepath | @@ -122,3 +128,28 @@ Feature: H5P file upload to content bank for admins And I wait until the page is ready And I should see "It is not possible to unzip it" And I should not see "Sorry, this file is not valid" + + @_file_upload @javascript + Scenario: Uploading invalid file types is not allowed + Given I am on the "Content bank" page logged in as "admin" + When I click on "Upload" "link" + And I click on "Choose a file..." "button" + And I click on "Upload a file" "link" in the ".fp-repo-area" "css_element" + And I set the field "Attachment" to "#dirroot#/lib/tests/fixtures/1.jpg" + And I press "Upload this file" + # Confirm that jpg files cannot be added to content bank. + Then "Image (JPEG) filetype cannot be accepted." "text" should exist + And I click on "OK" "button" in the "Error" "dialogue" + And I click on "Close" "button" in the "File picker" "dialogue" + And I click on "Cancel" "button" in the "Upload" "dialogue" + # Confirm that jpg file was not added to the content bank. + And "No content available" "text" should exist + And I should not see "1.jpg" + + Scenario: File upload for content bank can be disabled by admin + Given I log in as "admin" + And I navigate to "Plugins > Content bank > Manage content types" in site administration + When I follow "Disable" + And I am on the "Content bank" page + # Confirm that "Upload" does not exist after admin disabled from Plugins > Content bank > Manage content types. + Then "Upload" "link" should not exist