Proyectos de Subversion Moodle

Rev

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