Merge branch 'MDL-70408-master' of git://github.com/sarjona/moodle
[moodle.git] / mod / h5pactivity / tests / behat / contentbank_link.feature
CommitLineData
064e1a7e 1@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
7f602632
FR
2Feature: Content bank link in the activity settings form
3 In order to have direct access to the Content bank
4 As a teacher
5 I need to see a Content bank link in the activity settings
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 And the following "courses" exist:
12 | fullname | shortname | category |
13 | Course 1 | C1 | 0 |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
064e1a7e
SA
17 And the following "contentbank content" exist:
18 | contextlevel | reference | contenttype | user | contentname | filepath |
19 | Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
7f602632
FR
20
21 @javascript
22 Scenario: The content bank link should go to the course Content bank
23 When I log in as "teacher1"
24 And I am on "Course 1" course homepage with editing mode on
25 And I add a "H5P" to section "1"
ac69c0eb
AG
26 Then I should see "Use the content bank (opens in new window) to manage your H5P files"
27 And I click on "content bank (opens in new window)" "link" in the "General" "fieldset"
7f602632
FR
28 And I should see "C1" in the "page-navbar" "region"
29 And I close all opened windows
30
31 Scenario: Content bank is not displayed if the user don't have access to the content bank
32 Given the following "permission overrides" exist:
33 | capability | permission | role | contextlevel | reference |
34 | moodle/contentbank:access | Prevent | editingteacher | Course | C1 |
35 When I log in as "teacher1"
36 And I am on "Course 1" course homepage with editing mode on
37 And I add a "H5P" to section "1"
ac69c0eb 38 Then I should not see "Use the content Bank (opens in new window) to manage your H5P files"
064e1a7e
SA
39
40 @javascript
41 Scenario: A different message should be displayed if the package file is a link to the content bank file
42 Given I log in as "admin"
43 And I am on "Course 1" course homepage with editing mode on
44 And I add a "H5P" to section "1"
45 And I set the following fields to these values:
46 | Name | H5P package added with link to content bank |
47 | Description | Description |
48 And I click on "Add..." "button" in the "Package file" "form_row"
49 And I select "Content bank" repository in file picker
50 And I click on "filltheblanks.h5p" "file" in repository content area
51 And I click on "Link to the file" "radio"
52 And I click on "Select this file" "button"
53 And I click on "Save and display" "button"
54 And I switch to "h5p-player" class iframe
55 And I switch to "h5p-iframe" class iframe
56 And I should see "Of which countries are Berlin, Washington, Beijing, Canberra and Brasilia the capitals?"
57 And I switch to the main frame
58 When I navigate to "Edit settings" in current page administration
59 Then I should not see "Use the content Bank (opens in new window) to manage your H5P files"
60 And I should see "Access the H5P file in the content bank (opens in a new window)."
61 And I follow "Access the H5P file in the content bank"
62
63 @javascript
64 Scenario: The content bank link should go to the course Content bank if the file is a copy to a content bank file
65 Given I log in as "admin"
66 And I am on "Course 1" course homepage with editing mode on
67 And I add a "H5P" to section "1"
68 And I set the following fields to these values:
69 | Name | H5P package added with link to content bank |
70 | Description | Description |
71 And I click on "Add..." "button" in the "Package file" "form_row"
72 And I select "Content bank" repository in file picker
73 And I click on "filltheblanks.h5p" "file" in repository content area
74 And I click on "Make a copy of the file" "radio"
75 And I click on "Select this file" "button"
76 And I click on "Save and display" "button"
77 And I switch to "h5p-player" class iframe
78 And I switch to "h5p-iframe" class iframe
79 And I should see "Of which countries are Berlin,"
80 And I switch to the main frame
81 When I navigate to "Edit settings" in current page administration
82 Then I should see "Use the content bank (opens in new window) to manage your H5P files"
83
84 @javascript
85 Scenario: The content bank link should go to the course Content bank if the file is referenced but to another repository
86 Given I log in as "admin"
87 And I follow "Manage private files..."
88 And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
89 And I click on "Save changes" "button"
90 And I am on "Course 1" course homepage with editing mode on
91 And I add a "H5P" to section "1"
92 And I set the following fields to these values:
93 | Name | H5P package added with link to content bank |
94 | Description | Description |
95 And I click on "Add..." "button" in the "Package file" "form_row"
96 And I select "Private files" repository in file picker
97 And I click on "guess-the-answer.h5p" "file" in repository content area
98 And I click on "Link to the file" "radio"
99 And I click on "Select this file" "button"
100 And I click on "Save and display" "button"
101 And I switch to "h5p-player" class iframe
102 And I switch to "h5p-iframe" class iframe
103 And I should see "Which fruit is this?"
104 And I switch to the main frame
105 When I navigate to "Edit settings" in current page administration
106 Then I should see "Use the content bank (opens in new window) to manage your H5P files"