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: Content bank use editor feature
3
  In order to add/edit content
4
  As a user
5
  I need to be able to access the edition options
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 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: Users see the Add button disabled if there is no content type available for creation
23
    Given I click on "Site pages" "list_item" in the "Navigation" "block"
24
    When I click on "Content bank" "link"
25
    Then the "[data-action=Add-content]" "css_element" should be disabled
26
 
27
  Scenario: Users can see the Add button if there is content type available for creation
28
    Given I follow "Dashboard"
29
    And I follow "Manage private files..."
30
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
31
    And I click on "Save changes" "button"
32
    And I click on "Site pages" "list_item" in the "Navigation" "block"
33
    And I click on "Content bank" "link" in the "Navigation" "block"
34
    And I click on "Upload" "link"
35
    And I click on "Choose a file..." "button"
36
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
37
    And I click on "filltheblanks.h5p" "link"
38
    And I click on "Select this file" "button"
39
    And I click on "Save changes" "button"
40
    When I click on "Content bank" "link"
41
    And I click on "filltheblanks.h5p" "link"
42
    And I click on "Exit" "link"
43
    Then I click on "[data-action=Add-content]" "css_element"
44
    And I should see "Fill in the Blanks"
45
 
46
  Scenario: Users can edit content if they have the required permission
47
    Given I follow "Dashboard"
48
    And I follow "Manage private files..."
49
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
50
    And I click on "Save changes" "button"
51
    And I click on "Site pages" "list_item" in the "Navigation" "block"
52
    And I click on "Content bank" "link" in the "Navigation" "block"
53
    And I click on "Upload" "link"
54
    And I click on "Choose a file..." "button"
55
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
56
    And I click on "filltheblanks.h5p" "link"
57
    And I click on "Select this file" "button"
58
    And I click on "Save changes" "button"
59
    When I click on "Content bank" "link"
60
    And I click on "filltheblanks.h5p" "link"
61
    Then I click on "Edit" "link"
62
    And I switch to "h5p-editor-iframe" class iframe
63
    And I switch to the main frame
64
    And I click on "Cancel" "button"
65
    And "filltheblanks.h5p" "heading" should exist
66
 
67
  Scenario: Users can create new content if they have the required permission
68
    Given I navigate to "H5P > Manage H5P content types" in site administration
69
    And I upload "h5p/tests/fixtures/filltheblanks.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
    And I should see "H5P content types uploaded successfully"
72
    And I click on "Site pages" "list_item" in the "Navigation" "block"
73
    When I click on "Content bank" "link" in the "Navigation" "block"
74
    And I click on "[data-action=Add-content]" "css_element"
75
    Then I click on "Fill in the Blanks" "link"
76
    And I switch to "h5p-editor-iframe" class iframe
77
    And I switch to the main frame
78
    And I click on "Cancel" "button"
79
 
80
  Scenario: Users can't edit content if they don't have the required permission
81
    Given the following "users" exist:
82
      | username | firstname | lastname | email             |
83
      | teacher1 | Teacher   | 1        | user1@example.com |
84
    And the following "courses" exist:
85
      | fullname | shortname | category |
86
      | Course 1 | C1        | 0        |
87
    And the following "course enrolments" exist:
88
      | user     | course | role              |
89
      | teacher1 | C1     | editingteacher    |
90
    And I navigate to "H5P > Manage H5P content types" in site administration
91
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
92
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
93
    And I should see "H5P content types uploaded successfully"
94
    And I log out
95
    And I log in as "teacher1"
96
    And I am on "Course 1" course homepage
97
    And I click on "Site pages" "list_item" in the "Navigation" "block"
98
    And I click on "Content bank" "link"
99
    And "[data-action=Add-content]" "css_element" should exist
100
    When the following "permission overrides" exist:
101
      | capability                       | permission | role           | contextlevel | reference |
102
      | moodle/contentbank:useeditor     | Prohibit   | editingteacher | System       |           |
103
    And I reload the page
104
    Then "[data-action=Add-content]" "css_element" should not exist
105
 
106
  Scenario: Users can edit content and save changes
107
    Given the following "contentbank content" exist:
108
      | contextlevel | reference | contenttype     | user  | contentname             | filepath                                    |
109
      | System       |           | contenttype_h5p | admin | filltheblanks.h5p       | /h5p/tests/fixtures/filltheblanks.h5p       |
110
    And I click on "Site pages" "list_item" in the "Navigation" "block"
111
    And I click on "Content bank" "link" in the "Navigation" "block"
112
    And I click on "filltheblanks.h5p" "link"
113
    And I click on "Edit" "link"
114
    And I switch to "h5p-editor-iframe" class iframe
115
    And the field "Title" matches value "Geography"
116
    And I set the field "Title" to "New title"
117
    And I switch to the main frame
118
    When I click on "Save" "button"
119
    And "filltheblanks.h5p" "heading" should exist
120
    And I click on "Edit" "link"
121
    And I switch to "h5p-editor-iframe" class iframe
122
    Then the field "Title" matches value "New title"
123
 
124
  Scenario: Teachers can edit their own content in the content bank
125
    Given I navigate to "H5P > Manage H5P content types" in site administration
126
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
127
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
128
    And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
129
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
130
    And the following "users" exist:
131
      | username | firstname | lastname | email                |
132
      | teacher1 | Teacher   | 1        | teacher1@example.com |
133
    And the following "courses" exist:
134
      | fullname | shortname | category |
135
      | Course 1 | C1        | 0        |
136
    And the following "course enrolments" exist:
137
      | user     | course | role           |
138
      | teacher1 | C1     | editingteacher |
139
    And the following "contentbank content" exist:
140
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
141
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
142
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
143
    When I log out
144
    And I log in as "teacher1"
145
    And I am on "Course 1" course homepage
146
    And I expand "Site pages" node
147
    And I click on "Content bank" "link"
148
    And I follow "ipsums.h5p"
149
    Then "Edit" "link" should exist in the "region-main" "region"
150
 
151
  Scenario: Teachers can't edit content created by other users in the content bank
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
    When I log out
166
    And I log in as "teacher1"
167
    And I am on "Course 1" course homepage
168
    And I expand "Site pages" node
169
    And I click on "Content bank" "link"
170
    And I follow "filltheblanks.h5p"
171
    Then "Edit" "link" should not exist in the "region-main" "region"
172
 
173
  Scenario: Teachers keep their content authoring in copied courses
174
    Given the following "users" exist:
175
      | username | firstname | lastname | email                |
176
      | teacher1 | Teacher   | 1        | teacher1@example.com |
177
    And the following "courses" exist:
178
      | fullname | shortname | category |
179
      | Course 1 | C1        | 0        |
180
    And the following "course enrolments" exist:
181
      | user     | course | role           |
182
      | teacher1 | C1     | editingteacher |
183
    And the following "contentbank content" exist:
184
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
185
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
186
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
187
    And I am on the "Course 1" "course copy" page
188
    And I set the following fields to these values:
189
      | Course full name  | Copy |
190
      | Course short name | Copy |
191
      | Teacher           | 1    |
192
    When I press "Copy and view"
193
    And I trigger cron
194
    And I am on homepage
195
    And I log out
196
    And I log in as "teacher1"
197
    And I am on "Copy" course homepage
198
    And I expand "Site pages" node
199
    And I click on "Content bank" "link"
200
    And I follow "ipsums.h5p"
201
    Then "Edit" "link" should exist in the "region-main" "region"
202
    And I navigate to "Content bank" in current page administration
203
    And I follow "filltheblanks.h5p"
204
    Then "Edit" "link" should not exist in the "region-main" "region"