11 |
efrain |
1 |
@core @core_contentbank @core_h5p @contenttype_h5p @_switch_iframe @javascript
|
1 |
efrain |
2 |
Feature: H5P file upload to content bank for 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:
|
11 |
efrain |
8 |
Given the following "user private file" exists:
|
|
|
9 |
| user | admin |
|
|
|
10 |
| filepath | h5p/tests/fixtures/filltheblanks.h5p |
|
1 |
efrain |
11 |
And I log in as "admin"
|
|
|
12 |
And I turn editing mode on
|
|
|
13 |
And the following config values are set as admin:
|
|
|
14 |
| unaddableblocks | | theme_boost|
|
|
|
15 |
And I add the "Navigation" block if not present
|
|
|
16 |
And I expand "Site pages" node
|
|
|
17 |
And I click on "Content bank" "link"
|
|
|
18 |
|
|
|
19 |
Scenario: Admins can upload .h5p extension files to content bank
|
|
|
20 |
Given I should not see "filltheblanks.h5p"
|
|
|
21 |
When I click on "Upload" "link"
|
|
|
22 |
And I click on "Choose a file..." "button"
|
|
|
23 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
24 |
And I click on "filltheblanks.h5p" "link"
|
|
|
25 |
And I click on "Select this file" "button"
|
|
|
26 |
And I click on "Save changes" "button"
|
|
|
27 |
And I wait until the page is ready
|
|
|
28 |
Then I should see "filltheblanks.h5p"
|
|
|
29 |
|
|
|
30 |
Scenario: Admins can see uploaded H5P contents
|
|
|
31 |
Given I should not see "filltheblanks.h5p"
|
|
|
32 |
When I click on "Upload" "link"
|
|
|
33 |
And I click on "Choose a file..." "button"
|
|
|
34 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
35 |
And I click on "filltheblanks.h5p" "link"
|
|
|
36 |
And I click on "Select this file" "button"
|
|
|
37 |
And I click on "Save changes" "button"
|
|
|
38 |
And I wait until the page is ready
|
|
|
39 |
And I switch to "h5p-player" class iframe
|
|
|
40 |
And I switch to "h5p-iframe" class iframe
|
|
|
41 |
Then I should see "Of which countries"
|
|
|
42 |
|
|
|
43 |
Scenario: Users can't see content managed by disabled plugins
|
|
|
44 |
Given I click on "Upload" "link"
|
|
|
45 |
And I click on "Choose a file..." "button"
|
|
|
46 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
47 |
And I click on "filltheblanks.h5p" "link"
|
|
|
48 |
And I click on "Select this file" "button"
|
|
|
49 |
And I click on "Save changes" "button"
|
|
|
50 |
And I wait until the page is ready
|
|
|
51 |
And I should see "filltheblanks.h5p"
|
|
|
52 |
And I navigate to "Plugins > Content bank > Manage content types" in site administration
|
|
|
53 |
And I click on "Disable" "icon" in the "H5P" "table_row"
|
|
|
54 |
And I wait until the page is ready
|
|
|
55 |
When I navigate to "Plugins > Content bank" in site administration
|
|
|
56 |
Then I should not see "filltheblanks.h5p"
|
|
|
57 |
|
|
|
58 |
Scenario: Contents in a context are not available from other contexts
|
|
|
59 |
Given the following "courses" exist:
|
|
|
60 |
| fullname | shortname | category |
|
|
|
61 |
| Course 1 | C1 | 0 |
|
|
|
62 |
When I click on "Upload" "link"
|
|
|
63 |
And I click on "Choose a file..." "button"
|
|
|
64 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
65 |
And I click on "filltheblanks.h5p" "link"
|
|
|
66 |
And I click on "Select this file" "button"
|
|
|
67 |
And I click on "Save changes" "button"
|
|
|
68 |
And I wait until the page is ready
|
|
|
69 |
Then I should see "filltheblanks.h5p"
|
|
|
70 |
And I am on "Course 1" course homepage
|
|
|
71 |
And the following config values are set as admin:
|
|
|
72 |
| unaddableblocks | | theme_boost|
|
|
|
73 |
And I add the "Navigation" block if not present
|
|
|
74 |
And I expand "Site pages" node
|
|
|
75 |
And I click on "Content bank" "link"
|
|
|
76 |
And I should not see "filltheblanks.h5p"
|
|
|
77 |
|
|
|
78 |
Scenario: Admins can upload and deployed content types when libraries are not installed
|
|
|
79 |
Given I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
80 |
And I should not see "Fill in the Blanks"
|
|
|
81 |
And I follow "Dashboard"
|
|
|
82 |
And I expand "Site pages" node
|
|
|
83 |
And I click on "Content bank" "link"
|
|
|
84 |
And I should not see "filltheblanks.h5p"
|
|
|
85 |
When I click on "Upload" "link"
|
|
|
86 |
And I click on "Choose a file..." "button"
|
|
|
87 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
88 |
And I click on "filltheblanks.h5p" "link"
|
|
|
89 |
And I click on "Select this file" "button"
|
|
|
90 |
And I click on "Save changes" "button"
|
|
|
91 |
And I switch to "h5p-player" class iframe
|
|
|
92 |
And I switch to "h5p-iframe" class iframe
|
|
|
93 |
Then I should see "Of which countries"
|
|
|
94 |
And I switch to the main frame
|
|
|
95 |
And I navigate to "H5P > Manage H5P content types" in site administration
|
|
|
96 |
And I should see "Fill in the Blanks"
|
|
|
97 |
|
|
|
98 |
Scenario: Uploading invalid packages throws error
|
11 |
efrain |
99 |
Given the following "user private files" exist:
|
|
|
100 |
| user | filepath |
|
|
|
101 |
| admin | h5p/tests/fixtures/no-json-file.h5p |
|
|
|
102 |
| admin | h5p/tests/fixtures/unzippable.h5p |
|
|
|
103 |
And I follow "Dashboard"
|
1 |
efrain |
104 |
And I expand "Site pages" node
|
|
|
105 |
And I click on "Content bank" "link"
|
|
|
106 |
When I click on "Upload" "link"
|
|
|
107 |
And I click on "Choose a file..." "button"
|
|
|
108 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
109 |
And I click on "no-json-file.h5p" "link"
|
|
|
110 |
And I click on "Select this file" "button"
|
|
|
111 |
And I click on "Save changes" "button"
|
|
|
112 |
And I wait until the page is ready
|
|
|
113 |
Then I should see "A valid main h5p.json file is missing"
|
|
|
114 |
And I should see "Only files with the following extensions are allowed"
|
|
|
115 |
And I should not see "Sorry, this file is not valid"
|
|
|
116 |
And I click on "Upload" "link"
|
|
|
117 |
And I click on "Choose a file..." "button"
|
|
|
118 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
119 |
And I click on "unzippable.h5p" "link"
|
|
|
120 |
And I click on "Select this file" "button"
|
|
|
121 |
And I click on "Save changes" "button"
|
|
|
122 |
And I wait until the page is ready
|
|
|
123 |
And I should see "It is not possible to unzip it"
|
|
|
124 |
And I should not see "Sorry, this file is not valid"
|