11 |
efrain |
1 |
@core_h5p @_file_upload @_switch_iframe @editor_tiny
|
|
|
2 |
Feature: Undeployed H5P content should be only available to users that can deploy packages.
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
8 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
9 |
| student1 | Student | 1 | student1@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | category |
|
|
|
12 |
| Course 1 | C1 | 0 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher1 | C1 | editingteacher |
|
|
|
16 |
| teacher2 | C1 | editingteacher |
|
|
|
17 |
| student1 | C1 | student |
|
|
|
18 |
# Make sure that the teacher2 can update libraries so it show the right info when.
|
|
|
19 |
And the following "permission overrides" exist:
|
|
|
20 |
| capability | permission | role | contextlevel | reference |
|
|
|
21 |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
|
|
|
22 |
And the following "activities" exist:
|
|
|
23 |
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
|
|
24 |
| page | H5PPage | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
|
|
25 |
And I am on the H5PPage "page activity editing" page logged in as teacher1
|
|
|
26 |
And the following "contentbank content" exist:
|
|
|
27 |
| contextlevel | reference | contenttype | user | contentname | filepath |
|
|
|
28 |
| Course | C1 | contenttype_h5p | teacher1 | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
|
|
|
29 |
And I click on the "Configure H5P content" button for the "Page content" TinyMCE editor
|
|
|
30 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
|
|
31 |
And I click on "Content bank" "link" in the ".fp-repo-area" "css_element"
|
|
|
32 |
And I click on "filltheblanks.h5p" "link"
|
|
|
33 |
And I click on "Select this file" "button"
|
|
|
34 |
And I click on "Insert H5P content" "button" in the "Insert H5P content" "dialogue"
|
|
|
35 |
# This is important here not to do Save and display as if not this will be deployed and the student will see it in the first step.
|
|
|
36 |
And I click on "Save and return to course" "button"
|
|
|
37 |
And I log out
|
|
|
38 |
And I log in as "admin"
|
|
|
39 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
40 |
And I press "Delete" action in the "Teacher 1" report row
|
|
|
41 |
And I click on "Delete" "button" in the "Delete user" "dialogue"
|
|
|
42 |
And I should see "Deleted user Teacher 1"
|
|
|
43 |
|
|
|
44 |
@javascript
|
|
|
45 |
Scenario: A student I should not be able to see a package that has been deployed by a deleted user. Then if another user deploys the package, I can see it.
|
|
|
46 |
Given I am on the "H5PPage" "page activity" page logged in as student1
|
|
|
47 |
And I switch to "h5p-iframe" class iframe
|
|
|
48 |
And I should see "This file can't be displayed"
|
|
|
49 |
And I switch to the main frame
|
|
|
50 |
And I log out
|
|
|
51 |
# Then teacher2 will be allowed to deploy the package.
|
|
|
52 |
When I am on the "H5PPage" "page activity" page logged in as teacher2
|
|
|
53 |
# Note the double switch to iframe is needed because the first iframe is the one that contains the H5P package and
|
|
|
54 |
# the second iframe is the one that contains the H5P content.
|
|
|
55 |
And I switch to "h5p-iframe" class iframe
|
|
|
56 |
And I switch to "h5p-iframe" class iframe
|
|
|
57 |
Then I should see "Of which countries are Berlin"
|
|
|
58 |
And I switch to the main frame
|
|
|
59 |
And I log out
|
|
|
60 |
# Now student1 should be able to see the package.
|
|
|
61 |
And I am on the "H5PPage" "page activity" page logged in as student1
|
|
|
62 |
And I switch to "h5p-iframe" class iframe
|
|
|
63 |
And I switch to "h5p-iframe" class iframe
|
|
|
64 |
And I should see "Of which countries are Berlin"
|