Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

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