2017-04-21 07:10:48 +02:00
|
|
|
@assets @retry
|
2013-10-08 00:23:44 +02:00
|
|
|
Feature: Insert links into a page
|
|
|
|
As a cms author
|
|
|
|
I want to insert a link into my content
|
|
|
|
So that I can link to a external website or a page on my site
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given a "page" "Home"
|
2017-09-05 04:38:38 +02:00
|
|
|
And a "page" "About Us" has the "Content" "<p>My awesome content</p>"
|
|
|
|
And a "file" "file1.jpg"
|
2023-09-07 00:24:09 +02:00
|
|
|
# And the "group" "EDITOR" has permissions "Access to 'Pages' section"
|
|
|
|
And the "group" "EDITOR" has permissions "Access to 'Files' section" and "Access to 'Pages' section" and "FILE_EDIT_ALL"
|
2022-09-05 22:44:46 +02:00
|
|
|
And I am logged in as a member of "EDITOR" group
|
2017-09-05 04:38:38 +02:00
|
|
|
And I go to "/admin/pages"
|
|
|
|
And I click on "About Us" in the tree
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2017-05-25 07:29:32 +02:00
|
|
|
Scenario: I can link to an internal page
|
2017-09-05 04:38:38 +02:00
|
|
|
When I select "awesome" in the "Content" HTML field
|
2018-09-12 03:14:06 +02:00
|
|
|
And I press the "Insert link" HTML field button
|
2022-09-19 06:59:29 +02:00
|
|
|
And I click "Page on this site" in the ".tox-collection__group" element
|
2017-09-05 04:38:38 +02:00
|
|
|
Then I should see an "form#Form_editorInternalLink" element
|
2023-01-09 01:01:49 +01:00
|
|
|
When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown
|
2017-05-25 07:29:32 +02:00
|
|
|
And I fill in "my desc" for "Link description"
|
2022-09-19 06:59:29 +02:00
|
|
|
And I press the "Insert link" button
|
2017-05-25 07:29:32 +02:00
|
|
|
Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]">awesome</a>"
|
|
|
|
# Required to avoid "unsaved changes" browser dialog
|
2018-02-09 00:18:57 +01:00
|
|
|
Then I press the "Save" button
|
2017-05-25 07:29:32 +02:00
|
|
|
|
2023-09-11 02:33:00 +02:00
|
|
|
Scenario: I can wrap an image in a link to an internal page
|
|
|
|
Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>"
|
|
|
|
When I select the image "file1.jpg" in the "Content" HTML field
|
|
|
|
And I press the "Insert link" HTML field button
|
|
|
|
And I click "Page on this site" in the ".tox-collection__group" element
|
|
|
|
Then I should see an "form#Form_editorInternalLink" element
|
|
|
|
And I should not see "Link text"
|
|
|
|
When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown
|
|
|
|
And I press the "Insert link" button
|
|
|
|
Then the "Content" HTML field should contain "<a href="[sitetree_link,id=2]"><img src="file1.jpg"></a>"
|
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
And I press the "Save" button
|
|
|
|
|
2017-05-25 07:29:32 +02:00
|
|
|
Scenario: I can edit a link to an internal page
|
|
|
|
Given I fill in the "Content" HTML field with "<a title='my desc' href='[sitetree_link,id=2]'>awesome</a>"
|
|
|
|
And I select "awesome" in the "Content" HTML field
|
2018-09-12 03:14:06 +02:00
|
|
|
And I press the "Insert link" HTML field button
|
2022-09-19 06:59:29 +02:00
|
|
|
And I click "Page on this site" in the ".tox-collection__group" element
|
2017-05-25 07:29:32 +02:00
|
|
|
And I should see an "form#Form_editorInternalLink" element
|
2023-01-29 22:32:26 +01:00
|
|
|
Then I should see "About Us" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element
|
2017-05-25 07:29:32 +02:00
|
|
|
And the "Link description" field should contain "my desc"
|
|
|
|
# This doesn't seem to suffer from that issue
|
2023-01-09 01:01:49 +01:00
|
|
|
When I select "Home" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown
|
2017-05-25 07:29:32 +02:00
|
|
|
And I fill in "my new desc" for "Link description"
|
2022-09-19 06:59:29 +02:00
|
|
|
And I press the "Insert link" button
|
2017-05-25 07:29:32 +02:00
|
|
|
Then the "Content" HTML field should contain "<a title="my new desc" href="[sitetree_link,id=1]">awesome</a>"
|
|
|
|
# Required to avoid "unsaved changes" browser dialog
|
2018-02-09 00:18:57 +01:00
|
|
|
Then I press the "Save" button
|
2017-05-25 07:29:32 +02:00
|
|
|
|
2013-10-08 00:23:44 +02:00
|
|
|
Scenario: I can link to an external URL
|
|
|
|
Given I select "awesome" in the "Content" HTML field
|
2018-09-12 03:14:06 +02:00
|
|
|
And I press the "Insert link" HTML field button
|
2022-09-19 06:59:29 +02:00
|
|
|
When I click "Link to external URL" in the ".tox-collection__group" element
|
2017-05-25 07:29:32 +02:00
|
|
|
And I should see an "form#Form_ModalsEditorExternalLink" element
|
2017-05-09 04:07:31 +02:00
|
|
|
When I fill in "http://silverstripe.org" for "URL"
|
|
|
|
And I check "Open in new window/tab"
|
2022-09-19 06:59:29 +02:00
|
|
|
And I press the "Insert link" button
|
2017-08-15 01:05:56 +02:00
|
|
|
Then the "Content" HTML field should contain "<a rel="noopener" href="http://silverstripe.org" target="_blank">awesome</a>"
|
2014-01-06 02:38:02 +01:00
|
|
|
# Required to avoid "unsaved changes" browser dialog
|
2018-02-09 00:18:57 +01:00
|
|
|
Then I press the "Save" button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2023-09-11 02:33:00 +02:00
|
|
|
Scenario: I can wrap an image in a link to an external URL
|
|
|
|
Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>"
|
|
|
|
When I select the image "file1.jpg" in the "Content" HTML field
|
|
|
|
And I press the "Insert link" HTML field button
|
|
|
|
When I click "Link to external URL" in the ".tox-collection__group" element
|
|
|
|
And I should see an "form#Form_ModalsEditorExternalLink" element
|
|
|
|
And I should not see "Link text"
|
|
|
|
When I fill in "http://silverstripe.org" for "URL"
|
|
|
|
And I press the "Insert link" button
|
|
|
|
Then the "Content" HTML field should contain "<a href="http://silverstripe.org"><img src="file1.jpg"></a>"
|
|
|
|
# Required to avoid "unsaved changed" browser dialog
|
|
|
|
And I press the "Save" button
|
|
|
|
|
2023-09-07 00:24:09 +02:00
|
|
|
Scenario: I can edit an external link
|
2014-08-01 02:03:07 +02:00
|
|
|
Given I fill in the "Content" HTML field with "<p>My <a href='http://silverstripe.org'>awesome</a> content"
|
2017-05-09 04:07:31 +02:00
|
|
|
And I select "awesome" in the "Content" HTML field
|
2018-09-12 03:14:06 +02:00
|
|
|
When I press the "Insert link" HTML field button
|
2022-09-19 06:59:29 +02:00
|
|
|
And I click "Link to external URL" in the ".tox-collection__group" element
|
2017-05-25 07:29:32 +02:00
|
|
|
And I should see an "form#Form_ModalsEditorExternalLink" element
|
2017-05-09 04:07:31 +02:00
|
|
|
Then the "URL" field should contain "http://silverstripe.org"
|
2014-01-06 02:38:02 +01:00
|
|
|
# This doesn't seem to suffer from that issue
|
|
|
|
When I fill in "http://google.com" for "URL"
|
2022-09-19 06:59:29 +02:00
|
|
|
And I press the "Insert link" button
|
2014-01-06 02:38:02 +01:00
|
|
|
Then the "Content" HTML field should contain "<a href="http://google.com">awesome</a>"
|
|
|
|
# Required to avoid "unsaved changes" browser dialog
|
2018-02-09 00:18:57 +01:00
|
|
|
Then I press the "Save" button
|
2013-10-08 00:23:44 +02:00
|
|
|
|
2023-09-07 00:24:09 +02:00
|
|
|
Scenario: I can remove an external link
|
2014-08-01 02:03:07 +02:00
|
|
|
Given I fill in the "Content" HTML field with "My <a href='http://silverstripe.org'>awesome</a> content"
|
2017-07-14 04:59:07 +02:00
|
|
|
And I select "awesome" in the "Content" HTML field
|
|
|
|
When I press the "Remove link" button
|
2014-01-06 02:38:02 +01:00
|
|
|
Then the "Content" HTML field should contain "My awesome content"
|
2017-07-14 04:59:07 +02:00
|
|
|
And the "Content" HTML field should not contain "http://silverstripe.org"
|
2014-01-06 02:38:02 +01:00
|
|
|
# Required to avoid "unsaved changes" browser dialog
|
2018-02-09 00:18:57 +01:00
|
|
|
Then I press the "Save" button
|