1 |
efrain |
1 |
@core @core_contentbank @core_h5p @contenttype_h5p @_file_upload @_switch_iframe @javascript
|
|
|
2 |
Feature: H5P file upload to content bank for non admins
|
|
|
3 |
In order import new H5P content to content bank
|
|
|
4 |
As an admin
|
|
|
5 |
I need to be able to upload a new .h5p file to content bank
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
12 |
And the following "categories" exist:
|
|
|
13 |
| name | category | idnumber |
|
|
|
14 |
| Cat 1 | 0 | CAT1 |
|
|
|
15 |
And the following "courses" exist:
|
|
|
16 |
| fullname | shortname | category |
|
|
|
17 |
| Course 1 | C1 | CAT1 |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role |
|
|
|
20 |
| teacher1 | C1 | editingteacher |
|
|
|
21 |
| teacher2 | C1 | editingteacher |
|
11 |
efrain |
22 |
And the following "user private file" exists:
|
|
|
23 |
| user | teacher1 |
|
|
|
24 |
| filepath | h5p/tests/fixtures/filltheblanks.h5p |
|
1 |
efrain |
25 |
And I log in as "teacher1"
|
|
|
26 |
|
|
|
27 |
Scenario: Teachers can not access system level content bank
|
|
|
28 |
Given I turn editing mode on
|
|
|
29 |
And the following config values are set as admin:
|
|
|
30 |
| unaddableblocks | | theme_boost|
|
|
|
31 |
And I add the "Navigation" block if not present
|
|
|
32 |
When I expand "Site pages" node
|
|
|
33 |
Then I should not see "Content bank"
|
|
|
34 |
|
|
|
35 |
Scenario: Teachers can access course level content bank
|
|
|
36 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
37 |
And the following config values are set as admin:
|
|
|
38 |
| unaddableblocks | | theme_boost|
|
|
|
39 |
And I add the "Navigation" block if not present
|
|
|
40 |
When I expand "Site pages" node
|
|
|
41 |
Then I should see "Content bank"
|
|
|
42 |
|
|
|
43 |
Scenario: Teachers can upload .h5p extension files to course content bank
|
|
|
44 |
Given I log out
|
|
|
45 |
And I log in as "admin"
|
|
|
46 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
47 |
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
|
|
|
48 |
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
|
|
|
49 |
And I log out
|
|
|
50 |
And I log in as "teacher1"
|
|
|
51 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
52 |
And the following config values are set as admin:
|
|
|
53 |
| unaddableblocks | | theme_boost|
|
|
|
54 |
And I add the "Navigation" block if not present
|
|
|
55 |
When I expand "Site pages" node
|
|
|
56 |
And I click on "Content bank" "link"
|
|
|
57 |
Then I should not see "filltheblanks.h5p"
|
|
|
58 |
And I click on "Upload" "link"
|
|
|
59 |
And I click on "Choose a file..." "button"
|
|
|
60 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
61 |
And I click on "filltheblanks.h5p" "link"
|
|
|
62 |
And I click on "Select this file" "button"
|
|
|
63 |
And I click on "Save changes" "button"
|
|
|
64 |
And I wait until the page is ready
|
|
|
65 |
And I should see "filltheblanks.h5p"
|
|
|
66 |
|
|
|
67 |
Scenario: Other teachers can see uploaded H5P contents
|
|
|
68 |
Given I log out
|
|
|
69 |
And I log in as "admin"
|
|
|
70 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
71 |
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
|
|
|
72 |
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
|
|
|
73 |
And I log out
|
|
|
74 |
And I log in as "teacher1"
|
|
|
75 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
76 |
And the following config values are set as admin:
|
|
|
77 |
| unaddableblocks | | theme_boost|
|
|
|
78 |
And I add the "Navigation" block if not present
|
|
|
79 |
When I expand "Site pages" node
|
|
|
80 |
And I click on "Content bank" "link"
|
|
|
81 |
And I click on "Upload" "link"
|
|
|
82 |
And I click on "Choose a file..." "button"
|
|
|
83 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
84 |
And I click on "filltheblanks.h5p" "link"
|
|
|
85 |
And I click on "Select this file" "button"
|
|
|
86 |
And I click on "Save changes" "button"
|
|
|
87 |
And I wait until the page is ready
|
|
|
88 |
And I should see "filltheblanks.h5p"
|
|
|
89 |
And I log out
|
|
|
90 |
When I log in as "teacher2"
|
|
|
91 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
92 |
And the following config values are set as admin:
|
|
|
93 |
| unaddableblocks | | theme_boost|
|
|
|
94 |
And I add the "Navigation" block if not present
|
|
|
95 |
And I expand "Site pages" node
|
|
|
96 |
And I click on "Content bank" "link"
|
|
|
97 |
Then I should see "filltheblanks.h5p"
|
|
|
98 |
|
|
|
99 |
Scenario: Teachers can not upload and deploy content types when libraries are not installed
|
|
|
100 |
Given I log out
|
|
|
101 |
And I log in as "admin"
|
|
|
102 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
103 |
And I should not see "Fill in the Blanks"
|
|
|
104 |
And I log out
|
|
|
105 |
And I log in as "teacher1"
|
|
|
106 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
107 |
And the following config values are set as admin:
|
|
|
108 |
| unaddableblocks | | theme_boost|
|
|
|
109 |
And I add the "Navigation" block if not present
|
|
|
110 |
And I expand "Site pages" node
|
|
|
111 |
And I click on "Content bank" "link"
|
|
|
112 |
When I click on "Upload" "link"
|
|
|
113 |
And I click on "Choose a file..." "button"
|
|
|
114 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
115 |
And I click on "filltheblanks.h5p" "link"
|
|
|
116 |
And I click on "Select this file" "button"
|
|
|
117 |
And I click on "Save changes" "button"
|
|
|
118 |
Then I should see "Missing required library"
|
|
|
119 |
And I should not see "filltheblanks.h5p"
|
|
|
120 |
And I log out
|
|
|
121 |
And I log in as "admin"
|
|
|
122 |
And I am on "Course 1" course homepage
|
|
|
123 |
And I expand "Site pages" node
|
|
|
124 |
And I click on "Content bank" "link"
|
|
|
125 |
And I should not see "filltheblanks.h5p"
|
|
|
126 |
|
|
|
127 |
Scenario: Teachers can not see existing contents when libraries are not installed
|
11 |
efrain |
128 |
Given the following "user private file" exists:
|
|
|
129 |
| user | admin |
|
|
|
130 |
| filepath | h5p/tests/fixtures/filltheblanks.h5p |
|
1 |
efrain |
131 |
And I log in as "admin"
|
|
|
132 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
133 |
And I should not see "Fill in the Blanks"
|
|
|
134 |
When I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
|
|
|
135 |
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
|
|
|
136 |
And I wait until the page is ready
|
|
|
137 |
And I should see "Fill in the Blanks"
|
|
|
138 |
And I log out
|
|
|
139 |
And I log in as "teacher1"
|
|
|
140 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
141 |
And the following config values are set as admin:
|
|
|
142 |
| unaddableblocks | | theme_boost|
|
|
|
143 |
And I add the "Navigation" block if not present
|
|
|
144 |
When I expand "Site pages" node
|
|
|
145 |
And I click on "Content bank" "link"
|
|
|
146 |
And I click on "Upload" "link"
|
|
|
147 |
And I click on "Choose a file..." "button"
|
|
|
148 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
149 |
And I click on "filltheblanks.h5p" "link"
|
|
|
150 |
And I click on "Select this file" "button"
|
|
|
151 |
And I click on "Save changes" "button"
|
|
|
152 |
And I switch to "h5p-player" class iframe
|
|
|
153 |
And I switch to "h5p-iframe" class iframe
|
|
|
154 |
Then I should see "Of which countries"
|
|
|
155 |
Then I should not see "missing-main-library"
|
|
|
156 |
And I switch to the main frame
|
|
|
157 |
Given I log out
|
|
|
158 |
And I log in as "admin"
|
|
|
159 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
160 |
When I click on "Delete version" "link" in the "Fill in the Blanks" "table_row"
|
|
|
161 |
And I press "Continue"
|
|
|
162 |
Then I should not see "Fill in the Blanks"
|
|
|
163 |
And I log out
|
|
|
164 |
And I log in as "teacher1"
|
|
|
165 |
Given I am on "Course 1" course homepage
|
|
|
166 |
When I expand "Site pages" node
|
|
|
167 |
And I click on "Content bank" "link"
|
|
|
168 |
Then I should not see "filltheblanks.h5p"
|
|
|
169 |
And I log out
|
|
|
170 |
And I log in as "admin"
|
|
|
171 |
And I am on "Course 1" course homepage
|
|
|
172 |
And I expand "Site pages" node
|
|
|
173 |
And I click on "Content bank" "link"
|
|
|
174 |
And I should see "filltheblanks.h5p"
|
|
|
175 |
And I click on "filltheblanks.h5p" "link"
|
|
|
176 |
And I switch to "h5p-player" class iframe
|
|
|
177 |
And I should see "missing-main-library"
|