MDL-68483 contentbank: improve search API
[moodle.git] / contentbank / tests / behat / delete_content.feature
CommitLineData
45192e9a
SA
1@core @core_contentbank @contentbank_h5p @_file_upload @javascript
2Feature: Delete H5P file from the content bank
3 In order remove H5P content from the content bank
4 As an admin
5 I need to be able to delete any H5P content from the content bank
6
7 Background:
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"
44642b0a
SA
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"
45192e9a
SA
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"
27
28 Scenario: Admins can delete content from the content bank
44642b0a
SA
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"
45192e9a
SA
32 Then I should see "Delete"
33 And I choose "Delete" in the open action menu
8599eb5e 34 And I should see "Are you sure you want to delete the content 'filltheblanks.h5p'"
45192e9a
SA
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"
43
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 | |
54 And I log out
44642b0a
SA
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"
45192e9a
SA
61 And I should see "filltheblanks.h5p"
62 And I follow "filltheblanks.h5p"
63 Then ".header-actions-container" "css_element" should not exist
45192e9a
SA
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"
45192e9a
SA
71 And I should see "filltheblanks.h5p"
72 And I should see "find-the-words.h5p"
44642b0a 73 And I follow "find-the-words.h5p"
45192e9a 74 And I open the action menu in "region-main-settings-menu" "region"
44642b0a 75 And I should see "Delete"