Proyectos de Subversion Moodle

Rev

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

Rev Autor Línea Nro. Línea
1 efrain 1
@editor @filter @filter_displayh5p @core_h5p @_file_upload @_switch_iframe
2
Feature: Render H5P content using filters
3
  To write rich text - I need to render H5P content.
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
      | student1 | Student   | 1        | student1@example.com |
13
    And the following "course enrolments" exist:
14
      | user     | course | role           |
15
      | teacher1 | C1     | editingteacher |
16
      | student1 | C1     | student        |
17
    And the "displayh5p" filter is "on"
18
    And the following config values are set as admin:
19
      | allowedsources | https://moodle.h5p.com/content/[id]/embed | filter_displayh5p |
20
 
21
  @javascript @external
22
  Scenario: Render an external H5P content URL.
23
    Given the following "activities" exist:
24
      | activity | name      | intro     | introformat | course | content                                                                      | contentformat | idnumber |
25
      | page     | PageName1 | PageDesc1 | 1           | C1     | <div>Go for it</div>https://moodle.h5p.com/content/1290772960722742119/embed | 1             | 1        |
26
    When I am on the PageName1 "page activity" page logged in as teacher1
27
    And I switch to "h5p-iframe" class iframe
28
    Then I should see "Lorum ipsum"
29
 
30
  @javascript
31
  Scenario: Add an external H5P content URL in a link with the URL. Should be rendered.
32
    Given the following "activities" exist:
33
      | activity | name      | intro     | introformat | course | content                                                                                                                         | contentformat | idnumber |
34
      | page     | PageName1 | PageDesc1 | 1           | C1     | <a href='https://moodle.h5p.com/content/1290772960722742119/embed'>https://moodle.h5p.com/content/1290772960722742119/embed</a> | 1             | 1        |
35
    When I am on the PageName1 "page activity" page logged in as teacher1
36
    And I switch to "h5p-iframe" class iframe
37
    Then I should see "Lorum ipsum"
38
 
39
  Scenario: Add an external H5P content URL in a link with text. Shouldn't be rendered.
40
#   This content won't be displayed, so this scenario shouldn't be labeled as external.
41
    Given the following "activities" exist:
42
      | activity | name      | intro     | introformat | course | content                                                                                         | contentformat | idnumber |
43
      | page     | PageName1 | PageDesc1 | 1           | C1     | <a href='https://moodle.h5p.com/content/1290772960722742119/embed'>Here you are the content</a> | 1             | 1        |
44
    When I am on the PageName1 "page activity" page logged in as teacher1
45
    Then ".h5p-iframe" "css_element" should not exist
46
 
47
  @javascript
48
  Scenario: Render a local H5P file as admin
49
    Given the following "activities" exist:
50
      | activity | name      | intro     | introformat | course | content                                                                          | contentformat | idnumber | [[files::content]]                        |
51
      | page     | PageName1 | PageDesc1 | 1           | C1     | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1             | 1        | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p |
52
    When I am on the PageName1 "page activity" page logged in as teacher1
53
    And I should see "PageName1" in the "page-header" "region"
54
#   Switch to iframe created by filter
55
    And I switch to "h5p-iframe" class iframe
56
#   Switch to iframe created by embed.php page
57
    And I switch to "h5p-iframe" class iframe
58
    Then I should see "Lorum ipsum"
59
    And I switch to the main frame
60
    And I log out
61
    And I am on the PageName1 "page activity" page logged in as student1
62
#   Switch to iframe created by filter
63
    And I switch to "h5p-iframe" class iframe
64
#   Switch to iframe created by embed.php page
65
    And I switch to "h5p-iframe" class iframe
66
    Then I should not see "you don't have access"
67
    And I should see "Lorum ipsum"
68
 
69
  @javascript
70
  Scenario: Render a local H5P file as teacher
71
    Given the following "activities" exist:
72
      | activity | name      | intro     | introformat | course | content                                                                          | contentformat | idnumber | [[files::content]]                                  |
73
      | page     | PageName1 | PageDesc1 | 1           | C1     | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1             | 1        | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::teacher1 |
74
    When I am on the PageName1 "page activity" page logged in as teacher1
75
    And I should see "PageName1" in the "page-header" "region"
76
#   Switch to iframe created by filter
77
    And I switch to "h5p-iframe" class iframe
78
    Then I should see "Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries."
79
    And I should see "missing-required-library"
80
 
81
  @javascript
82
  Scenario: Render a local H5P file with existing libraries
83
    Given the following "activities" exist:
84
      | activity | name      | intro     | introformat | course | content                                                                          | contentformat | idnumber | [[files::content]]                                  |
85
      | page     | PageName1 | PageDesc1 | 1           | C1     | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1             | 1        | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::teacher1 |
86
      | page     | PageName2 | PageDesc2 | 1           | C1     | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1             | 1        | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::admin    |
87
    When I am on the PageName1 "page activity" page logged in as teacher1
88
    And I should see "PageName1" in the "page-header" "region"
89
#   Switch to iframe created by filter
90
    And I switch to "h5p-iframe" class iframe
91
#   Libraries don't exist, so an error should be displayed.
92
    Then I should see "missing-required-library"
93
    And I switch to the main frame
94
    And I am on the PageName2 "page activity" page logged in as admin
95
    And I should see "PageName2" in the "page-header" "region"
96
#   Switch to iframe created by filter
97
    And I switch to "h5p-iframe" class iframe
98
#   Switch to iframe created by embed.php page
99
    And I switch to "h5p-iframe" class iframe
100
#   Libraries have been installed.
101
    Then I should see "Lorum ipsum"
102
    And I switch to the main frame
103
    And I am on the PageName1 "page activity" page logged in as teacher1
104
#   Switch to iframe created by filter
105
    And I switch to "h5p-iframe" class iframe
106
#   Switch to iframe created by embed.php page
107
    And I switch to "h5p-iframe" class iframe
108
    Then I should not see "missing-required-library"
109
    And I should see "Lorum ipsum"
110
 
111
  @javascript
112
  Scenario: Render local H5P file with a disabled main library
113
    Given the following "activities" exist:
114
      | activity | name      | intro     | introformat | course | content                                                                          | contentformat | idnumber | [[files::content]]                        |
115
      | page     | PageName1 | PageDesc1 | 1           | C1     | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1             | 1        | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p |
116
    When I am logged in as "admin"
117
# Upload manually the H5P content-type library and disable it.
118
    And I navigate to "H5P > Manage H5P content types" in site administration
119
    And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
120
    And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
121
    And I click on "Disable" "link" in the "Accordion" "table_row"
122
    And I am on the PageName1 "page activity" page logged in as admin
123
    And I should see "PageName1" in the "page-header" "region"
124
    And I switch to "h5p-iframe" class iframe
125
#   Library is disabled, so an error should be displayed.
126
    Then I should see "This file can't be displayed because its content type is disabled."
127
    And I should not see "Lorum ipsum"
128
    And I switch to the main frame
129
    And I navigate to "H5P > Manage H5P content types" in site administration
130
    And I click on "Enable" "link" in the "Accordion" "table_row"
131
#   Content should be deployed now that main library is enabled.
132
    And I am on the PageName1 "page activity" page
133
#   Switch to iframe created by filter.
134
    And I switch to "h5p-iframe" class iframe
135
#   Switch to iframe created by embed.php page.
136
    And I switch to "h5p-iframe" class iframe
137
    Then I should see "Lorum ipsum"
138
    And I should not see "This file can't be displayed because its content type is disabled."
139
    And I switch to the main frame
140
    And I navigate to "H5P > Manage H5P content types" in site administration
141
    And I click on "Disable" "link" in the "Accordion" "table_row"
142
#   Library is disabled again, so an error should be displayed.
143
    And I am on the PageName1 "page activity" page
144
    And I switch to "h5p-iframe" class iframe
145
    Then I should see "This file can't be displayed because its content type is disabled."
146
    And I should not see "Lorum ipsum"
147
    And I switch to the main frame