disable_external_resources.feature 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
@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 |
11
     | UserA | Kupuhipa1 | UserA@example.org | Angela | User | mahara | internal | member |
12
    And the following "pages" exist:
13 14
      | title | description | ownertype | ownername |
      | Page UserA_01 | Page 01| user | UserA |
15 16 17

Scenario: Enable/disable external resources in mahara pages
# By default external resources are allowed in a page
18
 When I log in as "UserA" with password "Kupuhipa1"
19
 # 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
 And I follow "Page UserA_01"
24
 And I follow "Edit"
25 26 27 28 29 30 31 32

 # 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 top
45
 And I follow "Display page"
46 47
 Then I should see images within the block "Text block with an internal image"
 And I should see images within the block "Text block with an external image"
48 49 50 51
 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 administration menu
53 54 55 56
 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
57
 And I log in as "UserA" with password "Kupuhipa1"
58
 And I choose "Pages and collections" in "Portfolio" from main menu
59
 And I follow "Page UserA_01"
60 61
 Then I should see images within the block "Text block with an internal image"
 And I should not see images within the block "Text block with an external image"