11 |
efrain |
1 |
@mod @mod_forum @filter @filter_displayh5p @core_h5p @_file_upload @_switch_iframe
|
1 |
efrain |
2 |
Feature: Inline editing H5P content in mod_forum
|
|
|
3 |
In order to edit an existing H5P content
|
|
|
4 |
As a user
|
|
|
5 |
I need to see the button and access to the H5P editor
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
12 |
| student1 | Student | 1 | student1@example.com |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category |
|
|
|
15 |
| Course 1 | C1 | 0 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
| teacher2 | C1 | teacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
And the following "contentbank content" exist:
|
|
|
22 |
| contextlevel | reference | contenttype | user | contentname | filepath |
|
|
|
23 |
| Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p |
|
|
|
24 |
And the following "activities" exist:
|
|
|
25 |
| activity | name | introformat | course | content | contentformat | idnumber |
|
|
|
26 |
| forum | ForumName1 | 1 | C1 | H5Ptest | 1 | 1 |
|
|
|
27 |
And the "displayh5p" filter is "on"
|
|
|
28 |
# Override this capability to let teachers and students to Turn editing on.
|
|
|
29 |
And the following "permission overrides" exist:
|
|
|
30 |
| capability | permission | role | contextlevel | reference |
|
|
|
31 |
| moodle/course:update | Allow | teacher | System | |
|
|
|
32 |
| moodle/course:update | Allow | student | System | |
|
|
|
33 |
|
|
|
34 |
@javascript @repository_contentbank
|
|
|
35 |
Scenario: Edit H5P content from a forum intro using copy to content bank file
|
|
|
36 |
Given I am on the "ForumName1" "forum activity editing" page logged in as admin
|
|
|
37 |
# Add H5P content to the forum description.
|
11 |
efrain |
38 |
And I click on "Configure H5P content" "button" in the "#fitem_id_introeditor" "css_element"
|
|
|
39 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
40 |
And I select "Content bank" repository in file picker
|
|
|
41 |
And I click on "Greeting card" "file" in repository content area
|
|
|
42 |
And I click on "Make a copy of the file" "radio"
|
|
|
43 |
And I click on "Select this file" "button"
|
11 |
efrain |
44 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
45 |
And I click on "Save and display" "button"
|
|
|
46 |
And I switch to "h5p-iframe" class iframe
|
|
|
47 |
And I switch to "h5p-iframe" class iframe
|
|
|
48 |
And I should see "Hello world!"
|
|
|
49 |
And I switch to the main frame
|
|
|
50 |
# The Edit button is only displayed when editing mode is on.
|
|
|
51 |
And I should not see "Edit H5P content"
|
|
|
52 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
53 |
And I am on the "ForumName1" "forum activity" page
|
|
|
54 |
Then I should see "Edit H5P content"
|
|
|
55 |
And I log out
|
|
|
56 |
# Check teacher1 can see the Edit button too.
|
|
|
57 |
And I log in as "teacher1"
|
|
|
58 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
59 |
And I am on the "ForumName1" "forum activity" page
|
|
|
60 |
And I should see "Edit H5P content"
|
|
|
61 |
And I log out
|
|
|
62 |
# Check teacher2 (non-editing teacher) can't see the Edit button, because she can't edit the forum activity.
|
|
|
63 |
And I log in as "teacher2"
|
|
|
64 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
65 |
And I am on the "ForumName1" "forum activity" page
|
|
|
66 |
And I should not see "Edit H5P content"
|
|
|
67 |
And I log out
|
|
|
68 |
# Check student1 can't see the Edit button.
|
|
|
69 |
And I log in as "student1"
|
|
|
70 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
71 |
And I am on the "ForumName1" "forum activity" page
|
|
|
72 |
And I should not see "Edit H5P content"
|
|
|
73 |
|
|
|
74 |
@javascript @repository_contentbank
|
|
|
75 |
Scenario: Edit H5P content from a forum post
|
|
|
76 |
Given the following "mod_forum > discussions" exist:
|
|
|
77 |
| user | forum | name | message |
|
|
|
78 |
| admin | 1 | Forum post by admin | Forum post by admin |
|
|
|
79 |
Given I am on the "ForumName1" "forum activity" page logged in as admin
|
|
|
80 |
And I follow "Forum post by admin"
|
|
|
81 |
And I click on "Edit" "link"
|
|
|
82 |
# Add H5P content to a forum post as admin.
|
|
|
83 |
And I set the following fields to these values:
|
|
|
84 |
| Subject | Forum post by admin |
|
11 |
efrain |
85 |
And I click on "Configure H5P content" "button" in the "#fitem_id_message" "css_element"
|
|
|
86 |
And I click on "Browse repositories..." "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
87 |
And I select "Content bank" repository in file picker
|
|
|
88 |
And I click on "Greeting card" "file" in repository content area
|
|
|
89 |
And I click on "Select this file" "button"
|
11 |
efrain |
90 |
And I click on "Insert H5P" "button" in the "Insert H5P content" "dialogue"
|
1 |
efrain |
91 |
And I press "Save changes"
|
|
|
92 |
And I switch to "h5p-iframe" class iframe
|
|
|
93 |
And I switch to "h5p-iframe" class iframe
|
|
|
94 |
And I should see "Hello world!"
|
|
|
95 |
And I switch to the main frame
|
|
|
96 |
# The Edit button is only displayed when editing mode is on.
|
|
|
97 |
And I should not see "Edit H5P content"
|
|
|
98 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
99 |
And I am on the "ForumName1" "forum activity" page
|
|
|
100 |
And I follow "Forum post by admin"
|
|
|
101 |
Then I should see "Edit H5P content"
|
|
|
102 |
And I log out
|
|
|
103 |
# Check teacher1 can see the Edit button because she can edit the post too.
|
|
|
104 |
And I log in as "teacher1"
|
|
|
105 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
106 |
And I am on the "ForumName1" "forum activity" page
|
|
|
107 |
And I follow "Forum post by admin"
|
|
|
108 |
And I should see "Edit H5P content"
|
|
|
109 |
And I log out
|
|
|
110 |
# Check teacher2 (non-editing teacher) can see the Edit button because she can edit the post too.
|
|
|
111 |
And I log in as "teacher2"
|
|
|
112 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
113 |
And I am on the "ForumName1" "forum activity" page
|
|
|
114 |
And I follow "Forum post by admin"
|
|
|
115 |
And I should see "Edit H5P content"
|
|
|
116 |
And I log out
|
|
|
117 |
# Check student1 can't see the Edit button.
|
|
|
118 |
And I log in as "student1"
|
|
|
119 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
120 |
And I am on the "ForumName1" "forum activity" page
|
|
|
121 |
And I follow "Forum post by admin"
|
|
|
122 |
And I should not see "Edit H5P content"
|