|
| 1 | +@retry @job2 |
| 2 | +Feature: Create Links in LinkField and MultiLinkField |
| 3 | +As a content editor |
| 4 | +I want to add links to pages, files, external URLs, email addresses and phone numbers |
| 5 | + |
| 6 | + Background: |
| 7 | + Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class |
| 8 | + And I go to "/dev/build?flush" |
| 9 | + And a "page" "Link Page" |
| 10 | + And a "image" "folder1/file1.jpg" |
| 11 | + And the "group" "EDITOR" has permissions "Access to 'Pages' section" |
| 12 | + And I am logged in as a member of "EDITOR" group |
| 13 | + And I go to "/admin/pages" |
| 14 | + And I should see "Link Page" |
| 15 | + And I click on "Link Page" in the tree |
| 16 | + # Publish the page straight away |
| 17 | + And I click on the "#Form_EditForm_action_publish" element |
| 18 | + And I wait for 3 seconds |
| 19 | + |
| 20 | + Scenario: Change tracker single link |
| 21 | + # save/publish buttons will get .btn.primary class when clicking them will make a change to the database |
| 22 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 23 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 24 | + # Create email link in single LinkField |
| 25 | + When I click on the "[data-field-id='Form_EditForm_HasOneLink'] button" element |
| 26 | + Then I should see "Link to email address" in the "[data-field-id='Form_EditForm_HasOneLink'] .dropdown-item:nth-of-type(2)" element |
| 27 | + When I click on the "[data-field-id='Form_EditForm_HasOneLink'] .dropdown-item:nth-of-type(2)" element |
| 28 | + And I wait for 3 seconds |
| 29 | + Then I should see "Link to email address" in the ".modal-header" element |
| 30 | + Then I fill in "LinkText" with "Email link" |
| 31 | + And I fill in "Email" with "email@example.com" |
| 32 | + And I press the "Create link" button |
| 33 | + And I wait for 2 seconds |
| 34 | + # Because of the use of AJAX, the save button should not be highlighted, though the publish button should |
| 35 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 36 | + And I should see a "#Form_EditForm_action_publish.btn-primary" element |
| 37 | + # Publish the page |
| 38 | + When I click on the "#Form_EditForm_action_publish" element |
| 39 | + And I wait for 3 seconds |
| 40 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 41 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 42 | + # Check that clicking on an unrelated input field doesn't activate the change tracker |
| 43 | + When I click on the "#Form_EditForm_Title" element |
| 44 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 45 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 46 | + |
| 47 | + Scenario: Change tracker multi link |
| 48 | + # save/publish buttons will get .btn.primary class when clicking them will make a change to the database |
| 49 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 50 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 51 | + # Create PhoneLink in MultiLinkField |
| 52 | + When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] button" element |
| 53 | + Then I should see "Phone number" in the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(5)" element |
| 54 | + When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(5)" element |
| 55 | + And I wait for 3 seconds |
| 56 | + Then I should see "Phone number" in the ".modal-header" element |
| 57 | + Then I fill in "LinkText" with "Phone" |
| 58 | + Then I fill in "Phone" with "12345678" |
| 59 | + And I should not see "Open in new window" in the ".modal-content" element |
| 60 | + And I press the "Create link" button |
| 61 | + And I wait for 2 seconds |
| 62 | + # Because of the use of AJAX, the save button should not be highlighted, though the publish button should |
| 63 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 64 | + And I should see a "#Form_EditForm_action_publish.btn-primary" element |
| 65 | + # Publish the page |
| 66 | + When I click on the "#Form_EditForm_action_publish" element |
| 67 | + And I wait for 3 seconds |
| 68 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 69 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 70 | + # Check that clicking on an unrelated input field doesn't activate the change tracker |
| 71 | + When I click on the "#Form_EditForm_Title" element |
| 72 | + Then I should not see a "#Form_EditForm_action_save.btn-primary" element |
| 73 | + And I should not see a "#Form_EditForm_action_publish.btn-primary" element |
| 74 | + |
0 commit comments