Commit 356b6632 authored by Steven Spinelli's avatar Steven Spinelli Committed by Robert Lyon
Browse files

Bug 1786133 Check embedded images in Page description

Change-Id: I9b5a44c9992329ed4cf78dd36435dd63f88a3290
parent 2e6c3a67
......@@ -1639,6 +1639,23 @@ JS;
);
}
/**
* Check if image with title exists on the page
*
* @Then I should see image :imagetitle on the page
*
*/
public function i_should_see_image_on_page($imagetitle) {
// Find the image.
$imagetitleliteral = $this->escaper->escapeLiteral($imagetitle);
$exception = new ElementNotFoundException($this->getSession(), 'image');
$xpath = "//img[contains(concat(' ', normalize-space(@alt), ' '), " . $imagetitleliteral . ")]";
$image = $this->find('xpath', $xpath, $exception);
if (!$image->isVisible()) {
throw new ExpectationException('The image with alt ' . $imagetitleliteral . ' was not visible', $this->getSession());
}
}
/**
* Check if text exist in the block given its title
*
......
......@@ -4,9 +4,17 @@ Feature: Creating a page with stuff in it
As a user I need navigate to to portfolio
So I can create a page and add content to it
Background:
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| UserA | Kupuh1pa! | UserA@example.org | Angela | User | mahara | internal | member |
Scenario: Creating a page with content in it (Bug 1426983)
# Log in as "Admin" user
Given I log in as "admin" with password "Kupuh1pa!"
# set up for being able to use an image in WYSIWYG editor
And I choose "Files" in "Content" from main menu
And I attach the file "Image2.png" to "files_filebrowser_userfile"
# Navigating to Portfolio to create a page
# This is the test for manually creating a page
And I choose "Portfolio" from main menu
......@@ -24,8 +32,15 @@ Scenario: Creating a page with content in it (Bug 1426983)
| Page title | This is the edited page title |
# Change the page description
And I fill in "This is the edited description" in first editor
# Upload an image into the WYSIWYG editor
And I click the "Insert/edit image" button in the editor
And I expand the section "Image"
And I press "Select \"Image2.png\""
And I press "Submit"
And I wait "1" seconds
And I press "Save"
# Adding media block
# Adding media blockAnd I fill in the following:
| Page title | This is the edited page title |
And I expand "Media" node
And I follow "File(s) to download"
And I press "Add"
......@@ -47,6 +62,7 @@ Scenario: Creating a page with content in it (Bug 1426983)
And I follow "External media"
And I press "Add"
And I press "Remove"
And I display the page
# Show last updated date and time when seeing a portfolio page (Bug 1634591)
And I should see "Updated on" in the ".text-right" element
......@@ -54,8 +70,32 @@ Scenario: Creating a page with content in it (Bug 1426983)
And I should see the date "today" in the ".text-right" element with the format "d F Y"
# Verifying the page title and description changed
Then I should see "This is the edited page title"
Then I should see "This is the edited description"
And I should see "This is the edited description"
# Check that the image is displayed on page and ensure the link is correct
Then I should see image "Image2.png" on the page
# User share page with public and enable copy page functionality
And I choose "Pages and collections" in "Portfolio" from main menu
And I click on "Manage access" in "This is the edited page title" panel access menu
And I follow "Advanced options"
And I enable the switch "Allow copying"
And I select "Public" from "General" in shared with select2 box
And I press "Save"
And I log out
# Log in as UserA and copy the page
Given I log in as "UserA" with password "Kupuh1pa!"
And I wait "1" seconds
Then I should see "This is the edited page title"
When I follow "This is the edited page title"
And I follow "Copy"
And I fill in the following:
| Page title | This is my page now |
And I press "Save"
And I follow "Display page"
# Check that the image is displayed on copied page and ensure the link is correct
Then I should see image "Image2.png" on the page
And I log out
# check page can be deleted (Bug 1755682)
Given I log in as "admin" with password "Kupuh1pa!"
And I choose "Pages and collections" in "Portfolio" from main menu
And I click on "Delete" in "This is the edited page" panel menu
And I should see "Do you really want to delete this page?"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment