Merge pull request #2932 from creative-commoners/pulls/5/behat-links

MNT Update behat test
This commit is contained in:
Guy Sartorelli 2024-05-02 12:05:45 +12:00 committed by GitHub
commit 65ba1147af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 17 deletions

View File

@ -24,7 +24,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]">awesome</a>" 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 # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can wrap an image in a link to an internal page 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>" Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>"
@ -35,9 +36,10 @@ So that I can link to a external website or a page on my site
And I should not see "Link text" And I should not see "Link text"
When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown
And I press the "Insert link" button 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>" Then the "Content" HTML field should contain "<a href="[sitetree_link,id=2]"><img src="file1.jpg" alt=""></a>"
# Required to avoid "unsaved changed" browser dialog # Required to avoid "unsaved changes" browser dialog
And I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can edit a link to an internal page 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>" Given I fill in the "Content" HTML field with "<a title='my desc' href='[sitetree_link,id=2]'>awesome</a>"
@ -53,7 +55,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a title="my new desc" href="[sitetree_link,id=1]">awesome</a>" 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 # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can link to an external URL Scenario: I can link to an external URL
Given I select "awesome" in the "Content" HTML field Given I select "awesome" in the "Content" HTML field
@ -65,7 +68,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a rel="noopener" href="http://silverstripe.org" target="_blank">awesome</a>" Then the "Content" HTML field should contain "<a rel="noopener" href="http://silverstripe.org" target="_blank">awesome</a>"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can wrap an image in a link to an external URL 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>" Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>"
@ -76,9 +80,10 @@ So that I can link to a external website or a page on my site
And I should not see "Link text" And I should not see "Link text"
When I fill in "http://silverstripe.org" for "URL" When I fill in "http://silverstripe.org" for "URL"
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a href="http://silverstripe.org"><img src="file1.jpg"></a>" Then the "Content" HTML field should contain "<a href="http://silverstripe.org"><img src="file1.jpg" alt=""></a>"
# Required to avoid "unsaved changed" browser dialog # Required to avoid "unsaved changes" browser dialog
And I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can edit an external link Scenario: I can edit an external link
Given I fill in the "Content" HTML field with "<p>My <a href='http://silverstripe.org'>awesome</a> content" Given I fill in the "Content" HTML field with "<p>My <a href='http://silverstripe.org'>awesome</a> content"
@ -92,7 +97,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a href="http://google.com">awesome</a>" Then the "Content" HTML field should contain "<a href="http://google.com">awesome</a>"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can remove an external link Scenario: I can remove an external link
Given I fill in the "Content" HTML field with "My <a href='http://silverstripe.org'>awesome</a> content" Given I fill in the "Content" HTML field with "My <a href='http://silverstripe.org'>awesome</a> content"
@ -101,4 +107,5 @@ So that I can link to a external website or a page on my site
Then the "Content" HTML field should contain "My awesome content" Then the "Content" HTML field should contain "My awesome content"
And the "Content" HTML field should not contain "http://silverstripe.org" And the "Content" HTML field should not contain "http://silverstripe.org"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast

View File

@ -27,7 +27,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=3]#youranchor">awesome</a>" Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=3]#youranchor">awesome</a>"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can wrap an image in a link to an anchor in an internal page Scenario: I can wrap an image in a link to an anchor in an internal page
Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>" Given I fill in the "Content" HTML field with "<p><img src='file1.jpg'></p>"
@ -40,9 +41,10 @@ So that I can link to a external website or a page on my site
When I select "Details" in the "#Form_editorAnchorLink_PageID_Holder" tree dropdown When I select "Details" in the "#Form_editorAnchorLink_PageID_Holder" tree dropdown
And I select "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown And I select "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a href="[sitetree_link,id=3]#youranchor"><img src="file1.jpg"></a>" Then the "Content" HTML field should contain "<a href="[sitetree_link,id=3]#youranchor"><img src="file1.jpg" alt=""></a>"
# Required to avoid "unsaved changed" browser dialog # Required to avoid "unsaved changes" browser dialog
And I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can link to an anchor from a dataobject on the current page Scenario: I can link to an anchor from a dataobject on the current page
When I select "awesome" in the "Content" HTML field When I select "awesome" in the "Content" HTML field
@ -56,7 +58,8 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]#dataobject-anchor">awesome</a>" Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]#dataobject-anchor">awesome</a>"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast
Scenario: I can link to an unsaved anchor in the current page Scenario: I can link to an unsaved anchor in the current page
Given I fill in the "Content" HTML field with "<p>My awesome content</p><p><a id='unsaved-anchor'></a>unsaved content</p>" Given I fill in the "Content" HTML field with "<p>My awesome content</p><p><a id='unsaved-anchor'></a>unsaved content</p>"
@ -73,4 +76,5 @@ So that I can link to a external website or a page on my site
And I press the "Insert link" button And I press the "Insert link" button
Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]#unsaved-anchor">awesome</a>" Then the "Content" HTML field should contain "<a title="my desc" href="[sitetree_link,id=2]#unsaved-anchor">awesome</a>"
# Required to avoid "unsaved changes" browser dialog # Required to avoid "unsaved changes" browser dialog
Then I press the "Save" button When I press the "Save" button
Then I should see a "Saved 'About Us' successfully" success toast