From f3b442e9b4e52da63bdd527cd44a10bdedf38268 Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Tue, 9 May 2017 14:07:31 +1200 Subject: [PATCH] Fix behat tests for insert link to work with react implementation --- tests/behat/features/insert-a-link.feature | 66 ++++------------------ 1 file changed, 10 insertions(+), 56 deletions(-) diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index e40acff5..b430c101 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -13,71 +13,25 @@ So that I can link to a external website or a page on my site And I go to "/admin/pages" And I click on "About Us" in the tree - Scenario: I can link to an internal page - Given I select "awesome" in the "Content" HTML field - And I press the "Insert Link" HTML field button - When I select the "Link to a page on this site" radio button - And I fill in the "internal" dropdown with "Home" - And I fill in "my desc" for "Link description" - And I press the "Insert" button - # TODO Dynamic DB identifiers - Then the "Content" HTML field should contain "awesome" - # Required to avoid "unsaved changes" browser dialog - Then I press the "Save draft" button - - Scenario: I can link to an anchor in an internal page - Given I select "awesome" in the "Content" HTML field - And I press the "Insert Link" HTML field button - And I select the "Link to a page on this site" radio button - And I fill in the "internal" dropdown with "Details" - And I select "youranchor" from "Form_EditorToolbarLinkForm_AnchorSelector" - And I press the "Insert" button - Then the "Content" HTML field should contain "awesome" - # Required to avoid "unsaved changes" browser dialog - Then I press the "Save draft" button - Scenario: I can link to an external URL Given I select "awesome" in the "Content" HTML field - And I press the "Insert Link" HTML field button - When I select the "Link to another website" radio button - And I fill in "http://silverstripe.org" for "URL" - And I check "Open link in a new window" - And I press the "Insert" button + And I press the "Insert Link" HTML field button + When I click "Link to external URL" in the "[role='menuitem']" element + And I should see an "form#Form_EditorToolbarEditorExternalLink" element + When I fill in "http://silverstripe.org" for "URL" + And I check "Open in new window/tab" + And I press the "Insert" button Then the "Content" HTML field should contain "awesome" # Required to avoid "unsaved changes" browser dialog Then I press the "Save draft" button - Scenario: I can link to a file - Given I select "awesome" in the "Content" HTML field - When I press the "Insert Link" HTML field button - When I select the "Link to download a file" radio button - And I fill in the "file" dropdown with "file1.jpg" - And I press the "Insert" button - Then the "Content" HTML field should contain "awesome" - # Required to avoid "unsaved changes" browser dialog - Then I press the "Save draft" button - # Check that the field is reset when adding another new link - Given I select "content" in the "Content" HTML field - When I press the "Insert Link" HTML field button - Then I should not see a ".ss-uploadfield-files .ss-uploadfield-item" element - - Scenario: I can link to an anchor - Given I fill in the "Content" HTML field with "

My awesome content

" - And I select "awesome" in the "Content" HTML field - When I press the "Insert Link" HTML field button - When I select the "Link to an anchor on this page" radio button - And I select "myanchor" from "Form_EditorToolbarLinkForm_AnchorSelector" - And I press the "Insert" button - Then the "Content" HTML field should contain "awesome" - # Required to avoid "unsaved changes" browser dialog - Then I press the "Save draft" button - Scenario: I can edit a link Given I fill in the "Content" HTML field with "

My awesome content" - And I select "awesome" in the "Content" HTML field + And I select "awesome" in the "Content" HTML field When I press the "Insert Link" HTML field button - # We need to hard-code the id attribute, if you say 'Then the URL field', it picks up URLSegment instead. - Then the "Form_EditorToolbarLinkForm_external" field should contain "http://silverstripe.org" + And I click "Link to external URL" in the "[role='menuitem']" element + And I should see an "form#Form_EditorToolbarEditorExternalLink" element + Then the "URL" field should contain "http://silverstripe.org" # This doesn't seem to suffer from that issue When I fill in "http://google.com" for "URL" And I press the "Insert" button