11 |
efrain |
1 |
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
|
|
|
2 |
Feature: Undeployed H5P activities packages should be available only to any user 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 |
# Now create the activity as teacher1.
|
|
|
23 |
And the following "activities" exist:
|
|
|
24 |
| activity | course | name | username | packagefilepath |
|
|
|
25 |
| h5pactivity | C1 | Music history | teacher1 | h5p/tests/fixtures/filltheblanks.h5p |
|
|
|
26 |
And I log in as "admin"
|
|
|
27 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
28 |
And I press "Delete" action in the "Teacher 1" report row
|
|
|
29 |
And I click on "Delete" "button" in the "Delete user" "dialogue"
|
|
|
30 |
And I should see "Deleted user Teacher 1"
|
|
|
31 |
|
|
|
32 |
@javascript
|
|
|
33 |
Scenario: In an H5P activity, as student I should not be able to deploy the package if not deployed by the teacher
|
|
|
34 |
beforehand. Then if a second teacher deploys the package, I can see it.
|
|
|
35 |
Given I am on the "Music history" "h5pactivity activity" page logged in as student1
|
|
|
36 |
And I switch to "h5p-player" class iframe
|
|
|
37 |
And "This file can't be displayed because it has been uploaded by a user without the required capability to deploy H5P content" "text" should exist
|
|
|
38 |
And I switch to the main frame
|
|
|
39 |
And I log out
|
|
|
40 |
# Then teacher2 will be allowed to deploy the package.
|
|
|
41 |
And I am on the "Music history" "h5pactivity activity" page logged in as teacher2
|
|
|
42 |
And I switch to "h5p-player" class iframe
|
|
|
43 |
When I switch to "h5p-iframe" class iframe
|
|
|
44 |
Then I should see "Of which countries are Berlin"
|
|
|
45 |
And I switch to the main frame
|
|
|
46 |
And I log out
|
|
|
47 |
# Now student1 should be able to see the package.
|
|
|
48 |
And I am on the "Music history" "h5pactivity activity" page logged in as student1
|
|
|
49 |
And I switch to "h5p-player" class iframe
|
|
|
50 |
When I switch to "h5p-iframe" class iframe
|
|
|
51 |
Then I should see "Of which countries are Berlin"
|