Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
11 efrain 1
@editor @editor_atto @atto @atto_h5p @core_h5p @_switch_iframe
2
Feature: Use the Atto editor to upload an h5p package
1 efrain 3
  To write rich text - I need to add h5ps.
4
 
5
  Background:
6
    Given the following "courses" exist:
7
      | shortname | fullname |
8
      | C1        | Course 1 |
9
    And the following "users" exist:
10
      | username | firstname | lastname | email |
11
      | teacher1 | Teacher | 1 | teacher1@example.com |
12
    And the following "course enrolments" exist:
13
      | user | course | role |
14
      | teacher1 | C1 | editingteacher |
15
    And the following "activities" exist:
16
      | activity | name       | intro      | introformat | course | content  | contentformat | idnumber |
17
      | page     | PageName1  | PageDesc1  | 1           | C1     | H5Ptest  | 1             | 1        |
18
    And the "displayh5p" filter is "on"
19
    And the following config values are set as admin:
20
      | allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p |
21
 
22
  @javascript @external
23
  Scenario: Insert an embedded h5p
24
    Given I change window size to "large"
25
    And I am on the PageName1 "page activity editing" page logged in as admin
26
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
27
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119"
28
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
29
    And I wait until the page is ready
30
    When I click on "Save and display" "button"
31
    Then ".h5p-placeholder" "css_element" should exist
32
    And I wait until the page is ready
33
    And I switch to "h5pcontent" iframe
34
    And I should see "Lorum ipsum"
35
 
36
  @javascript
37
  Scenario: Insert an h5p file
11 efrain 38
    Given the following "user private file" exists:
39
      | user     | admin                                   |
40
      | filepath | h5p/tests/fixtures/guess-the-answer.h5p |
41
    And I am on the "PageName1" "page activity editing" page logged in as "admin"
1 efrain 42
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
43
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
44
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
45
    And I click on "guess-the-answer.h5p" "link"
46
    And I click on "Select this file" "button"
47
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
48
    And I wait until the page is ready
49
    When I click on "Save and display" "button"
50
    Then ".h5p-placeholder" "css_element" should exist
51
 
52
  @javascript
53
  Scenario: Test an invalid url
54
    Given I change window size to "large"
55
    And I am on the PageName1 "page activity editing" page logged in as admin
56
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
57
#   This is not a real external URL, so this scenario shouldn't be labeled as external.
58
    And I set the field with xpath "//input[@data-region='h5pfile']" to "ftp://moodle.h5p.com/content/1290772960722742119"
59
    When I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
60
    And I wait until the page is ready
61
    Then I should see "Invalid URL" in the "Insert H5P" "dialogue"
62
 
63
  @javascript
64
  Scenario: No h5p capabilities
65
    Given the following "permission overrides" exist:
66
    | capability | permission | role | contextlevel | reference |
67
    | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
68
    | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
69
    When I am on the PageName1 "page activity editing" page logged in as teacher1
70
    Then "Insert H5P" "button" should not exist
71
 
72
  @javascript
73
  Scenario: No embed h5p capabilities
74
    Given the following "permission overrides" exist:
75
    | capability | permission | role | contextlevel | reference |
76
    | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
77
    And I am on the PageName1 "page activity editing" page logged in as teacher1
78
    And I click on "Insert H5P" "button"
79
    Then I should not see "H5P URL" in the "Insert H5P" "dialogue"
80
    And I should see "H5P file upload" in the "Insert H5P" "dialogue"
81
    And I should see "H5P options" in the "Insert H5P" "dialogue"
82
 
83
  @javascript
84
  Scenario: No upload h5p capabilities
85
    Given the following "permission overrides" exist:
86
    | capability | permission | role | contextlevel | reference |
87
    | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
88
    When I am on the PageName1 "page activity editing" page logged in as teacher1
89
    And I click on "Insert H5P" "button"
90
    Then I should not see "H5P file upload" in the "Insert H5P" "dialogue"
91
    And I should see "H5P URL" in the "Insert H5P" "dialogue"
92
    And I should not see "H5P options" in the "Insert H5P" "dialogue"
93
 
94
  @javascript @external
95
  Scenario: Edit H5P content
11 efrain 96
    Given the following "user private file" exists:
97
      | user     | admin                       |
98
      | filepath | h5p/tests/fixtures/drag.h5p |
99
    And I am on the "PageName1" "page activity editing" page logged in as "admin"
1 efrain 100
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
101
#   H5P file content
102
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
103
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
104
    And I click on "drag" "link"
105
    And I click on "Select this file" "button"
106
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
107
    And I wait until the page is ready
108
    When I click on "Save and display" "button"
109
    And I switch to "h5pcontent" iframe
110
    And I switch to "h5p-iframe" class iframe
111
    Then I should not see "reveal"
112
    And I should see "Cloudberries"
113
    And I switch to the main frame
114
    And I navigate to "Settings" in current page administration
115
    And I click on ".h5p-placeholder" "css_element"
116
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
117
#   External URL
118
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119"
119
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
120
    And I wait until the page is ready
121
    And I click on "Save and display" "button"
122
    And I wait until the page is ready
123
    And I switch to "h5pcontent" iframe
124
    And I should see "Lorum ipsum"
125
    And I should not see "Cloudberries"
126
 
127
  @javascript
128
  Scenario: Enable/disable H5P options atto
11 efrain 129
    Given the following "user private file" exists:
130
      | user     | admin                                   |
131
      | filepath | h5p/tests/fixtures/guess-the-answer.h5p |
132
    And I am on the "PageName1" "page activity editing" page logged in as "admin"
1 efrain 133
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
134
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
135
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
136
    And I click on "guess-the-answer.h5p" "link"
137
    And I click on "Select this file" "button"
138
#   No display option button displayed
139
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
140
    When I click on "Save and display" "button"
141
    And I wait until the page is ready
142
    And I switch to "h5pcontent" iframe
143
    And I switch to "h5p-iframe" class iframe
144
    Then ".h5p-actions" "css_element" should not exist
145
    And I switch to the main frame
146
    And I navigate to "Settings" in current page administration
147
    And I click on ".h5p-placeholder" "css_element"
148
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
149
    And I click on "H5P options" "link"
150
#   Only Allow Download button displayed
151
    And I click on "Allow download" "checkbox"
152
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
153
    And I click on "Save and display" "button"
154
    And I switch to "h5pcontent" iframe
155
    And I switch to "h5p-iframe" class iframe
156
    And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
157
    And I should not see "Embed"
158
    And I should not see "Rights of use"
159
    And I switch to the main frame
160
    And I navigate to "Settings" in current page administration
161
    And I click on ".h5p-placeholder" "css_element"
162
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
163
#   Embed and copyright buttons displayed. Download not displayed
164
    And I click on "Allow download" "checkbox"
165
    And I click on "Embed button" "checkbox"
166
    And I click on "Copyright button" "checkbox"
167
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
168
    And I click on "Save and display" "button"
169
    And I switch to "h5pcontent" iframe
170
    And I switch to "h5p-iframe" class iframe
171
    And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
172
    And I should see "Embed"
173
    And I should see "Rights of use"
174
 
175
  @javascript @external
176
  Scenario: H5P options are ignored for H5P URLs
177
    Given I change window size to "large"
178
    And I am on the PageName1 "page activity editing" page logged in as admin
179
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
180
    And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1291366510035871129"
181
    And I click on "H5P options" "link"
182
    And I click on "Embed button" "checkbox"
183
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
184
    When I click on "Save and display" "button"
185
    Then ".h5p-placeholder" "css_element" should exist
186
    And I switch to "h5pcontent" iframe
187
    And I should see "Far far away"
188
    And I should not see "Embed"
189
    And I switch to the main frame
190
    And I navigate to "Settings" in current page administration
191
    And I click on ".h5p-placeholder" "css_element"
192
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
193
    And I click on "H5P options" "link"
194
    And "input[aria-label=\"Embed button\"]:not([checked=checked])" "css_element" should exist
195
 
196
  @javascript
197
  Scenario: Private H5P files are shown to students
198
    Given the following "users" exist:
199
      | username | firstname | lastname | email |
200
      | student1 | Student   | 1 | student1@example.com |
201
    And the following "course enrolments" exist:
202
      | user | course | role |
203
      | student1 | C1 | student |
11 efrain 204
    And the following "user private file" exists:
205
      | user     | admin                                   |
206
      | filepath | h5p/tests/fixtures/guess-the-answer.h5p |
207
    And I am on the "PageName1" "page activity editing" page logged in as "admin"
1 efrain 208
    And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
209
    And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
210
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
211
    And I click on "guess-the-answer.h5p" "link"
212
    And I click on "Select this file" "button"
213
    And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
214
    And I wait until the page is ready
215
    And I click on "Save and display" "button"
216
    And I log out
217
    When I am on the PageName1 "page activity" page logged in as student1
218
    Then I switch to "h5pcontent" iframe
219
    And I switch to "h5p-iframe" class iframe
220
    And I should see "reveal"