Merge branch 'MDL-67146-master-enfix-2' of git://github.com/mudrd8mz/moodle
[moodle.git] / lib / editor / atto / plugins / h5p / tests / behat / h5p.feature
CommitLineData
59e87e62 1@editor @editor_atto @atto @atto_h5p @_file_upload @_switch_iframe
297f7e41
BB
2Feature: Add h5ps to Atto
3 To write rich text - I need to add h5ps.
4
5 Background:
6 Given the following "courses" exist:
7 | shortname | fullname |
8 | C1 | Course 1 |
9 And the following "users" exist:
10 | username | firstname | lastname | email |
11 | teacher1 | Teacher | 1 | teacher1@example.com |
12 And the following "course enrolments" exist:
13 | user | course | role |
14 | teacher1 | C1 | editingteacher |
15 And the following "activities" exist:
16 | activity | name | intro | introformat | course | content | contentformat | idnumber |
17 | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
18
19 @javascript
20 Scenario: Insert an embedded h5p
21 Given I log in as "admin"
59e87e62 22 And I change window size to "large"
297f7e41
BB
23 And I am on "Course 1" course homepage
24 And I follow "PageName1"
25 And I navigate to "Edit settings" in current page administration
26 And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
59e87e62
BB
27 And I set the field with xpath "//textarea[@data-region='h5purl']" to "https://h5p.org/h5p/embed/576651"
28 And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
297f7e41
BB
29 And I wait until the page is ready
30 When I click on "Save and display" "button"
59e87e62
BB
31 Then ".h5p-placeholder" "css_element" should exist
32
33 @javascript
34 Scenario: Insert an h5p file
35 Given I log in as "admin"
36 And I change window size to "large"
37 And I follow "Manage private files..."
38 And I upload "lib/editor/atto/tests/fixtures/ipsums.h5p" file to "Files" filemanager
39 And I click on "Save changes" "button"
40 And I am on "Course 1" course homepage
41 And I follow "PageName1"
42 And I navigate to "Edit settings" in current page administration
43 And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
44 And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
45 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
46 And I click on "ipsums.h5p" "link"
47 And I click on "Select this file" "button"
48 And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
49 And I wait until the page is ready
50 When I click on "Save and display" "button"
51 Then ".h5p-placeholder" "css_element" should exist
297f7e41
BB
52
53 @javascript
54 Scenario: Test an invalid url
55 Given I log in as "admin"
59e87e62 56 And I change window size to "large"
297f7e41
BB
57 And I am on "Course 1" course homepage
58 And I follow "PageName1"
59 And I navigate to "Edit settings" in current page administration
60 And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
59e87e62
BB
61 And I set the field with xpath "//textarea[@data-region='h5purl']" to "ftp://h5p.org/h5p/embed/576651"
62 When I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
297f7e41 63 And I wait until the page is ready
59e87e62
BB
64 Then I should see "Invalid URL" in the "Insert H5P" "dialogue"
65
66 @javascript
67 Scenario: No h5p capabilities
68 Given the following "permission overrides" exist:
69 | capability | permission | role | contextlevel | reference |
70 | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
71 | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
72 And I log in as "teacher1"
73 And I am on "Course 1" course homepage
74 And I follow "PageName1"
75 When I navigate to "Edit settings" in current page administration
76 Then "Insert H5P" "button" should not exist
297f7e41
BB
77
78 @javascript
79 Scenario: No embed h5p capabilities
59e87e62
BB
80 Given the following "permission overrides" exist:
81 | capability | permission | role | contextlevel | reference |
82 | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
297f7e41
BB
83 And I log in as "teacher1"
84 And I am on "Course 1" course homepage
85 And I follow "PageName1"
59e87e62
BB
86 When I navigate to "Edit settings" in current page administration
87 And I click on "Insert H5P" "button"
cf361145 88 Then I should not see "URL or embed code" in the "Insert H5P" "dialogue"
59e87e62
BB
89
90 @javascript
91 Scenario: No upload h5p capabilities
92 Given the following "permission overrides" exist:
93 | capability | permission | role | contextlevel | reference |
94 | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
95 And I log in as "teacher1"
96 And I am on "Course 1" course homepage
97 And I follow "PageName1"
98 When I navigate to "Edit settings" in current page administration
99 And I click on "Insert H5P" "button"
100 Then I should not see "H5P file upload" in the "Insert H5P" "dialogue"