forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-69270-master' of git://github.com/ferranrecio/moodle
- Loading branch information
Showing
12 changed files
with
306 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
contentbank/contenttype/h5p/tests/behat/admin_replace_content.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@core @core_contentbank @contenttype_h5p @_file_upload @_switch_iframe @javascript | ||
Feature: Replace H5P file from an existing content | ||
In order to replace an H5P content from the content bank | ||
As an admin | ||
I need to be able to replace the content with a new .h5p file | ||
|
||
Background: | ||
Given the following "contentbank content" exist: | ||
| contextlevel | reference | contenttype | user | contentname | filepath | | ||
| System | | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p | | ||
And I log in as "admin" | ||
And I press "Customise this page" | ||
And I add the "Navigation" block if not present | ||
And I expand "Site pages" node | ||
And I click on "Content bank" "link" | ||
|
||
Scenario: Admins can replace the original .h5p file with a new one | ||
Given I click on "filltheblanks.h5p" "link" | ||
And I switch to "h5p-player" class iframe | ||
And I switch to "h5p-iframe" class iframe | ||
And I should see "Of which countries" | ||
And I switch to the main frame | ||
When I open the action menu in "region-main-settings-menu" "region" | ||
And I choose "Replace with file" in the open action menu | ||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager | ||
And I click on "Save changes" "button" | ||
Then I switch to "h5p-player" class iframe | ||
And I switch to "h5p-iframe" class iframe | ||
And I should see "Lorum ipsum" | ||
And I switch to the main frame |
67 changes: 67 additions & 0 deletions
67
contentbank/contenttype/h5p/tests/behat/teacher_replace_content.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@core @core_contentbank @contenttype_h5p @_file_upload @_switch_iframe @javascript | ||
Feature: Replace H5P file from an existing content requires special capabilities | ||
In order replace an H5P content from the content bank | ||
As a teacher | ||
I need to be able to replace the content only if certain capabilities are allowed | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And the following "categories" exist: | ||
| name | category | idnumber | | ||
| Cat 1 | 0 | CAT1 | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | CAT1 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
And the following "contentbank content" exist: | ||
| contextlevel | reference | contenttype | user | contentname | filepath | | ||
| Course | C1 | contenttype_h5p | admin | admincontent | /h5p/tests/fixtures/ipsums.h5p | | ||
| Course | C1 | contenttype_h5p | teacher1 | teachercontent | /h5p/tests/fixtures/filltheblanks.h5p | | ||
And I log in as "teacher1" | ||
And I am on "Course 1" course homepage with editing mode on | ||
And I add the "Navigation" block if not present | ||
And I expand "Site pages" node | ||
And I click on "Content bank" "link" | ||
# Force the content deploy | ||
And I click on "admincontent" "link" | ||
And I click on "Content bank" "link" | ||
|
||
Scenario: Teacher can replace its own H5P files | ||
Given I click on "teachercontent" "link" | ||
When I open the action menu in "region-main-settings-menu" "region" | ||
And I choose "Replace with file" in the open action menu | ||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager | ||
And I click on "Save changes" "button" | ||
Then I switch to "h5p-player" class iframe | ||
And I switch to "h5p-iframe" class iframe | ||
And I should see "Lorum ipsum" | ||
And I switch to the main frame | ||
|
||
Scenario: Teacher cannot replace another user's H5P files | ||
When I click on "admincontent" "link" | ||
Then "region-main-settings-menu" "region" should not exist | ||
|
||
Scenario: Teacher cannot replace a content without having upload capability | ||
Given the following "permission overrides" exist: | ||
| capability | permission | role | contextlevel | reference | | ||
| moodle/contentbank:upload | Prevent | editingteacher | Course | C1 | | ||
When I click on "teachercontent" "link" | ||
Then "region-main-settings-menu" "region" should not exist | ||
|
||
Scenario: Teacher cannot replace a content without having the H5P upload capability | ||
Given the following "permission overrides" exist: | ||
| capability | permission | role | contextlevel | reference | | ||
| contenttype/h5p:upload | Prevent | editingteacher | Course | C1 | | ||
When I click on "teachercontent" "link" | ||
Then "region-main-settings-menu" "region" should not exist | ||
|
||
Scenario: Teacher cannot replace a content without having the manage own content capability | ||
Given the following "permission overrides" exist: | ||
| capability | permission | role | contextlevel | reference | | ||
| moodle/contentbank:manageowncontent | Prevent | editingteacher | Course | C1 | | ||
When I click on "teachercontent" "link" | ||
Then "region-main-settings-menu" "region" should not exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.