2013-10-08 00:23:44 +02:00
|
|
|
@assets
|
|
|
|
Feature: Insert an image into a page
|
|
|
|
As a cms author
|
|
|
|
I want to insert an image into a page
|
|
|
|
So that I can insert them into my content efficiently
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given a "page" "About Us"
|
2016-02-24 02:29:02 +01:00
|
|
|
And a "image" "folder1/file1.jpg"
|
|
|
|
And a "image" "folder1/file2.jpg"
|
2013-10-08 00:23:44 +02:00
|
|
|
And I am logged in with "ADMIN" permissions
|
|
|
|
And I go to "/admin/pages"
|
|
|
|
And I click on "About Us" in the tree
|
|
|
|
|
|
|
|
Scenario: I can insert an image from a URL
|
2016-02-15 02:58:24 +01:00
|
|
|
Given I press the "Insert Media" HTML field button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2015-10-23 05:01:29 +02:00
|
|
|
When I press the "Insert from URL" button
|
2015-07-18 05:38:44 +02:00
|
|
|
And I fill in "RemoteURL" with "http://www.silverstripe.org/themes/ssv3/img/ss_logo.png"
|
2013-10-08 00:23:44 +02:00
|
|
|
And I press the "Add url" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then I should see "ss_logo.png" in the ".ss-assetuploadfield span.name" element
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2016-02-15 02:58:24 +01:00
|
|
|
When I press the "Insert" button
|
2015-07-18 05:38:44 +02:00
|
|
|
Then the "Content" HTML field should contain "ss_logo.png"
|
2013-10-08 00:23:44 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
Then I press the "Save draft" button
|
|
|
|
|
2013-10-23 21:58:28 +02:00
|
|
|
@assets
|
2013-10-08 00:23:44 +02:00
|
|
|
Scenario: I can insert an image uploaded from my own computer
|
2016-02-15 02:58:24 +01:00
|
|
|
Given I press the "Insert Media" HTML field button
|
2013-10-08 00:23:44 +02:00
|
|
|
And I attach the file "testfile.jpg" to "AssetUploadField" with HTML5
|
2013-10-23 21:58:28 +02:00
|
|
|
# TODO Delay previous step until upload succeeded
|
|
|
|
And I wait for 2 seconds
|
2016-02-24 02:29:02 +01:00
|
|
|
Then there should be a filename "Uploads/testfile.jpg" with hash "59de0c841f0da39f1d21ab12cd4fa85b8a91457c"
|
2013-10-08 00:23:44 +02:00
|
|
|
When I press the "Insert" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then the "Content" HTML field should contain "testfile__Resampled.jpg"
|
2013-10-23 21:58:28 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
Then I press the "Save draft" button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2013-10-23 21:58:28 +02:00
|
|
|
@assets
|
2014-06-17 22:58:55 +02:00
|
|
|
Scenario: I can upload an image from my own computer that matches the name of an existing file
|
2016-02-24 02:29:02 +01:00
|
|
|
Given a "image" "Uploads/file1.jpg"
|
2016-02-15 02:58:24 +01:00
|
|
|
When I press the "Insert Media" HTML field button
|
2013-10-23 21:58:28 +02:00
|
|
|
And I attach the file "file1.jpg" to "AssetUploadField" with HTML5
|
|
|
|
# TODO Delay previous step until upload succeeded
|
|
|
|
And I wait for 2 seconds
|
2014-06-17 22:58:55 +02:00
|
|
|
# Note change in default behaviour from 3.1, respect default Upload.replaceFile=false
|
2016-02-24 02:29:02 +01:00
|
|
|
Then there should be a filename "Uploads/file1.jpg" with hash "3d0ef6ec372233e08e87f6e1f02ace9c93ce11fe"
|
|
|
|
And there should be a filename "Uploads/file1-v2.jpg" with hash "3d0ef6ec372233e08e87f6e1f02ace9c93ce11fe"
|
2013-10-23 21:58:28 +02:00
|
|
|
When I press the "Insert" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then the "Content" HTML field should contain "file1-v2__Resampled.jpg"
|
2013-10-23 21:58:28 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
Then I press the "Save draft" button
|
|
|
|
|
2013-10-08 00:23:44 +02:00
|
|
|
Scenario: I can insert an image from the CMS file store
|
2016-02-15 02:58:24 +01:00
|
|
|
Given I press the "Insert Media" HTML field button
|
2014-01-05 22:47:45 +01:00
|
|
|
And I fill in the "ParentID" dropdown with "folder1"
|
2015-07-10 04:53:17 +02:00
|
|
|
And I click on "file1" in the "Files" table
|
2013-10-08 00:23:44 +02:00
|
|
|
When I press the "Insert" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then the "Content" HTML field should contain "file1__Resampled.jpg"
|
2013-10-23 21:58:28 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
Then I press the "Save draft" button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
|
|
|
Scenario: I can edit properties of an image before inserting it
|
2016-02-15 02:58:24 +01:00
|
|
|
Given I press the "Insert Media" HTML field button
|
2014-01-05 22:47:45 +01:00
|
|
|
And I fill in the "ParentID" dropdown with "folder1"
|
2015-07-10 04:53:17 +02:00
|
|
|
And I click on "file1" in the "Files" table
|
2014-01-05 22:47:45 +01:00
|
|
|
And I press the "Edit" button
|
2013-10-08 00:23:44 +02:00
|
|
|
When I fill in "Alternative text (alt)" with "My alt"
|
|
|
|
And I press the "Insert" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then the "Content" HTML field should contain "file1__Resampled.jpg"
|
2013-10-08 00:23:44 +02:00
|
|
|
And the "Content" HTML field should contain "My alt"
|
2013-10-23 21:58:28 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
Then I press the "Save draft" button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2014-01-05 22:47:45 +01:00
|
|
|
# TODO This needs to support using drag handles, as we no longer have 'Width' or 'Height' input fields
|
2013-10-08 00:23:44 +02:00
|
|
|
@todo
|
|
|
|
Scenario: I can edit dimensions of an existing image
|
2015-10-15 00:08:52 +02:00
|
|
|
Given the "page" "About us" contains "<img src=assets/folder1/3d0ef6ec37/file1.jpg>"
|
2013-10-08 00:23:44 +02:00
|
|
|
And I reload the current page
|
2015-10-15 00:08:52 +02:00
|
|
|
When I highlight "<img src=assets/folder1/3d0ef6ec37/file1.jpg>" in the "Content" HTML field
|
2016-02-15 02:58:24 +01:00
|
|
|
And I press the "Insert Media" HTML field button
|
2013-10-08 00:23:44 +02:00
|
|
|
Then I should see "file1.jpg"
|
|
|
|
When I fill in "Width" with "10"
|
|
|
|
When I fill in "Height" with "20"
|
|
|
|
And I press the "Insert" button
|
2015-10-15 00:08:52 +02:00
|
|
|
Then the "Content" HTML field should contain "<img src=assets/folder1/3d0ef6ec37/file1.jpg width=10 height=20>"
|
2013-10-23 21:58:28 +02:00
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
2015-08-18 01:28:08 +02:00
|
|
|
Then I press the "Save draft" button
|