disable_external_resources.feature 2.69 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@javascript @core @core_administration
Feature: Enable/disable external resources to display in pages
In order to control external resources displayed in mahara pages
As an admin
For security reason, I can enable/disable the setting "Disable external resources" in
"Site configuration" page

Background:
    Given the following "users" exist:
     | username | password | email | firstname | lastname | institution | authname | role |
     | userA | Kupuhipa1 | test01@example.com | Pete | Mc | mahara | internal | member |
    And the following "pages" exist:
      | title | description| ownertype | ownername |
      | Page 1 | This is the page | user | userA |

Scenario: Enable/disable external resources in mahara pages
# By default external resources are allowed in a page
 When I log in as "userA" with password "Kupuhipa1"
 # Upload an image
20
 And I choose "Files" in "Content" from Main menu
21
 And I attach the file "Image2.png" to "files_filebrowser_userfile"
22
 And I choose "Pages and collections" in "Portfolio" from Main menu
23
24
25
26
27
28
29
30
31
32
 And I follow "Page 1"
 And I follow "Edit this page"

 # Add a "Text" block with an image from file area
 And I follow "Text"
 And I press "Add"
 And I set the following fields to these values:
 | Block title | Text block with an internal image |
 And I click the "Insert/edit image" button in the editor
 And I expand the section "Image"
33
 And I press "Select \"Image2.png\""
34
35
36
37
38
39
40
41
42
43
 And I press "Submit"
 And I press "Save"

 # Add a "Text" block with an embedded external image
 And I follow "Text"
 And I press "Add"
 And I set the following fields to these values:
 | Block title | Text block with an external image |
 | Block content | <p><img title="Open source logo" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Opensource.svg/744px-Opensource.svg.png" alt="" width="300" /></p> |
 And I press "Save"
44
 And I scroll to the id "main-column-container"
45
46
47
48
49
50
51
 And I follow "Display page"
 Then I should see images in the block "Text block with an internal image"
 And I should see images in the block "Text block with an external image"
 And I log out

# Disable external resources and check if external images are displayed in pages
 When I log in as "admin" with password "Kupuhipa1"
52
 And I choose "Site options" in "Configure site" from Admin menu
53
54
55
56
57
 And I expand the section "Security settings"
 And I enable the switch "Disable external resources in user HTML"
 And I press "Update site options"
 And I log out
 And I log in as "userA" with password "Kupuhipa1"
58
 And I choose "Pages and collections" in "Portfolio" from Main menu
59
60
 And I follow "Page 1"
 Then I should see images in the block "Text block with an internal image"
61
 And I should not see images in the block "Text block with an external image"