on-demand release 4.0dev+
[moodle.git] / contentbank / tests / behat / download_content.feature
CommitLineData
39263ddb 1@core @core_contentbank @core_h5p @contentbank_h5p @_file_upload @javascript
66455e02
SA
2Feature: Download H5P content from the content bank
3 In order export H5P content from the content bank
4 As an admin
5 I need to be able to download any H5P content from the content bank
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | manager | Max | Manager | man@example.com |
11 And the following "role assigns" exist:
12 | user | role | contextlevel | reference |
13 | manager | manager | System | |
14 And the following "contentbank content" exist:
15 | contextlevel | reference | contenttype | user | contentname | filepath |
16 | System | | contenttype_h5p | admin | filltheblanksadmin.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
17 | System | | contenttype_h5p | manager | filltheblanksmanager.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
18 And I log in as "admin"
19 And I am on site homepage
20 And I turn editing mode on
21 And I add the "Navigation" block if not present
22 And I configure the "Navigation" block
23 And I set the following fields to these values:
24 | Page contexts | Display throughout the entire site |
25 And I press "Save changes"
26
27 Scenario: Admins can download content from the content bank
28 Given I click on "Site pages" "list_item" in the "Navigation" "block"
29 And I click on "Content bank" "link" in the "Navigation" "block"
30 And I follow "filltheblanksmanager.h5p"
31 And I open the action menu in "region-main-settings-menu" "region"
32 And I should see "Download"
33 When I choose "Download" in the open action menu
34 Then I should see "filltheblanksmanager.h5p"
35
36 Scenario: Users can download content created by different users
37 Given the following "permission overrides" exist:
38 | capability | permission | role | contextlevel | reference |
39 | moodle/contentbank:manageanycontent | Prohibit | manager | System | |
40 And I log out
41 And I log in as "manager"
42 When I click on "Site pages" "list_item" in the "Navigation" "block"
43 And I click on "Content bank" "link" in the "Navigation" "block"
44 And I should see "filltheblanksadmin.h5p"
45 And I follow "filltheblanksadmin.h5p"
46 And I open the action menu in "region-main-settings-menu" "region"
47 Then I should see "Download"
48 And I should not see "Rename"
49
50 Scenario: Users without the required capability cannot download content
51 Given the following "permission overrides" exist:
52 | capability | permission | role | contextlevel | reference |
53 | moodle/contentbank:downloadcontent | Prohibit | manager | System | |
54 And I log out
55 And I log in as "manager"
56 When I click on "Site pages" "list_item" in the "Navigation" "block"
57 And I click on "Content bank" "link" in the "Navigation" "block"
58 And I should see "filltheblanksmanager.h5p"
59 And I follow "filltheblanksmanager.h5p"
60 And I open the action menu in "region-main-settings-menu" "region"
61 Then I should not see "Download"