1 @core @core_contentbank @contentbank_h5p @_file_upload @javascript
2 Feature: Delete H5P file from the content bank
3 In order remove H5P content from the content bank
5 I need to be able to delete any H5P content from the content bank
8 Given I log in as "admin"
9 And I follow "Manage private files..."
10 And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
11 And I click on "Save changes" "button"
12 And I am on site homepage
13 And I turn editing mode on
14 And I add the "Navigation" block if not present
15 And I configure the "Navigation" block
16 And I set the following fields to these values:
17 | Page contexts | Display throughout the entire site |
18 And I press "Save changes"
19 And I click on "Site pages" "list_item" in the "Navigation" "block"
20 And I click on "Content bank" "link" in the "Navigation" "block"
21 And I click on "Upload" "link"
22 And I click on "Choose a file..." "button"
23 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
24 And I click on "filltheblanks.h5p" "link"
25 And I click on "Select this file" "button"
26 And I click on "Save changes" "button"
28 Scenario: Admins can delete content from the content bank
29 Given I should see "filltheblanks.h5p"
30 And I follow "filltheblanks.h5p"
31 When I open the action menu in "region-main-settings-menu" "region"
32 Then I should see "Delete"
33 And I choose "Delete" in the open action menu
34 And I should see "Are you sure you want to delete content 'filltheblanks.h5p'?"
35 And I click on "Cancel" "button" in the "Delete content" "dialogue"
36 And I should see "filltheblanks.h5p"
37 And I open the action menu in "region-main-settings-menu" "region"
38 And I choose "Delete" in the open action menu
39 And I click on "Delete" "button" in the "Delete content" "dialogue"
40 And I wait until the page is ready
41 And I should see "The content has been deleted."
42 And I should not see "filltheblanks.h5p"
44 Scenario: Users without the required capability can only delete their own content
45 Given the following "permission overrides" exist:
46 | capability | permission | role | contextlevel | reference |
47 | moodle/contentbank:deleteanycontent | Prohibit | manager | System | |
48 And the following "users" exist:
49 | username | firstname | lastname | email |
50 | manager | Max | Manager | man@example.com |
51 And the following "role assigns" exist:
52 | user | role | contextlevel | reference |
53 | manager | manager | System | |
55 And I log in as "manager"
56 And I follow "Manage private files..."
57 And I upload "h5p/tests/fixtures/find-the-words.h5p" file to "Files" filemanager
58 And I click on "Save changes" "button"
59 When I click on "Site pages" "list_item" in the "Navigation" "block"
60 And I click on "Content bank" "link" in the "Navigation" "block"
61 And I should see "filltheblanks.h5p"
62 And I follow "filltheblanks.h5p"
63 Then ".header-actions-container" "css_element" should not exist
64 And I click on "Content bank" "link"
65 And I click on "Upload" "link"
66 And I click on "Choose a file..." "button"
67 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
68 And I click on "find-the-words.h5p" "link"
69 And I click on "Select this file" "button"
70 And I click on "Save changes" "button"
71 And I should see "filltheblanks.h5p"
72 And I should see "find-the-words.h5p"
73 And I follow "find-the-words.h5p"
74 And I open the action menu in "region-main-settings-menu" "region"
75 And I should see "Delete"