Proyectos de Subversion Moodle

Rev

Rev 11 | | 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
1441 ariadna 59
    And I change viewport size to "800x1400"
1 efrain 60
    And I click on "Cancel" "button"
61
    And "filltheblanks.h5p" "heading" should exist
62
 
63
  Scenario: Users can create new content if they have the required permission
64
    Given I navigate to "H5P > Manage H5P content types" in site administration
65
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
66
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
67
    And I should see "H5P content types uploaded successfully"
68
    And I click on "Site pages" "list_item" in the "Navigation" "block"
69
    When I click on "Content bank" "link" in the "Navigation" "block"
70
    And I click on "[data-action=Add-content]" "css_element"
71
    Then I click on "Fill in the Blanks" "link"
72
    And I switch to "h5p-editor-iframe" class iframe
73
    And I switch to the main frame
74
    And I click on "Cancel" "button"
75
 
76
  Scenario: Users can't edit content if they don't have the required permission
77
    Given the following "users" exist:
78
      | username | firstname | lastname | email             |
79
      | teacher1 | Teacher   | 1        | user1@example.com |
80
    And the following "courses" exist:
81
      | fullname | shortname | category |
82
      | Course 1 | C1        | 0        |
83
    And the following "course enrolments" exist:
84
      | user     | course | role              |
85
      | teacher1 | C1     | editingteacher    |
86
    And I navigate to "H5P > Manage H5P content types" in site administration
87
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
88
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
89
    And I should see "H5P content types uploaded successfully"
90
    And I log out
91
    And I log in as "teacher1"
92
    And I am on "Course 1" course homepage
93
    And I click on "Site pages" "list_item" in the "Navigation" "block"
94
    And I click on "Content bank" "link"
95
    And "[data-action=Add-content]" "css_element" should exist
96
    When the following "permission overrides" exist:
97
      | capability                       | permission | role           | contextlevel | reference |
98
      | moodle/contentbank:useeditor     | Prohibit   | editingteacher | System       |           |
99
    And I reload the page
100
    Then "[data-action=Add-content]" "css_element" should not exist
101
 
102
  Scenario: Users can edit content and save changes
103
    Given the following "contentbank content" exist:
104
      | contextlevel | reference | contenttype     | user  | contentname             | filepath                                    |
105
      | System       |           | contenttype_h5p | admin | filltheblanks.h5p       | /h5p/tests/fixtures/filltheblanks.h5p       |
106
    And I click on "Site pages" "list_item" in the "Navigation" "block"
107
    And I click on "Content bank" "link" in the "Navigation" "block"
108
    And I click on "filltheblanks.h5p" "link"
109
    And I click on "Edit" "link"
110
    And I switch to "h5p-editor-iframe" class iframe
111
    And the field "Title" matches value "Geography"
112
    And I set the field "Title" to "New title"
113
    And I switch to the main frame
114
    When I click on "Save" "button"
115
    And "filltheblanks.h5p" "heading" should exist
116
    And I click on "Edit" "link"
117
    And I switch to "h5p-editor-iframe" class iframe
118
    Then the field "Title" matches value "New title"
119
 
120
  Scenario: Teachers can edit their own content in the content bank
121
    Given I navigate to "H5P > Manage H5P content types" in site administration
122
    And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
123
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
124
    And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
125
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
126
    And the following "users" exist:
127
      | username | firstname | lastname | email                |
128
      | teacher1 | Teacher   | 1        | teacher1@example.com |
129
    And the following "courses" exist:
130
      | fullname | shortname | category |
131
      | Course 1 | C1        | 0        |
132
    And the following "course enrolments" exist:
133
      | user     | course | role           |
134
      | teacher1 | C1     | editingteacher |
135
    And the following "contentbank content" exist:
136
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
137
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
138
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
139
    When I log out
140
    And I log in as "teacher1"
141
    And I am on "Course 1" course homepage
142
    And I expand "Site pages" node
143
    And I click on "Content bank" "link"
144
    And I follow "ipsums.h5p"
145
    Then "Edit" "link" should exist in the "region-main" "region"
146
 
147
  Scenario: Teachers can't edit content created by other users in the content bank
148
    Given the following "users" exist:
149
      | username | firstname | lastname | email                |
150
      | teacher1 | Teacher   | 1        | teacher1@example.com |
151
    And the following "courses" exist:
152
      | fullname | shortname | category |
153
      | Course 1 | C1        | 0        |
154
    And the following "course enrolments" exist:
155
      | user     | course | role           |
156
      | teacher1 | C1     | editingteacher |
157
    And the following "contentbank content" exist:
158
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
159
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
160
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
161
    When I log out
162
    And I log in as "teacher1"
163
    And I am on "Course 1" course homepage
164
    And I expand "Site pages" node
165
    And I click on "Content bank" "link"
166
    And I follow "filltheblanks.h5p"
167
    Then "Edit" "link" should not exist in the "region-main" "region"
168
 
169
  Scenario: Teachers keep their content authoring in copied courses
170
    Given the following "users" exist:
171
      | username | firstname | lastname | email                |
172
      | teacher1 | Teacher   | 1        | teacher1@example.com |
173
    And the following "courses" exist:
174
      | fullname | shortname | category |
175
      | Course 1 | C1        | 0        |
176
    And the following "course enrolments" exist:
177
      | user     | course | role           |
178
      | teacher1 | C1     | editingteacher |
179
    And the following "contentbank content" exist:
180
      | contextlevel | reference | contenttype     | user     | contentname       | filepath                              |
181
      | Course       | C1        | contenttype_h5p | admin    | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
182
      | Course       | C1        | contenttype_h5p | teacher1 | ipsums.h5p        | /h5p/tests/fixtures/ipsums.h5p        |
183
    And I am on the "Course 1" "course copy" page
184
    And I set the following fields to these values:
185
      | Course full name  | Copy |
186
      | Course short name | Copy |
187
      | Teacher           | 1    |
188
    When I press "Copy and view"
189
    And I trigger cron
190
    And I am on homepage
191
    And I log out
192
    And I log in as "teacher1"
193
    And I am on "Copy" course homepage
194
    And I expand "Site pages" node
195
    And I click on "Content bank" "link"
196
    And I follow "ipsums.h5p"
197
    Then "Edit" "link" should exist in the "region-main" "region"
198
    And I navigate to "Content bank" in current page administration
199
    And I follow "filltheblanks.h5p"
200
    Then "Edit" "link" should not exist in the "region-main" "region"