Proyectos de Subversion Moodle

Rev

| 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: Copy content from the content bank
3
  In order copy content from the content bank
4
  As an admin
5
  I need to be able to copy any content from the content bank
6
 
7
  Background:
8
    Given the following "contentbank content" exist:
9
      | contextlevel | reference | contenttype       | user    | contentname      | filepath                                |
10
      | System       |           | contenttype_h5p   | admin   | content2copy.h5p | /h5p/tests/fixtures/filltheblanks.h5p   |
11
    And I log in as "admin"
12
    And I am on site homepage
13
    And I turn editing mode on
14
    And the following config values are set as admin:
15
      | unaddableblocks | | theme_boost|
16
    And I add the "Navigation" block if not present
17
    And I configure the "Navigation" block
18
    And I set the following fields to these values:
19
      | Page contexts | Display throughout the entire site |
20
    And I press "Save changes"
21
 
22
  Scenario: Admins can copy content from the content bank
23
    Given I log in as "admin"
24
    And I am on site homepage
25
    And I click on "Site pages" "list_item" in the "Navigation" "block"
26
    And I click on "Content bank" "link"
27
    And I click on "content2copy.h5p" "link"
28
    And I click on "More" "button"
29
    And I click on "Copy content" "link" in the ".cb-toolbar-container" "css_element"
30
    And I set the following fields to these values:
31
      | Content name | |
32
    And I click on "Save changes" "button"
33
    Then I should see "Empty name is not allowed"
34
    And I click on "OK" "button" in the "Error" "dialogue"
35
    And I set the following fields to these values:
36
      | Content name | Fill the blanks copy 1 |
37
    And I click on "Save changes" "button"
38
    Then I should see "Fill the blanks copy 1"
39
    And I click on "Edit" "link"
40
    And I switch to "h5p-editor-iframe" class iframe
41
    Then the field "Title" matches value "Geography"
42
 
43
  Scenario: Users without the required capability cannot copy content
44
    Given the following "users" exist:
45
      | username    | firstname | lastname | email              |
46
      | manager     | Max       | Manager  | man@example.com    |
47
    And the following "role assigns" exist:
48
      | user        | role      | contextlevel  | reference     |
49
      | manager     | manager   | System        |               |
50
    And the following "permission overrides" exist:
51
      | capability                         | permission | role    | contextlevel | reference |
52
      | moodle/contentbank:copycontent     | Prohibit   | manager | System       |           |
53
      | moodle/contentbank:copyanycontent  | Prohibit   | manager | System       |           |
54
    And I log out
55
    And I log in as "manager"
56
    And I click on "Site pages" "list_item" in the "Navigation" "block"
57
    And I click on "Content bank" "link" in the "Navigation" "block"
58
    And I should see "content2copy.h5p"
59
    And I follow "content2copy.h5p"
60
    And  I click on "More" "button"
61
    Then I should not see "Copy content"
62
 
63
  Scenario: Users can't copy content if they don't have the required permission
64
    Given I log in as "admin"
65
    And I am on site homepage
66
    Given I navigate to "H5P > Manage H5P content types" in site administration
67
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
68
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
69
    And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
70
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
71
    Given the following "users" exist:
72
      | username | firstname | lastname | email             |
73
      | teacher1 | Teacher   | 1        | user1@example.com |
74
    And the following "courses" exist:
75
      | fullname | shortname | category |
76
      | Course 1 | C1        | 0        |
77
    And the following "course enrolments" exist:
78
      | user     | course | role           |
79
      | teacher1 | C1     | editingteacher |
80
    And the following "contentbank content" exist:
81
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
82
      | Course       | C1        | contenttype_h5p | teacher1 | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
83
    When I log out
84
    And I log in as "teacher1"
85
    And I am on "Course 1" course homepage
86
    And I click on "Site pages" "list_item" in the "Navigation" "block"
87
    And I click on "Content bank" "link" in the "Navigation" "block"
88
    And I follow "filltheblanks.h5p"
89
    And  I click on "More" "button"
90
    Then I should see "Copy content"
91
    And the following "permission overrides" exist:
92
      | capability                     | permission | role           | contextlevel | reference |
93
      | moodle/contentbank:copycontent | Prohibit   | editingteacher | System       |           |
94
    And I reload the page
95
    And  I click on "More" "button"
96
    Then I should not see "Copy content"
97
 
98
  Scenario: Teachers can copy their own content in the content bank
99
    Given I log in as "admin"
100
    And I am on site homepage
101
    Given I navigate to "H5P > Manage H5P content types" in site administration
102
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
103
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
104
    And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
105
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
106
    And the following "users" exist:
107
      | username | firstname | lastname | email                |
108
      | teacher1 | Teacher   | 1        | teacher1@example.com |
109
    And the following "courses" exist:
110
      | fullname | shortname | category |
111
      | Course 1 | C1        | 0        |
112
    And the following "course enrolments" exist:
113
      | user     | course | role           |
114
      | teacher1 | C1     | editingteacher |
115
    And the following "contentbank content" exist:
116
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
117
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
118
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
119
    When I log out
120
    And I log in as "teacher1"
121
    And I am on "Course 1" course homepage
122
    And I click on "Site pages" "list_item" in the "Navigation" "block"
123
    And I click on "Content bank" "link" in the "Navigation" "block"
124
    And I follow "ipsums.h5p"
125
    And  I click on "More" "button"
126
    Then I should see "Copy content"
127
 
128
  Scenario: Teachers can't copy content created by other users in the content bank
129
    Given the following "users" exist:
130
      | username | firstname | lastname | email                |
131
      | teacher1 | Teacher   | 1        | teacher1@example.com |
132
    And the following "courses" exist:
133
      | fullname | shortname | category |
134
      | Course 1 | C1        | 0        |
135
    And the following "course enrolments" exist:
136
      | user     | course | role           |
137
      | teacher1 | C1     | editingteacher |
138
    And the following "contentbank content" exist:
139
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
140
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
141
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
142
    When I log out
143
    And I log in as "teacher1"
144
    And I am on "Course 1" course homepage
145
    And I click on "Site pages" "list_item" in the "Navigation" "block"
146
    And I click on "Content bank" "link" in the "Navigation" "block"
147
    And I follow "filltheblanks.h5p"
148
    And  I click on "More" "button"
149
    Then I should not see "Copy content"
150
 
151
  Scenario: Teachers can copy any content created by other users in the content bank if allowed
152
    Given the following "users" exist:
153
      | username | firstname | lastname | email                |
154
      | teacher1 | Teacher   | 1        | teacher1@example.com |
155
    And the following "courses" exist:
156
      | fullname | shortname | category |
157
      | Course 1 | C1        | 0        |
158
    And the following "course enrolments" exist:
159
      | user     | course | role           |
160
      | teacher1 | C1     | editingteacher |
161
    And the following "contentbank content" exist:
162
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
163
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
164
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
165
    And the following "permission overrides" exist:
166
      | capability                        | permission | role           | contextlevel | reference |
167
      | moodle/contentbank:copyanycontent | Allow      | editingteacher | System       |           |
168
    When I log out
169
    And I log in as "teacher1"
170
    And I am on "Course 1" course homepage
171
    And I click on "Site pages" "list_item" in the "Navigation" "block"
172
    And I click on "Content bank" "link"
173
    And I follow "filltheblanks.h5p"
174
    And  I click on "More" "button"
175
    Then I should see "Copy content"