MDL-73370 contentbank: Update behat tests

This commit is contained in:
Peter Dias
2022-02-16 17:49:00 +08:00
parent 57f1bd3a01
commit 240da1b186
9 changed files with 45 additions and 39 deletions
@@ -22,8 +22,8 @@ Feature: Replace H5P file from an existing content
And I switch to "h5p-iframe" class iframe
And I should see "Of which countries"
And I switch to the main frame
When I open the action menu in "region-main-settings-menu" "region"
And I choose "Replace with file" in the open action menu
When I click on "More" "button"
And I click on "Replace with file" "link"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I switch to "h5p-player" class iframe
@@ -36,9 +36,9 @@ Feature: Manage H5P content from the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
And I follow "ipsums.h5p"
When I open the action menu in "region-main-settings-menu" "region"
When I click on "More" "button"
And I should see "Rename"
And I choose "Rename" in the open action menu
And I click on "Rename" "link"
And I set the field "Content name" to "New name"
And I click on "Rename" "button"
And I wait until the page is ready
@@ -51,4 +51,5 @@ Feature: Manage H5P content from the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
When I follow "filltheblanks.h5p"
Then "Rename" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Rename"
@@ -43,8 +43,8 @@ Feature: Replace H5P file from an existing content requires special capabilities
Scenario: Teacher can replace its own H5P files
Given I click on "teachercontent" "link"
When I open the action menu in "region-main-settings-menu" "region"
And I choose "Replace with file" in the open action menu
When I click on "More" "button"
And I click on "Replace with file" "link"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I switch to "h5p-player" class iframe
@@ -54,25 +54,29 @@ Feature: Replace H5P file from an existing content requires special capabilities
Scenario: Teacher cannot replace another user's H5P files
When I click on "admincontent" "link"
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having the H5P upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| contenttype/h5p:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having the manage own content capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:manageowncontent | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Replace with file"
@@ -29,15 +29,15 @@ Feature: Delete H5P file from the content bank
And I click on "Save changes" "button"
Scenario: Admins can delete content from the content bank
Given I open the action menu in "region-main-settings-menu" "region"
Given I click on "More" "button"
And I should see "Delete"
When I choose "Delete" in the open action menu
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should not see "The content will only be deleted from the content bank"
And I click on "Cancel" "button" in the "Delete content" "dialogue"
Then I should see "content2delete.h5p"
And I open the action menu in "region-main-settings-menu" "region"
And I choose "Delete" in the open action menu
And I click on "More" "button"
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I click on "Delete" "button" in the "Delete content" "dialogue"
And I wait until the page is ready
And I should see "The content has been deleted."
@@ -62,7 +62,8 @@ Feature: Delete H5P file from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "content2delete.h5p"
And I follow "content2delete.h5p"
Then "Delete" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Delete"
And I click on "Content bank" "link"
And I click on "Upload" "link"
And I click on "Choose a file..." "button"
@@ -70,7 +71,7 @@ Feature: Delete H5P file from the content bank
And I click on "find-the-words.h5p" "link"
And I click on "Select this file" "button"
And I click on "Save changes" "button"
And I open the action menu in "region-main-settings-menu" "region"
And I click on "More" "button"
And I should see "Delete"
Scenario: The number of times a content is used is displayed before removing it
@@ -85,8 +86,8 @@ Feature: Delete H5P file from the content bank
When I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I follow "content2delete.h5p"
And I open the action menu in "region-main-settings-menu" "region"
And I choose "Delete" in the open action menu
And I click on "More" "button"
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
Then I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should see "The content will only be deleted from the content bank"
And I click on "Delete" "button" in the "Delete content" "dialogue"
@@ -30,9 +30,9 @@ Feature: Download H5P content from the content bank
Given I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I follow "filltheblanksmanager.h5p"
And I open the action menu in "region-main-settings-menu" "region"
And I click on "More" "button"
And I should see "Download"
When I choose "Download" in the open action menu
When I click on "Download" "link"
Then I should see "filltheblanksmanager.h5p"
Scenario: Users can download content created by different users
@@ -45,7 +45,7 @@ Feature: Download H5P content from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "filltheblanksadmin.h5p"
And I follow "filltheblanksadmin.h5p"
And I open the action menu in "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should see "Download"
And I should not see "Rename"
@@ -59,5 +59,5 @@ Feature: Download H5P content from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "filltheblanksmanager.h5p"
And I follow "filltheblanksmanager.h5p"
And I open the action menu in "region-main-settings-menu" "region"
And I click on "More" "button"
Then I should not see "Download"
+3 -3
View File
@@ -36,7 +36,7 @@ Feature: Content bank use editor feature
And I click on "Save changes" "button"
When I click on "Content bank" "link"
And I click on "filltheblanks.h5p" "link"
And I click on "Close" "link"
And I click on "Exit" "link"
Then I click on "[data-action=Add-content]" "css_element"
And I should see "Fill in the Blanks"
@@ -59,7 +59,7 @@ Feature: Content bank use editor feature
And I switch to "h5p-editor-iframe" class iframe
And I switch to the main frame
And I click on "Cancel" "button"
And I should see "filltheblanks.h5p" in the "h1" "css_element"
And I should see "filltheblanks.h5p" in the "h2" "css_element"
Scenario: Users can create new content if they have the required permission
Given I navigate to "H5P > Manage H5P content types" in site administration
@@ -113,7 +113,7 @@ Feature: Content bank use editor feature
And I set the field "Title" to "New title"
And I switch to the main frame
When I click on "Save" "button"
And I should see "filltheblanks.h5p" in the "h1" "css_element"
And I should see "filltheblanks.h5p" in the "h2" "css_element"
And I click on "Edit" "link"
And I switch to "h5p-editor-iframe" class iframe
Then the field "Title" matches value "New title"
+4 -4
View File
@@ -58,8 +58,8 @@ Feature: Confirm content bank events are triggered
And I expand "Site pages" node
And I click on "Content bank" "link"
And I click on "Existing" "link"
And I open the action menu in "region-main-settings-menu" "region"
When I choose "Delete" in the open action menu
And I click on "More" "button"
When I click on "Delete" "link"
And I click on "Delete" "button" in the "Delete content" "dialogue"
And I navigate to "Reports > Live logs" in site administration
Then I should see "Content deleted"
@@ -71,8 +71,8 @@ Feature: Confirm content bank events are triggered
And I expand "Site pages" node
And I click on "Content bank" "link"
And I click on "Existing" "link"
And I open the action menu in "region-main-settings-menu" "region"
When I choose "Rename" in the open action menu
And I click on "More" "button"
When I click on "Rename" "link"
And I set the field "Content name" to "New name"
And I click on "Rename" "button"
And I navigate to "Reports > Live logs" in site administration
+8 -8
View File
@@ -27,13 +27,13 @@ Feature: Make content public or unlisted
And I click on "Content bank" "link" in the "Navigation" "block"
And I click on "filltheblanks.h5p" "link"
And I wait until the page is ready
And I should not see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
And I open the action menu in "region-main-settings-menu" "region"
And I should not see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
And I click on "More" "button"
And I should see "Make unlisted"
When I choose "Make unlisted" in the open action menu
And I click on "Make unlisted" "link"
And I wait until the page is ready
Then I should see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
And I open the action menu in "region-main-settings-menu" "region"
Then I should see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
And I click on "More" "button"
And I should see "Make public"
Scenario: Unlisted content cannot be seen by other users
@@ -131,7 +131,7 @@ Feature: Make content public or unlisted
And I click on "Upload" "link"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I should see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
Then I should see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
@_file_upload
Scenario: User preference concerning content visibility overrides site-wide default content visibility
@@ -149,5 +149,5 @@ Feature: Make content public or unlisted
And I click on "Upload" "link"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I should see "filltheblanks.h5p" in the "h1" "css_element"
And I should not see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
Then I should see "filltheblanks.h5p" in the "h2" "css_element"
And I should not see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
@@ -26,7 +26,7 @@ Feature: Content bank link in the activity settings form
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 the browser tab opened by the app
And I should see "Content bank" in the "page-header" "region"
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