11 |
efrain |
1 |
@core @core_contentbank @core_h5p @contentbank_h5p @javascript
|
1 |
efrain |
2 |
Feature: 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:
|
11 |
efrain |
8 |
Given the following "user private file" exists:
|
|
|
9 |
| user | admin |
|
|
|
10 |
| filepath | h5p/tests/fixtures/filltheblanks.h5p |
|
|
|
11 |
And I am on the "Content bank" page logged in as "admin"
|
1 |
efrain |
12 |
And I click on "Upload" "link"
|
|
|
13 |
And I click on "Choose a file..." "button"
|
|
|
14 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
15 |
And I click on "filltheblanks.h5p" "link"
|
|
|
16 |
And I set the field "Save as" to "content2delete.h5p"
|
|
|
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
|
11 |
efrain |
21 |
Given I wait "2" seconds
|
|
|
22 |
And I click on "More" "button"
|
1 |
efrain |
23 |
And I should see "Delete"
|
11 |
efrain |
24 |
And I click on "Delete" "link"
|
1 |
efrain |
25 |
And I should see "Are you sure you want to delete the content 'content2delete.h5p'"
|
|
|
26 |
And I should not see "The content will only be deleted from the content bank"
|
|
|
27 |
And I click on "Cancel" "button" in the "Delete content" "dialogue"
|
|
|
28 |
Then I should see "content2delete.h5p"
|
11 |
efrain |
29 |
And I wait "2" seconds
|
|
|
30 |
And I click on "More" "button"
|
1 |
efrain |
31 |
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
|
|
|
32 |
And I click on "Delete" "button" in the "Delete content" "dialogue"
|
|
|
33 |
And I wait until the page is ready
|
|
|
34 |
And I should see "Content deleted."
|
|
|
35 |
And I should not see "content2delete.h5p"
|
|
|
36 |
|
|
|
37 |
Scenario: Users without the required capability can only delete their own content
|
|
|
38 |
Given the following "permission overrides" exist:
|
|
|
39 |
| capability | permission | role | contextlevel | reference |
|
|
|
40 |
| moodle/contentbank:deleteanycontent | Prohibit | manager | System | |
|
|
|
41 |
And the following "users" exist:
|
|
|
42 |
| username | firstname | lastname | email |
|
|
|
43 |
| manager | Max | Manager | man@example.com |
|
|
|
44 |
And the following "role assigns" exist:
|
|
|
45 |
| user | role | contextlevel | reference |
|
|
|
46 |
| manager | manager | System | |
|
11 |
efrain |
47 |
And the following "user private file" exists:
|
|
|
48 |
| user | manager |
|
|
|
49 |
| filepath | h5p/tests/fixtures/find-the-words.h5p |
|
|
|
50 |
When I am on the "Content bank" page logged in as "manager"
|
1 |
efrain |
51 |
And I should see "content2delete.h5p"
|
|
|
52 |
And I follow "content2delete.h5p"
|
11 |
efrain |
53 |
And I wait "2" seconds
|
1 |
efrain |
54 |
And I click on "More" "button"
|
|
|
55 |
Then I should not see "Delete"
|
11 |
efrain |
56 |
And I am on the "Content bank" page
|
1 |
efrain |
57 |
And I click on "Upload" "link"
|
|
|
58 |
And I click on "Choose a file..." "button"
|
|
|
59 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
60 |
And I click on "find-the-words.h5p" "link"
|
|
|
61 |
And I click on "Select this file" "button"
|
|
|
62 |
And I click on "Save changes" "button"
|
11 |
efrain |
63 |
And I wait "2" seconds
|
|
|
64 |
And I click on "More" "button"
|
1 |
efrain |
65 |
And I should see "Delete"
|
|
|
66 |
|
|
|
67 |
Scenario: The number of times a content is used is displayed before removing it
|
11 |
efrain |
68 |
Given I am on the "My private files" page
|
1 |
efrain |
69 |
And I click on "Add..." "button"
|
|
|
70 |
And I select "Content bank" repository in file picker
|
|
|
71 |
And I click on "content2delete.h5p" "file" in repository content area
|
|
|
72 |
And I click on "Link to the file" "radio"
|
|
|
73 |
And I click on "Select this file" "button"
|
|
|
74 |
And I click on "Save changes" "button"
|
11 |
efrain |
75 |
And I am on the "Content bank" page
|
1 |
efrain |
76 |
And I follow "content2delete.h5p"
|
11 |
efrain |
77 |
And I wait "2" seconds
|
|
|
78 |
And I click on "More" "button"
|
1 |
efrain |
79 |
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
|
|
|
80 |
Then I should see "Are you sure you want to delete the content 'content2delete.h5p'"
|
|
|
81 |
And I should see "The content will only be deleted from the content bank"
|
|
|
82 |
And I click on "Delete" "button" in the "Delete content" "dialogue"
|
|
|
83 |
And I should see "Content deleted."
|
|
|
84 |
And I should not see "content2delete.h5p"
|