From e37933f30e77d673b3f31867c5ccda5705af2991 Mon Sep 17 00:00:00 2001 From: Sabina Talipova <87288324+sabina-talipova@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:53:28 +1200 Subject: [PATCH 1/2] MNT Additional test cases for TreeDropDownField (#2931) --- tests/behat/features/insert-a-link.feature | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index 2f40081a..93b8184c 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -8,6 +8,10 @@ So that I can link to a external website or a page on my site Given a "page" "Home" And a "page" "About Us" has the "Content" "

My awesome content

" And a "file" "file1.jpg" + And a "page" "Page 1" + And the "page" "Page 1.1" is a child of a "page" "Page 1" + And the "page" "Page 1.1.1" is a child of a "page" "Page 1.1" + And the "page" "Page 1.1.1.1" is a child of a "page" "Page 1.1.1" # 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" And I am logged in as a member of "EDITOR" group @@ -102,3 +106,45 @@ So that I can link to a external website or a page on my site And the "Content" HTML field should not contain "http://silverstripe.org" # Required to avoid "unsaved changes" browser dialog Then I press the "Save" button + + Scenario: I can navigate list of Site tree links by clicking on the dropdown elements + When I select "awesome" 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 + When I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element + Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should not see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should see "Page 1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should not see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + When I select "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown + And I fill in "my new desc" for "Link description" + And I press the "Insert link" button + Then I press the "Save" button + + Scenario: I can navigate list of Site tree links by using keyboard + When I select "awesome" 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 + When I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element + And I press the "Down" key globally + And I press the "Down" key globally + And I press the "Down" key globally + And I press the "Right" key globally + Then I should see "Page 1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I press the "Down" key globally + And I press the "Right" key globally + Then I should see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I press the "Down" key globally + And I press the "Right" key globally + Then I should see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should not see the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I press the "Enter" key globally + And I fill in "my new desc" for "Link description" + And I press the "Insert link" button + Then I press the "Save" button From 6bd33e83f66b79fd799f7fa81d0388c33685b4d2 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 1 May 2024 19:03:21 +1200 Subject: [PATCH 2/2] MNT Update behat test --- tests/behat/features/insert-a-link.feature | 29 ++++++++++++------- .../behat/features/insert-anchor-link.feature | 16 ++++++---- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index 2f40081a..ccc93864 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -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 Then the "Content" HTML field should contain "awesome" # 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 Given I fill in the "Content" HTML field with "

" @@ -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" 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 "" - # Required to avoid "unsaved changed" browser dialog - And I press the "Save" button + Then the "Content" HTML field should contain "" + # Required to avoid "unsaved changes" browser dialog + 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 Given I fill in the "Content" HTML field with "awesome" @@ -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 Then the "Content" HTML field should contain "awesome" # 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 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 Then the "Content" HTML field should contain "awesome" # 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 Given I fill in the "Content" HTML field with "

" @@ -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" When I fill in "http://silverstripe.org" for "URL" And I press the "Insert link" button - Then the "Content" HTML field should contain "" - # Required to avoid "unsaved changed" browser dialog - And I press the "Save" button + Then the "Content" HTML field should contain "" + # Required to avoid "unsaved changes" browser dialog + When I press the "Save" button + Then I should see a "Saved 'About Us' successfully" success toast Scenario: I can edit an external link Given I fill in the "Content" HTML field with "

My awesome 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 Then the "Content" HTML field should contain "awesome" # 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 Given I fill in the "Content" HTML field with "My awesome 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" And the "Content" HTML field should not contain "http://silverstripe.org" # 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 diff --git a/tests/behat/features/insert-anchor-link.feature b/tests/behat/features/insert-anchor-link.feature index 193a5614..440d8858 100644 --- a/tests/behat/features/insert-anchor-link.feature +++ b/tests/behat/features/insert-anchor-link.feature @@ -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 Then the "Content" HTML field should contain "awesome" # 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 Given I fill in the "Content" HTML field with "

" @@ -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 And I select "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown And I press the "Insert link" button - Then the "Content" HTML field should contain "" - # Required to avoid "unsaved changed" browser dialog - And I press the "Save" button + Then the "Content" HTML field should contain "" + # Required to avoid "unsaved changes" browser dialog + 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 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 Then the "Content" HTML field should contain "awesome" # 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 Given I fill in the "Content" HTML field with "

My awesome content

unsaved content

" @@ -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 Then the "Content" HTML field should contain "awesome" # 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