Failed scenarios:
<img alt="Embed%20Flag%20Earth%20in%20space" title="Embed%20Flag%20Earth%20all%20earth%20in%20space" height="667" width="1000" class="media-element file-default img-responsive" src="http://localhost/test/varbase3/sites/default/files/flag-earth_1.jpg">
It should be
<img alt="Embed Flag Earth in space" title="Embed Flag Earth all earth in space" height="667" width="1000" class="media-element file-default img-responsive" src="http://localhost/test/varbase3/sites/default/files/flag-earth_1.jpg">


Feature: File & Media Management - Assets Management - Ability to embed existing files library in the rich text editor
As a content admin
I want to be able to embed existing files from the library of files in the CKEditor
So that it will show up under that rich text field without having to upload the image for each content
Background:
Given I am a logged in user with the "test_super_admin" user
# Create the Basic page and upload the file to the library before the test case.
# ----------------------------------------------------------------------------
@javascript @local @development @staging @production
Scenario: Create the "Test Basic page to embed existing files" content.
When I go to "node/add/page"
And I wait
And I fill in "Test Basic page to embed existing files" for "Title"
And I fill in the rich text editor field "Body" with "Test Basic page body to embed existing files"
And I press the "Save" button
And I wait
Then I should see "Basic page Test Basic page to embed existing files has been created."
@local @development @staging @production
Scenario: Upload the "Embed Flag Earth" file.
When I go to "admin/content/file"
And I wait
Then I should see "Add file"
When I click "Add file"
And I wait
Then I should see "Upload a new file"
When I attach the file "flag-earth.jpg" to "Upload a new file"
And I press the "Upload" button
And I wait
Then I should see "flag-earth.jpg"
When I press the "Next" button
And I wait
Then I should see "Alt Text"
When I fill in "Embed Flag Earth" for "Name *"
And I fill in "Embed Flag Earth in space" for "Alt Text"
And I fill in "Embed Flag Earth all earth in space" for "Title Text"
And I press the "Save" button
And I wait
Then I should see "Add file"
And I should see the "Edit" in the "Embed Flag Earth" row
#-----------------------------------------------------------------------------
@javascript @local @development @staging @production
Scenario: Check if we are able to embed existing files library in the rich text editor.
When I go to "admin/content"
And I wait
Then I should see "Content"
When I fill in "Test Basic page to embed existing files" for "Title"
And I press the "Apply" button
And I wait
Then I should see "Test Basic page to embed existing files"
When I click "Test Basic page to embed existing files"
And I wait
Then I should see "Test Basic page body to embed existing files"
When I click "Edit"
And I wait
Then I should see "Edit Basic page Test Basic page to embed existing files"
When I click on "media" command button in the rich text editor field "Body"
And I wait for AJAX to finish
Then I should see "Media browser"
And the media browser is open
When I click on the "Library" tab under the media browser
And I wait for AJAX to finish
Then I should see "Media browser"
When I fill in "Embed Flag Earth" for "File name" under the media browser
And I press the "Apply" button under the media browser
And I wait
Then I should see "Embed Flag Earth" under the media browser
When I select the "Embed Flag Earth" file under the media browser
And I click "Submit" button under the media browser
And I wait for AJAX to finish
Then I should see "Embedding Embed Flag Earth" under the media browser style selector
When I click "Submit" button under the media browser style selector
And I wait for AJAX to finish
And I press the "Save" button
And I wait
Then I should see image with the "Embed Flag Earth" title text
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 2830057-6.patch | 803 bytes | rajab natshah |
| Behat-Test-Suite.png | 144.57 KB | rajab natshah | |
| Test-Basic-page-to-embed-existing-files-2016-11-23 20-19-16.png | 127.01 KB | rajab natshah |
Comments
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahInvestigating ....
json2 library. https://github.com/douglascrockford/JSON-js
and the pass of json image from the media browser to the WSYWIG.
It's right in Edit entity file.
But only in WSYWIG:
Comment #5
rajab natshahIt is encodeURIComponent
Drupal.media.formatForm.getOption
modules/contrib/media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
This will print out:
This is the behavior override
modules/contrib/media_ckeditor/js/media_ckeditor.format_form.js
This will print out the encodeURIComponent
Comment #6
rajab natshahThis is the patch to fix this issue.
Should be move to the media_ckeditor module
Comment #7
rajab natshahComment #8
joseph.olstadComment #10
joseph.olstadThis is a duplicate of:
#2720997: Overridden fields not encoded in token
Comment #11
rajab natshahPassed the full automated functional test.