weekly release 3.9dev
[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"
12 And I click on "Content bank" "link"
13 And I click on "Upload" "link"
14 And I click on "Choose a file..." "button"
15 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
16 And I click on "filltheblanks.h5p" "link"
17 And I click on "Select this file" "button"
18 And I click on "Save changes" "button"
19
20 Scenario: Admins can delete content from the content bank
21 Given I click on "Content bank" "link"
22 And I wait until the page is ready
23 And I should see "filltheblanks.h5p"
24 When I follow "filltheblanks.h5p"
25 And I open the action menu in "region-main-settings-menu" "region"
26 Then I should see "Delete"
27 And I choose "Delete" in the open action menu
28 And I should see "Are you sure you want to delete content 'filltheblanks.h5p'?"
29 And I click on "Cancel" "button" in the "Delete content" "dialogue"
30 And I should see "filltheblanks.h5p"
31 And I open the action menu in "region-main-settings-menu" "region"
32 And I choose "Delete" in the open action menu
33 And I click on "Delete" "button" in the "Delete content" "dialogue"
34 And I wait until the page is ready
35 And I should see "The content has been deleted."
36 And I should not see "filltheblanks.h5p"
37
38 Scenario: Users without the required capability can only delete their own content
39 Given the following "permission overrides" exist:
40 | capability | permission | role | contextlevel | reference |
41 | moodle/contentbank:deleteanycontent | Prohibit | manager | System | |
42 And the following "users" exist:
43 | username | firstname | lastname | email |
44 | manager | Max | Manager | man@example.com |
45 And the following "role assigns" exist:
46 | user | role | contextlevel | reference |
47 | manager | manager | System | |
48 And I log out
49 When I log in as "manager"
50 And I click on "Content bank" "link"
51 And I wait until the page is ready
52 And I should see "filltheblanks.h5p"
53 And I follow "filltheblanks.h5p"
54 Then ".header-actions-container" "css_element" should not exist
55 And I click on "Private files" "link"
56 And I upload "h5p/tests/fixtures/find-the-words.h5p" file to "Files" filemanager
57 And I click on "Save changes" "button"
58 And I click on "Content bank" "link"
59 And I click on "Upload" "link"
60 And I click on "Choose a file..." "button"
61 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
62 And I click on "find-the-words.h5p" "link"
63 And I click on "Select this file" "button"
64 And I click on "Save changes" "button"
65 And I wait until the page is ready
66 And I should see "filltheblanks.h5p"
67 And I should see "find-the-words.h5p"
68 When I follow "find-the-words.h5p"
69 And I open the action menu in "region-main-settings-menu" "region"
70 Then I should see "Delete"