Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_contentbank @core_h5p @contentbank_h5p @_file_upload @javascript
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:
8
    Given the following "blocks" exist:
9
      | blockname     | contextlevel | reference | pagetypepattern | defaultregion |
10
      | private_files | System       | 1         | my-index        | side-post     |
11
    And I log in as "admin"
12
    And I follow "Manage private files..."
13
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
14
    And I click on "Save changes" "button"
15
    And I am on site homepage
16
    And I turn editing mode on
17
    And the following config values are set as admin:
18
      | unaddableblocks | | theme_boost|
19
    And I add the "Navigation" block if not present
20
    And I configure the "Navigation" block
21
    And I set the following fields to these values:
22
      | Page contexts | Display throughout the entire site |
23
    And I press "Save changes"
24
    And I click on "Site pages" "list_item" in the "Navigation" "block"
25
    And I click on "Content bank" "link" in the "Navigation" "block"
26
    And I click on "Upload" "link"
27
    And I click on "Choose a file..." "button"
28
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
29
    And I click on "filltheblanks.h5p" "link"
30
    And I set the field "Save as" to "content2delete.h5p"
31
    And I click on "Select this file" "button"
32
    And I click on "Save changes" "button"
33
 
34
  Scenario: Admins can delete content from the content bank
35
    Given I click on "More" "button"
36
    And I should see "Delete"
37
    And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
38
    And I should see "Are you sure you want to delete the content 'content2delete.h5p'"
39
    And I should not see "The content will only be deleted from the content bank"
40
    And I click on "Cancel" "button" in the "Delete content" "dialogue"
41
    Then I should see "content2delete.h5p"
42
    And  I click on "More" "button"
43
    And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
44
    And I click on "Delete" "button" in the "Delete content" "dialogue"
45
    And I wait until the page is ready
46
    And I should see "Content deleted."
47
    And I should not see "content2delete.h5p"
48
 
49
  Scenario: Users without the required capability can only delete their own content
50
    Given the following "permission overrides" exist:
51
      | capability                            | permission | role    | contextlevel | reference |
52
      | moodle/contentbank:deleteanycontent   | Prohibit   | manager | System       |           |
53
    And the following "users" exist:
54
      | username    | firstname | lastname | email              |
55
      | manager     | Max       | Manager  | man@example.com    |
56
    And the following "role assigns" exist:
57
      | user        | role      | contextlevel  | reference     |
58
      | manager     | manager       | System    |               |
59
    And I log out
60
    And I log in as "manager"
61
    And I follow "Manage private files..."
62
    And I upload "h5p/tests/fixtures/find-the-words.h5p" file to "Files" filemanager
63
    And I click on "Save changes" "button"
64
    When I click on "Site pages" "list_item" in the "Navigation" "block"
65
    And I click on "Content bank" "link" in the "Navigation" "block"
66
    And I should see "content2delete.h5p"
67
    And I follow "content2delete.h5p"
68
    And I click on "More" "button"
69
    Then I should not see "Delete"
70
    And I click on "Content bank" "link"
71
    And I click on "Upload" "link"
72
    And I click on "Choose a file..." "button"
73
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
74
    And I click on "find-the-words.h5p" "link"
75
    And I click on "Select this file" "button"
76
    And I click on "Save changes" "button"
77
    And  I click on "More" "button"
78
    And I should see "Delete"
79
 
80
  Scenario: The number of times a content is used is displayed before removing it
81
    Given I follow "Dashboard"
82
    And I follow "Manage private files..."
83
    And I click on "Add..." "button"
84
    And I select "Content bank" repository in file picker
85
    And I click on "content2delete.h5p" "file" in repository content area
86
    And I click on "Link to the file" "radio"
87
    And I click on "Select this file" "button"
88
    And I click on "Save changes" "button"
89
    When I click on "Site pages" "list_item" in the "Navigation" "block"
90
    And I click on "Content bank" "link" in the "Navigation" "block"
91
    And I follow "content2delete.h5p"
92
    And  I click on "More" "button"
93
    And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
94
    Then I should see "Are you sure you want to delete the content 'content2delete.h5p'"
95
    And I should see "The content will only be deleted from the content bank"
96
    And I click on "Delete" "button" in the "Delete content" "dialogue"
97
    And I should see "Content deleted."
98
    And I should not see "content2delete.h5p"