Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
2
Feature: Inline editing H5P content
3
  In order to edit an existing H5P activity file
4
  As a teacher
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 | editingteacher |
20
      | student1 | C1 | student        |
21
    And the following "permission overrides" exist:
22
      | capability                 | permission | role           | contextlevel | reference |
23
      | moodle/h5p:updatelibraries | Allow      | editingteacher | System       |           |
24
    And the following "blocks" exist:
25
      | blockname     | contextlevel | reference | pagetypepattern | defaultregion |
26
      | private_files | System       | 1         | my-index        | side-post     |
27
 
28
  @javascript
29
  Scenario: Add H5P activity using link to content bank file
30
    Given the following "contentbank content" exist:
31
      | contextlevel | reference | contenttype     | user        | contentname        | filepath                                  |
32
      | Course       | C1        | contenttype_h5p | teacher1    | Greeting card      | /h5p/tests/fixtures/greeting-card.h5p     |
33
    And I log in as "admin"
34
    # Add the navigation block.
35
    And I am on "Course 1" course homepage with editing mode on
36
    And the following config values are set as admin:
37
      | unaddableblocks | | theme_boost|
38
    And I add the "Navigation" block if not present
39
    # Create an H5P activity with a link to the content-bank file.
40
    And I add an h5pactivity activity to course "Course 1" section "1"
41
    And I set the following fields to these values:
42
      | Name                       | H5P package added as link to content bank |
43
      | Description                | Description                                 |
44
    And I click on "Add..." "button" in the "Package file" "form_row"
45
    And I select "Content bank" repository in file picker
46
    And I click on "Greeting card" "file" in repository content area
47
    And I click on "Link to the file" "radio"
48
    And I click on "Select this file" "button"
49
    And I click on "Save and display" "button"
50
    And I switch to "h5p-player" class iframe
51
    And I switch to "h5p-iframe" class iframe
52
    And I should see "Hello world!"
53
    And I switch to the main frame
54
    # Modify the H5P content using the edit button (which opens the H5P editor).
55
    And I follow "Edit H5P content"
56
    And I should see "This content may be in use in other places."
57
    And I switch to "h5p-editor-iframe" class iframe
58
    And I set the field "Greeting text" to "It's a Wonderful Life!"
59
    And I switch to the main frame
60
    And I click on "Save changes" "button"
61
    And I switch to "h5p-player" class iframe
62
    And I switch to "h5p-iframe" class iframe
63
    # Check the H5P content has changed.
64
    And I should not see "Hello world!"
65
    And I should see "It's a Wonderful Life!"
66
    And I switch to the main frame
67
    # Check the H5P has also changed into the content bank.
68
    And I am on "Course 1" course homepage
69
    And I click on "Site pages" "list_item" in the "Navigation" "block"
70
    And I click on "Content bank" "link" in the "Navigation" "block"
71
    And I click on "Greeting card" "link"
72
    And I switch to "h5p-player" class iframe
73
    And I switch to "h5p-iframe" class iframe
74
    And I should not see "Hello world!"
75
    And I should see "It's a Wonderful Life!"
76
    And I switch to the main frame
77
    And I log out
78
    # Check teacher1 can see the Edit button (because she is the author of this file in the content bank).
79
    And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher1
80
    And I should see "Edit H5P content"
81
    And I log out
82
    # Check teacher2 can't see the Edit button (because the file was created by the teacher1).
83
    When I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher2
84
    Then I should not see "Edit H5P content"
85
    And I log out
86
    # Check student1 can't see the Edit button.
87
    And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as student1
88
    And I should not see "Edit H5P content"
89
 
90
  @javascript
91
  Scenario: Add H5P activity using copy to content bank file
92
    Given the following "contentbank content" exist:
93
      | contextlevel | reference | contenttype     | user     | contentname        | filepath                                  |
94
      | Course       | C1        | contenttype_h5p | admin    | Greeting card      | /h5p/tests/fixtures/greeting-card.h5p     |
95
    And I log in as "admin"
96
    # Add the navigation block.
97
    And I am on "Course 1" course homepage with editing mode on
98
    And the following config values are set as admin:
99
      | unaddableblocks | | theme_boost|
100
    And I add the "Navigation" block if not present
101
    # Create an H5P activity with a copy to the content-bank file.
102
    And I add an h5pactivity activity to course "Course 1" section "1"
103
    And I set the following fields to these values:
104
      | Name                       | H5P package added as copy to content bank |
105
      | Description                | Description                                 |
106
    And I click on "Add..." "button" in the "Package file" "form_row"
107
    And I select "Content bank" repository in file picker
108
    And I click on "Greeting card" "file" in repository content area
109
    And I click on "Make a copy of the file" "radio"
110
    And I click on "Select this file" "button"
111
    And I click on "Save and display" "button"
112
    And I switch to "h5p-player" class iframe
113
    And I switch to "h5p-iframe" class iframe
114
    And I should see "Hello world!"
115
    And I switch to the main frame
116
    # Modify the H5P content using the edit button (which opens the H5P editor).
117
    And I follow "Edit H5P content"
118
    And I should not see "This content may be in use in other places."
119
    And I switch to "h5p-editor-iframe" class iframe
120
    And I set the field "Greeting text" to "The nightmare before Christmas"
121
    And I switch to the main frame
122
    And I click on "Save changes" "button"
123
    # Check the H5P content has changed.
124
    And I switch to "h5p-player" class iframe
125
    And I switch to "h5p-iframe" class iframe
126
    And I should not see "Hello world!"
127
    And I should see "The nightmare before Christmas"
128
    And I switch to the main frame
129
    # Check the H5P has also changed into the content bank.
130
    And I am on "Course 1" course homepage
131
    And I click on "Site pages" "list_item" in the "Navigation" "block"
132
    And I click on "Content bank" "link" in the "Navigation" "block"
133
    And I click on "Greeting card" "link"
134
    And I switch to "h5p-player" class iframe
135
    And I switch to "h5p-iframe" class iframe
136
    And I should see "Hello world!"
137
    And I should not see "The nightmare before Christmas"
138
    And I switch to the main frame
139
    And I log out
140
    # Check teacher1 can see the Edit button (because the file is a copy).
141
    And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher1
142
    And I should see "Edit H5P content"
143
    And I log out
144
    # Check teacher2 can also see the Edit button (because the file is a copy).
145
    When I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher2
146
    Then I should see "Edit H5P content"
147
    And I log out
148
    # Check student1 can't see the Edit button.
149
    And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as student1
150
    And I should not see "Edit H5P content"
151
 
152
  @javascript
153
  Scenario: Add H5P activity using private user file
154
    Given I log in as "teacher1"
155
    # Upload the H5P to private user files.
156
    And I follow "Manage private files..."
157
    And I upload "h5p/tests/fixtures/greeting-card.h5p" file to "Files" filemanager
158
    And I click on "Save changes" "button"
159
    # Create an H5P activity with a private user file.
160
    And I add an h5pactivity activity to course "Course 1" section "1"
161
    And I set the following fields to these values:
162
      | Name                       | H5P package added as private user file      |
163
      | Description                | Description                                 |
164
    And I click on "Add..." "button" in the "Package file" "form_row"
165
    And I select "Private files" repository in file picker
166
    And I click on "greeting-card.h5p" "file" in repository content area
167
    And I click on "Link to the file" "radio"
168
    And I click on "Select this file" "button"
169
    And I click on "Save and display" "button"
170
    And I switch to "h5p-player" class iframe
171
    And I switch to "h5p-iframe" class iframe
172
    And I should see "Hello world!"
173
    And I switch to the main frame
174
    # Modify the H5P content using the edit button (which opens the H5P editor).
175
    And I follow "Edit H5P content"
176
    And I should see "This content may be in use in other places."
177
    And I switch to "h5p-editor-iframe" class iframe
178
    And I set the field "Greeting text" to "Little women"
179
    And I switch to the main frame
180
    And I click on "Save changes" "button"
181
    # Check the H5P content has changed.
182
    And I switch to "h5p-player" class iframe
183
    And I switch to "h5p-iframe" class iframe
184
    And I should not see "Hello world!"
185
    And I should see "Little women"
186
    And I switch to the main frame
187
    And I log out
188
    # Check admin can't see the Edit button (because the file belongs to teacher1).
189
    And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as admin
190
    And I should not see "Edit H5P content"
191
    And I log out
192
    # Check teacher2 can't see the Edit button (because the file belongs to teacher1).
193
    When I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as teacher2
194
    Then I should not see "Edit H5P content"
195
    And I log out
196
    # Check student1 can't see the Edit button.
197
    And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as student1
198
    And I should not see "Edit H5P content"