diff --git a/config/sync/block.block.webtools_etrans.yml b/config/sync/block.block.webtools_etrans.yml index 591f5bb1df..b98dc077b4 100644 --- a/config/sync/block.block.webtools_etrans.yml +++ b/config/sync/block.block.webtools_etrans.yml @@ -3,8 +3,7 @@ langcode: en status: true dependencies: module: - - eif - - node + - joinup_core - oe_webtools_etrans theme: - joinup_theme @@ -25,4 +24,15 @@ settings: delay: 0 include: '' exclude: '' -visibility: { } +visibility: + request_route: + id: request_route + routes: + - entity.node.delete_form + - entity.node.edit_form + - entity.rdf_entity.delete_form + - entity.rdf_entity.edit_form + - entity.taxonomy_term.edit_form + - entity.taxonomy_term.delete_form + negate: true + context_mapping: { } diff --git a/tests/features/asset_release/asset_release.delete.feature b/tests/features/asset_release/asset_release.delete.feature index 46a9baa513..6e35080e10 100644 --- a/tests/features/asset_release/asset_release.delete.feature +++ b/tests/features/asset_release/asset_release.delete.feature @@ -37,7 +37,7 @@ Feature: Asset release "delete" functionality. Scenario: "Delete" action should redirect users to the parent solution. # Navigating through UI should redirect the user to the solution homepage. When I am logged in as a "moderator" - And I go to the "Yet another release" release edit form + And I go to the edit form of the "Yet another release" release And I click "Delete" And I press "Delete" Then I should be on "/collection/yet-another-collection/solution/yet-another-solution" diff --git a/tests/features/collection/collection.about.feature b/tests/features/collection/collection.about.feature index 7c31147aee..6b48af849b 100644 --- a/tests/features/collection/collection.about.feature +++ b/tests/features/collection/collection.about.feature @@ -56,7 +56,7 @@ Feature: About page # When there is no abstract, the description should be shown in the homepage. When I am logged in as a "moderator" - And I go to the "Fitness at work" collection edit form + And I go to the edit form of the "Fitness at work" collection And I fill in "Abstract" with "" And I press "Publish" Then I should see the heading "Fitness at work" diff --git a/tests/features/collection/collection.member_administration.feature b/tests/features/collection/collection.member_administration.feature index 964d4dc3fe..7b08ccf4b7 100644 --- a/tests/features/collection/collection.member_administration.feature +++ b/tests/features/collection/collection.member_administration.feature @@ -204,7 +204,7 @@ Feature: Collection membership administration # Check that Dr House can't edit the collection. When I am logged in as "Gregory House" And I go to the "Medical diagnosis" collection - Then I go to the "Medical diagnosis" collection edit form + And I go to the edit form of the "Medical diagnosis" collection Then I should see the heading "Access denied" # Dr Cuddy promotes Dr House to facilitator. @@ -227,8 +227,7 @@ Feature: Collection membership administration # Dr House can now edit the collection. When I am logged in as "Gregory House" - And I go to the "Medical diagnosis" collection - Then I go to the "Medical diagnosis" collection edit form + And I go to the edit form of the "Medical diagnosis" collection Then I should not see the heading "Access denied" Scenario: Privileged members should be allowed to add users to a collection. diff --git a/tests/features/collection/last_update_time.feature b/tests/features/collection/last_update_time.feature index 2f638ec8e6..15dd4fe49b 100644 --- a/tests/features/collection/last_update_time.feature +++ b/tests/features/collection/last_update_time.feature @@ -74,8 +74,8 @@ Feature: Tests the collection last update time. # The custom page is the newest thus will give the collection updated time. Then the response should contain "2016-05-06T05:29" - And I go to the document content "Get Rid of Rats" edit screen - When I press "Update" + When I go to the edit form of the "Get Rid of Rats" document + And I press "Update" # The updated time has changed to the current time but we cannot catch the # time we ran the update. Then the response should not contain "2016-05-06T05:29" @@ -101,7 +101,7 @@ Feature: Tests the collection last update time. Then I should see "about a minute ago" # Editing the solution changes the last updated time. - Given I go to the "Roof Hole Cover" solution edit form + Given I go to the edit form of the "Roof Hole Cover" solution And I select "Public Policy Cycle" from "Solution type" And I select "Demography" from "Topic" And I press "Publish" @@ -113,7 +113,7 @@ Feature: Tests the collection last update time. Then I should see "about a minute ago" # Deleting the solution changes the last updated time. - Given I go to the "Roof Hole Cover" solution edit form + Given I go to the edit form of the "Roof Hole Cover" solution And I click "Delete" When I press "Delete" And I go to the homepage of the "Household Wizard" collection diff --git a/tests/features/collection/propose.feature b/tests/features/collection/propose.feature index 5d4fe9e7fa..e1dad66491 100644 --- a/tests/features/collection/propose.feature +++ b/tests/features/collection/propose.feature @@ -177,7 +177,7 @@ Feature: Proposing a collection And the "Just a proposal" collection logo is image #3 And the "Just a proposal" collection banner is image #8 - When I go to the "Just a proposal" collection edit form + Given I go to the edit form of the "Just a proposal" collection And I click "Additional fields" tab And I remove the file from the "Logo" field But I wait for AJAX to finish @@ -187,7 +187,7 @@ Feature: Proposing a collection And I wait for AJAX to finish And I press "Propose" - When I go to the "Just a proposal" collection edit form + When I go to the edit form of the "Just a proposal" collection And I click "Additional fields" tab Then I should see the link "logo.png" diff --git a/tests/features/communities/eif/solutions_page.feature b/tests/features/communities/eif/solutions_page.feature index aa4641aa9e..eee24219dc 100644 --- a/tests/features/communities/eif/solutions_page.feature +++ b/tests/features/communities/eif/solutions_page.feature @@ -65,7 +65,7 @@ Feature: As a user, visiting the EIF Toolbox page, I want to be able to filter And the menu link "Solutions" is in the active trail Given I am logged in as a moderator - When I go to the "Solution 3" solution edit form + When I go to the edit form of the "Solution 3" solution And I select "Recommendation 7" from "EIF reference" And I check the box "Semantic assets" # Other require fields... diff --git a/tests/features/communities/eif/vocabulary.feature b/tests/features/communities/eif/vocabulary.feature index 024d8db38b..8685d69985 100644 --- a/tests/features/communities/eif/vocabulary.feature +++ b/tests/features/communities/eif/vocabulary.feature @@ -20,11 +20,11 @@ Feature: | collection | EIF Toolbox | Given I am logged in as a facilitator of the "Some EIF solution" solution - When I go to the "Some EIF solution" solution edit form + When I go to the edit form of the "Some EIF solution" solution Then the following fields should not be present "EIF reference, EIF category" Given I am logged in as a moderator - When I go to the "Some EIF solution" solution edit form + When I go to the edit form of the "Some EIF solution" solution Then the following fields should be present "EIF reference, EIF category" When I press "Publish" diff --git a/tests/features/communities/tallinn/dashboard.feature b/tests/features/communities/tallinn/dashboard.feature index b42d84e3b5..54c10aa677 100644 --- a/tests/features/communities/tallinn/dashboard.feature +++ b/tests/features/communities/tallinn/dashboard.feature @@ -76,7 +76,7 @@ Feature: Then the page should be cached # Edit the group entity. - Given I go to the "Tallinn Ministerial Declaration" collection edit form + When I go to the edit form of the "Tallinn Ministerial Declaration" collection And I fill in "Description" with "Hooli" When I press "Publish" And I go to "/api/v1/communities/tallinn/report" @@ -85,7 +85,7 @@ Feature: Then the page should be cached # Edit any report. - Given I go to the tallinn_report content "Malta" edit screen + When I go to the edit form of the "Malta" "tallinn report" And I press "Save" When I go to "/api/v1/communities/tallinn/report" Then the page should not be cached diff --git a/tests/features/communities/tallinn/permissions.feature b/tests/features/communities/tallinn/permissions.feature index 729c0e1ac3..5fb2985bc8 100644 --- a/tests/features/communities/tallinn/permissions.feature +++ b/tests/features/communities/tallinn/permissions.feature @@ -181,7 +181,7 @@ Feature: | France Report | | Romania Report | - When I go to the "tallinn_report" content "Romania Report" edit screen + When I go to the edit form of the "Romania Report" "tallinn report" And I press "Save" And I go to the "Tallinn Ministerial Declaration" collection And I click "Implementation monitoring" in the "Left sidebar" region @@ -193,14 +193,14 @@ Feature: # A moderator is able to change any report's author. Given I am logged in as chef - When I visit the tallinn_report content "Romania Report" edit screen + When I go to the edit form of the "Romania Report" "tallinn report" And I fill in "Authored by" with "dominique" When I press "Save" Then I should see the error message "The user dominique cannot be set as author of this report as he/she already owns 'France Report'." # Test the same but as facilitator to verify the functionality for him as well. Given I am logged in as "sherlock" - When I visit the tallinn_report content "Romania Report" edit screen + When I go to the edit form of the "Romania Report" "tallinn report" And I fill in "Authored by" with "vasile" When I press "Save" Then I should see "Tallinn report Romania Report has been updated." @@ -211,7 +211,7 @@ Feature: # A user can change its own report but not other's. In # the same time he's not able to change the node owner. Given I am logged in as vasile - When I visit the tallinn_report content "Romania Report" edit screen + When I go to the edit form of the "Romania Report" "tallinn report" Then I should get a 200 HTTP response And the following fields should not be present "Authored by" @@ -231,5 +231,5 @@ Feature: And I should see "This is done" # The user cannot edit a report owned by someone else. - Given I visit the tallinn_report content "France Report" edit screen + When I go to the edit form of the "France Report" "tallinn report" Then I should get a 403 HTTP response diff --git a/tests/features/contact_information/access.feature b/tests/features/contact_information/access.feature index a519ba01d8..744113009f 100644 --- a/tests/features/contact_information/access.feature +++ b/tests/features/contact_information/access.feature @@ -36,5 +36,5 @@ Feature: Contact information access | collection | user | roles | | Ausy software solutions | Michiel Lucas | facilitator | When I am logged in as "Michiel Lucas" - When I go to the "Ausy software solutions" collection edit form + When I go to the edit form of the "Ausy software solutions" collection Then I should see the button "Edit" in the "Contact information inline form" region diff --git a/tests/features/contact_information/contact_information.moderation.feature b/tests/features/contact_information/contact_information.moderation.feature index d8fad7577c..dd96070430 100644 --- a/tests/features/contact_information/contact_information.moderation.feature +++ b/tests/features/contact_information/contact_information.moderation.feature @@ -146,6 +146,6 @@ Feature: Contact Information moderation And I click "Edit" in the "Entity actions" And the following 1 button should be present "Update" And I should see the link "Delete" - When I go to the "Saint Louis solutions" collection edit form + When I go to the edit form of the "Saint Louis solutions" collection Then I should see the button "Edit" in the "Contact information inline form" region Then I should see the button "Remove" in the "Contact information inline form" region diff --git a/tests/features/custom_page/community_content_listing.feature b/tests/features/custom_page/community_content_listing.feature index e87a3c06a1..d3238dde79 100644 --- a/tests/features/custom_page/community_content_listing.feature +++ b/tests/features/custom_page/community_content_listing.feature @@ -398,7 +398,7 @@ Feature: | 20 year anniversary | | Rare Nintendo64 disk drive discovered | - Given I go to the news content "Current wars" edit screen + When I go to the edit form of the "Current wars" news And I fill in "Short title" with "Current wars is over" And I press "Update" Then I should see the heading "Current wars is over" diff --git a/tests/features/glossary/glossary.feature b/tests/features/glossary/glossary.feature index 1b7a409303..c356023fc0 100644 --- a/tests/features/glossary/glossary.feature +++ b/tests/features/glossary/glossary.feature @@ -373,7 +373,7 @@ Feature: As a moderator or group facilitator I want to be able to add, edit and | Duplicate | dupe,DuPe | duplicate sysnonym | A World of Things | # Hard to fill a multi-value field, so we'll pre-create it with duplicates. - When I go to the glossary content "Duplicate" edit screen + When I go to the edit form of the "Duplicate" glossary And I press "Save" Then I should see the error message "The 'DuPe' synonym is duplicated. Keep only one entry." diff --git a/tests/features/joinup_discussion/discussion.subscribe.feature b/tests/features/joinup_discussion/discussion.subscribe.feature index c81f2193f9..89ac871c1f 100644 --- a/tests/features/joinup_discussion/discussion.subscribe.feature +++ b/tests/features/joinup_discussion/discussion.subscribe.feature @@ -96,13 +96,13 @@ Feature: Following discussions # relevant fields are changed. And the mail collector cache is empty And I am logged in as "Dr. Hans Zarkov" - When I go to the discussion content "Rare Butter" edit screen + And I go to the edit form of the "Rare Butter" discussion And I press "Update" Then 0 e-mails should have been sent # When relevant fields of a discussion are changed, the subscribers are # receiving a notification. - Given I go to the discussion content "Rare Butter" edit screen + Given I go to the edit form of the "Rare Butter" discussion And I fill in "Content" with "The old content was wrong." And I press "Update" Then the following email should have been sent: @@ -125,7 +125,7 @@ Feature: Following discussions # notification will be sent, regardless if a relevant field is changed. Given the mail collector cache is empty And I am logged in as a moderator - When I go to the discussion content "Rare Butter" edit screen + When I go to the edit form of the "Rare Butter" discussion And I fill in "Content" with "Is this change triggering notifications?" And I fill in "Motivation" with "Reporting this content..." And I press "Report" diff --git a/tests/features/joinup_event/add_event.collection.feature b/tests/features/joinup_event/add_event.collection.feature index 19bf3097a2..e420108f1e 100644 --- a/tests/features/joinup_event/add_event.collection.feature +++ b/tests/features/joinup_event/add_event.collection.feature @@ -129,7 +129,7 @@ Feature: "Add event" visibility options. Given I am logged in as a moderator # Upload works. - When I go to the event content "The Great Opening" edit screen + When I go to the edit form of the "The Great Opening" event And I attach the file "logo.png" to "Logo" And I wait for AJAX to finish diff --git a/tests/features/joinup_federation/import.feature b/tests/features/joinup_federation/import.feature index 99a660b803..8c0d99a4dd 100644 --- a/tests/features/joinup_federation/import.feature +++ b/tests/features/joinup_federation/import.feature @@ -236,7 +236,7 @@ Feature: As a site moderator I am able to import RDF files. And the "Solution 2" solution should be affiliated with the "NIO" collection # Check that the existing solution values were overridden. - Given I go to the "Solution 2" solution edit form + Given I go to the edit form of the "Solution 2" solution Then the "Title" field should contain "Solution 2" And the "Description" field should contain "This solution has a standalone distribution." @@ -247,7 +247,7 @@ Feature: As a site moderator I am able to import RDF files. # Verify that the collection owner can edit the new solutions. When I am logged in as "CS Owner" - And I go to the "Solution 1" solution edit form + Given I go to the edit form of the "Solution 1" solution Then the response status code should be 200 # Ensure that the og relation is set between the distribution and the solution. @@ -310,7 +310,7 @@ Feature: As a site moderator I am able to import RDF files. And the "Solution 3" solution should be affiliated with the "NIO" collection # Check that the Topic value was not overridden. - Given I go to the "Solution 2" solution edit form + Given I go to the edit form of the "Solution 2" solution # The text is '-E-health' because of the '-' prepended to children options. And the option with text "-E-health" from select "Topic" is selected And I press "Publish" diff --git a/tests/features/joinup_group/collection.delete_with_children.feature b/tests/features/joinup_group/collection.delete_with_children.feature index 6aaf0ad627..074a33d6dd 100644 --- a/tests/features/joinup_group/collection.delete_with_children.feature +++ b/tests/features/joinup_group/collection.delete_with_children.feature @@ -14,14 +14,14 @@ Feature: | collection | Collection with child | When I am logged in as a moderator - And I go to the "Collection with child" collection delete form + And I go to the delete form of the "Collection with child" collection Then I should not see the button "Delete" And I should see the heading "The collection Collection with child cannot be deleted because it contains the following solutions:" But I should see the link "Child of collection with child" And I should see the text "You can delete your solutions or transfer them to another collection." Given I delete the "Child of collection with child" solution - And I go to the "Collection with child" collection delete form + And I go to the delete form of the "Collection with child" collection Then I should see the heading "Are you sure you want to delete collection Collection with child?" And I should see the text "This action cannot be undone." When I press "Delete" diff --git a/tests/features/joinup_group/member_permissions_table.feature b/tests/features/joinup_group/member_permissions_table.feature index 6505fe5310..b2f1be4559 100644 --- a/tests/features/joinup_group/member_permissions_table.feature +++ b/tests/features/joinup_group/member_permissions_table.feature @@ -155,7 +155,7 @@ Feature: Group member permissions table | title | state | collection | author | | Election of Boy Archchancellor | validated | Approximate accuracy | Horace Worblehat | | The Wizards' Excuse Me | draft | Approximate accuracy | Mustrum Ridcully | - When I go to the event content "Election of Boy Archchancellor" edit screen + When I go to the edit form of the "Election of Boy Archchancellor" event Then I should see the button "Request deletion" And I should see the button "Propose changes" But I should not see the link "Delete" @@ -198,7 +198,7 @@ Feature: Group member permissions table | title | state | collection | author | | Beating the bounds | validated | Dust, miscellaneous particles and filaments | Ponder Stibbons | | Archchancellor Bowell's Remembrance's Bun and Penny | draft | Dust, miscellaneous particles and filaments | Mustrum Ridcully | - When I go to the event content "Beating the bounds" edit screen + When I go to the edit form of the "Beating the bounds" event Then I should see the link "Delete" And I should see the button "Update" But I should not see the button "Request deletion" @@ -247,7 +247,7 @@ Feature: Group member permissions table | title | state | collection | author | | The Convivium | validated | Creative uncertainty | Henry Porter | | The Hunting of the Megapode | draft | Creative uncertainty | Mustrum Ridcully | - When I go to the event content "The Convivium" edit screen + When I go to the edit form of the "The Convivium" event Then I should see the button "Request deletion" And I should see the button "Propose changes" But I should not see the link "Delete" @@ -290,7 +290,7 @@ Feature: Group member permissions table | title | state | collection | author | | Gaudy night | validated | Woolly thinking | Rincewind | | Archchancellor Preserved Bigger's Bequest | draft | Woolly thinking | Mustrum Ridcully | - When I go to the event content "Gaudy night" edit screen + When I go to the edit form of the "Gaudy night" event Then I should see the link "Delete" And I should see the button "Update" But I should not see the button "Request deletion" @@ -401,7 +401,7 @@ Feature: Group member permissions table | title | state | solution | author | | Head of the River | validated | Prehumous morbid bibliomancy | Dr. John Hicks | | Poore Boys Funne | draft | Prehumous morbid bibliomancy | Mustrum Ridcully | - When I go to the event content "Head of the River" edit screen + When I go to the edit form of the "Head of the River" event Then I should see the button "Request deletion" And I should see the button "Propose changes" But I should not see the link "Delete" @@ -444,7 +444,7 @@ Feature: Group member permissions table | title | state | collection | author | | May Morning | validated | Posthumous morbid bibliomancy | Hex | | A veritable heyhoe-rumbledown | draft | Posthumous morbid bibliomancy | Mustrum Ridcully | - When I go to the event content "May Morning" edit screen + When I go to the edit form of the "May Morning" event Then I should see the link "Delete" And I should see the button "Update" But I should not see the button "Request deletion" diff --git a/tests/features/joinup_group/short_id.feature b/tests/features/joinup_group/short_id.feature index 8993b9d21f..9f6bbafb24 100644 --- a/tests/features/joinup_group/short_id.feature +++ b/tests/features/joinup_group/short_id.feature @@ -43,12 +43,12 @@ Feature: And I press "Propose" And I should see the heading "Structural Solar Traces" - When I go to the "Structural Solar Traces" collection edit form + When I go to the edit form of the "Structural Solar Traces" collection Then the following fields should not be disabled "Short ID" # Publish the collection. When I am logged in as a moderator - And I go to the "Structural Solar Traces" collection edit form + When I go to the edit form of the "Structural Solar Traces" collection And I press "Publish" Then I should see the heading "Structural Solar Traces" @@ -59,7 +59,7 @@ Feature: # Check that the field is not editable any more for facilitators once the # collection is published. When I am logged in as a facilitator of the "Structural Solar Traces" collection - And I go to the "Structural Solar Traces" collection edit form + When I go to the edit form of the "Structural Solar Traces" collection Then the following fields should be disabled "Short ID" Then I delete the "Structural Solar Traces" collection @@ -116,12 +116,12 @@ Feature: And I press "Propose" Then I should see the heading "I know what a solution is" - When I go to the "I know what a solution is" solution edit form + When I go to the edit form of the "I know what a solution is" solution Then the following fields should not be disabled "Short ID" # Publish the solution. When I am logged in as a moderator - And I go to the "I know what a solution is" solution edit form + When I go to the edit form of the "I know what a solution is" solution And I press "Publish" Then I should see the heading "I know what a solution is" @@ -131,7 +131,7 @@ Feature: # Check that the field is not editable for facilitators. When I am logged in as a facilitator of the "I know what a solution is" solution - And I go to the "I know what a solution is" solution edit form + When I go to the edit form of the "I know what a solution is" solution Then the following fields should be disabled "Short ID" Then I delete the "I know what a solution is" solution diff --git a/tests/features/joinup_news/add_news.feature b/tests/features/joinup_news/add_news.feature index 5b12c3df24..bca30070f3 100644 --- a/tests/features/joinup_news/add_news.feature +++ b/tests/features/joinup_news/add_news.feature @@ -103,7 +103,7 @@ Feature: Creation of news through the UI. Given I am logged in as a moderator # Upload works. - When I go to the news content "The Great Opening" edit screen + When I go to the edit form of the "The Great Opening" news And I attach the file "logo.png" to "Logo" And I wait for AJAX to finish diff --git a/tests/features/joinup_search/search.feature b/tests/features/joinup_search/search.feature index 04472c0df0..834971ecbb 100644 --- a/tests/features/joinup_search/search.feature +++ b/tests/features/joinup_search/search.feature @@ -315,7 +315,7 @@ Feature: Global search Then the page should show only the tiles "Zzolution" Given I am logged in as a moderator - When I visit the "ZzoluDistro" asset distribution edit form + When I go to the edit form of the "ZzoluDistro" distribution And I fill in "Title" with "DistroZzolu" And I fill in "Description" with "Nietzsche's" And I press the "Remove" button @@ -324,6 +324,7 @@ Feature: Global search And I select "CSV" from "Format" And I select "Human Language" from "Representation technique" And I press "Save" + Then I should see the heading "DistroZzolu" # Repeat the previous searches to prove that the initial keywords were # removed from the Search API index. @@ -381,7 +382,7 @@ Feature: Global search When I enter "ReleazzDistro" in the search bar and press enter Then I should see "No content found for your search." - And the following distribution: + Given the following distribution: | title | ReleazzDistro | | parent | Releazz | | description | Dracula | @@ -405,7 +406,7 @@ Feature: Global search Then the page should show only the tiles "Releazz" Given I am logged in as a moderator - When I visit the "ReleazzDistro" asset distribution edit form + When I go to the edit form of the "ReleazzDistro" distribution And I fill in "Title" with "DistroReleazz" And I fill in "Description" with "Zorro" And I press the "Remove" button diff --git a/tests/features/joinup_subscription/my_subscriptions.feature b/tests/features/joinup_subscription/my_subscriptions.feature index a06d556356..583acdf156 100644 --- a/tests/features/joinup_subscription/my_subscriptions.feature +++ b/tests/features/joinup_subscription/my_subscriptions.feature @@ -218,7 +218,7 @@ Feature: My subscriptions And the following fields should not be present "Save changes" Given I am logged in as a moderator - When I go to the discussion content "Water supply" edit screen + When I go to the edit form of the "Water supply" discussion And I press "Publish" # @todo: a caching issue is causing the message to have empty fields when # rendered. diff --git a/tests/features/machine_translation.feature b/tests/features/machine_translation.feature index 7dbf4c538e..7f649cc4df 100644 --- a/tests/features/machine_translation.feature +++ b/tests/features/machine_translation.feature @@ -32,8 +32,13 @@ Feature: Machine translation | state | validated | | collection | Brexit | + When I am logged in as a moderator # Inside a collection sidebar, only custom pages, glossary terms (but not # the glossary overview) and the about page should be translatable. + When I go to the edit form of the "Brexit" collection + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Brexit" collection + Then I should not see any Webtools eTrans elements When I go to the "Brexit" collection Then I should not see any Webtools eTrans elements When I click "Members" @@ -46,16 +51,36 @@ Feature: Machine translation Then I should see the Webtools eTrans button When I go to the "Increased credit card fees" custom page Then I should see the Webtools eTrans button + When I go to the edit form of the "Increased credit card fees" "custom page" + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Increased credit card fees" "custom page" + Then I should not see any Webtools eTrans elements # Community content should be translatable. When I go to the "Confiscating of sandwiches" event Then I should see the Webtools eTrans button + When I go to the edit form of the "Confiscating of sandwiches" event + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Confiscating of sandwiches" event + Then I should not see any Webtools eTrans elements When I go to the "Supply chain disruption" news Then I should see the Webtools eTrans button + When I go to the edit form of the "Supply chain disruption" news + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Supply chain disruption" news + Then I should not see any Webtools eTrans elements When I go to the "Increased postal delivery costs" document Then I should see the Webtools eTrans button + When I go to the edit form of the "Increased postal delivery costs" document + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Increased postal delivery costs" document + Then I should not see any Webtools eTrans elements When I go to the "Restriction on animal-based food imports" discussion Then I should see the Webtools eTrans button + When I go to the edit form of the "Restriction on animal-based food imports" discussion + Then I should not see any Webtools eTrans elements + When I go to the delete form of the "Restriction on animal-based food imports" discussion + Then I should not see any Webtools eTrans elements # Pages that primarily list content should not be translatable. When I go to the homepage diff --git a/tests/features/paragraphs/custom_page.paragraphs.feature b/tests/features/paragraphs/custom_page.paragraphs.feature index 8c73698c0a..f150f6dbf6 100644 --- a/tests/features/paragraphs/custom_page.paragraphs.feature +++ b/tests/features/paragraphs/custom_page.paragraphs.feature @@ -57,14 +57,14 @@ Feature: # Normal members cannot add maps. When I am logged in as "Zohan" - And I go to the custom_page "Don't Mess with the Zohan" edit screen + And I go to the edit form of the "Don't Mess with the Zohan" "custom page" Then I should see the button "Add Simple paragraph" And I should not see the button "Add Map" But I should not see the button "Add IFrame" # Facilitators can add maps. When I am logged in as a facilitator of the "Paragraphs collection" collection - And I go to the custom_page "Don't Mess with the Zohan" edit screen + And I go to the edit form of the "Don't Mess with the Zohan" "custom page" Then I should see the button "Add Simple paragraph" And I should see the button "Add Map" But I should not see the button "Add IFrame" @@ -76,7 +76,7 @@ Feature: # Moderators can add maps. Given I am logged in as a moderator - And I go to the custom_page "Don't Mess with the Zohan" edit screen + And I go to the edit form of the "Don't Mess with the Zohan" "custom page" Then I should see the button "Add Simple paragraph" And I should see the button "Add Map" And I should see the button "Add IFrame" @@ -89,7 +89,7 @@ Feature: And I should see "I'm half Australian, half Mt. Everest" And the response should contain "{\"foo\":\"bar\"}" - When I go to the custom_page "Don't Mess with the Zohan" edit screen + When I go to the edit form of the "Don't Mess with the Zohan" "custom page" And I press "Add IFrame" And I fill in "Iframe URL" with "http://example.com" And I press "Save" diff --git a/tests/features/solution/add_solution.feature b/tests/features/solution/add_solution.feature index 9731b64e80..9ceea19be0 100644 --- a/tests/features/solution/add_solution.feature +++ b/tests/features/solution/add_solution.feature @@ -124,7 +124,7 @@ Feature: "Add solution" visibility options. And I should see the heading "Espresso is the solution" When all e-mails have been sent And I am logged in as "Ruth Lee" - And I go to the "Espresso is the solution" solution edit form + When I go to the edit form of the "Espresso is the solution" solution And I press "Publish" # The name of the solution should exist in the block of the relative content in a collection. Then I should see the heading "Espresso is the solution" @@ -300,7 +300,7 @@ Feature: "Add solution" visibility options. | contact information | Invisible Man | Given I am logged in as a moderator - When I go to the "Cleaning solution" solution edit form + When I go to the edit form of the "Cleaning solution" solution When I click "Additional fields" tab And I remove the first file from "Logo" And I remove the first file from "Banner" diff --git a/tests/features/solution/solution.edit.feature b/tests/features/solution/solution.edit.feature index 5416525b01..ab1e1013d5 100644 --- a/tests/features/solution/solution.edit.feature +++ b/tests/features/solution/solution.edit.feature @@ -60,7 +60,7 @@ Feature: Solution editing. Then I should see the heading "Solution A" And I should see the link "Edit" - When I go to the "Solution A" solution edit form + When I go to the edit form of the "Solution A" solution Then I should see the heading "Edit Solution Solution A" Then the fields "Logo, Banner, Upload a new file or enter a URL, Geographical coverage, Keywords, Related solutions, Status, Languages, Landing page, Metrics page" should be correctly ordered in the region "Management solution vertical tab" Then the fields "Title, Description, Contact information, Topic, Owner, Solution type, Moderated, Content creation" should be correctly ordered in the region "Main solution vertical tab" @@ -81,7 +81,7 @@ Feature: Solution editing. # This user is an owner only of Solution A. When I go to the homepage of the "Another solution" solution Then I should not see the link "Edit" - When I go to the "Another solution" solution edit form + When I go to the edit form of the "Another solution" solution Then I should get an access denied error # Clean up the solution that was created through the UI. @@ -100,12 +100,12 @@ Feature: Solution editing. When I am logged in as a facilitator of the "Solution B" solution And I go to the homepage of the "Solution B" solution Then I should see the link "Edit" - When I go to the "Solution B" solution edit form + When I go to the edit form of the "Solution B" solution Then I should see the heading "Edit Solution Solution B" When I go to the homepage of the "Another solution" solution Then I should not see the link "Edit" - When I go to the "Another solution" solution edit form + When I go to the edit form of the "Another solution" solution Then I should get an access denied error @javascript diff --git a/tests/features/solution/trr.feature b/tests/features/solution/trr.feature index 2519930b0d..eaca658263 100644 --- a/tests/features/solution/trr.feature +++ b/tests/features/solution/trr.feature @@ -113,7 +113,7 @@ Feature: Creating a test (solution) in the TRR collection. # The GITB compliant field is only shown when the solution has a certain solution type. When I am logged in as a "facilitator" of the "TRR solution foo" solution - When I go to the "TRR Distribution foo" asset distribution edit form + When I go to the edit form of the "TRR Distribution foo" distribution Then the following fields should be present "GITB compliant" When I go to the homepage of the "TRR release foo" release @@ -121,7 +121,7 @@ Feature: Creating a test (solution) in the TRR collection. Then the following fields should be present "GITB compliant" When I am logged in as a "facilitator" of the "TRR solution bar" solution - When I go to the "TRR Distribution bar" asset distribution edit form + When I go to the edit form of the "TRR Distribution foo" distribution Then the following fields should not be present "GITB compliant" When I go to the homepage of the "TRR release bar" release diff --git a/tests/src/Context/AssetDistributionContext.php b/tests/src/Context/AssetDistributionContext.php index f2ba05671f..0862d0738a 100644 --- a/tests/src/Context/AssetDistributionContext.php +++ b/tests/src/Context/AssetDistributionContext.php @@ -47,24 +47,6 @@ public function visitDistribution(string $asset_distribution): void { $this->visitPath($entity->toUrl()->toString()); } - /** - * Navigates to the edit form of an asset distribution. - * - * @param string $asset_distribution - * The title of the $asset_distribution. - * - * @When I go to the :asset_distribution asset distribution edit form - * @When I visit the :asset_distribution asset distribution edit form - * - * @throws \Drupal\Core\Entity\EntityMalformedException - */ - public function visitEditAssetDistribution(string $asset_distribution): void { - /** @var \Drupal\rdf_entity\Entity\Rdf $entity */ - $entity = $this->getAssetDistributionByName($asset_distribution); - $path = $entity->toUrl('edit-form')->toString(); - $this->visitPath($path); - } - /** * Creates a number of asset distributions with data provided in a table. * diff --git a/tests/src/Context/AssetReleaseContext.php b/tests/src/Context/AssetReleaseContext.php index bd874984ba..84d9b88628 100644 --- a/tests/src/Context/AssetReleaseContext.php +++ b/tests/src/Context/AssetReleaseContext.php @@ -46,23 +46,6 @@ public function visitRelease(string $asset_release): void { $this->visitPath($entity->toUrl()->toString()); } - /** - * Navigates to the edit form of a release. - * - * @param string $release - * The title of the release. - * - * @When I go to the :release release edit form - * @When I visit the :release release edit form - * - * @throws \Drupal\Core\Entity\EntityMalformedException - */ - public function visitEditAssetDistribution(string $release): void { - /** @var \Drupal\rdf_entity\Entity\Rdf $entity */ - $entity = $this->getAssetReleaseByName($release); - $this->visitPath($entity->toUrl('edit-form')->toString()); - } - /** * Creates a number of asset_releases with data provided in a table. * diff --git a/tests/src/Context/CollectionContext.php b/tests/src/Context/CollectionContext.php index 478d8bdcf8..7d002c74ea 100644 --- a/tests/src/Context/CollectionContext.php +++ b/tests/src/Context/CollectionContext.php @@ -126,29 +126,6 @@ protected function getCollectionByName(string $title): RdfInterface { return $this->getRdfEntityByLabel($title, 'collection'); } - /** - * Navigates to the edit form of a collection. - * - * @param string $collection - * The title of the collection. - * @param string $form - * The entity form. Either 'edit' or 'delete'. - * - * @throws \InvalidArgumentException - * If an invalid $form parameter was passed. - * - * @When I go to the :collection collection :form form - * @When I visit the :collection collection :form form - */ - public function visitCollectionForm(string $collection, string $form): void { - if (!in_array($form, ['edit', 'delete'])) { - throw new \InvalidArgumentException('Only "edit" and "delete" are allowed for the $form variable.'); - } - $collection = $this->getCollectionByName($collection); - $path = $collection->toUrl("{$form}-form")->getInternalPath(); - $this->visitPath($path); - } - /** * Navigates to the collections overview page. * @@ -630,7 +607,7 @@ public function verifyStateButtons(TableNode $check_table): void { } // Go to the edit form and check that the expected buttons are visible. - $this->visitCollectionForm($values['collection'], 'edit'); + $this->visitEntityForm('edit', $values['collection'], 'collection'); $buttons = $this->explodeCommaSeparatedStepArgument($values['buttons']); $this->assertSubmitButtonsVisible($buttons); } diff --git a/tests/src/Context/JoinupCommunityContentContext.php b/tests/src/Context/JoinupCommunityContentContext.php index 4a51f851ff..67498d2357 100644 --- a/tests/src/Context/JoinupCommunityContentContext.php +++ b/tests/src/Context/JoinupCommunityContentContext.php @@ -202,34 +202,6 @@ public function assertEqualRevisionsPublicationTime(string $title, string $type, Assert::assertEquals($node->getPublicationTime(), $revision->getPublicationTime()); } - /** - * Navigates to the edit or delete form of a community content. - * - * @param string $action - * The action. Either 'edit' or 'delete'. - * @param string $title - * The title of the community content. - * @param string $bundle - * The community content type. Usually one of 'discussion', document', - * 'event', news', but can in fact be any node type. - * - * @throws \InvalidArgumentException - * Thrown when an invalid action is passed. - * @throws \Drupal\Core\Entity\EntityMalformedException - * Thrown when the form URL cannot be generated for the community content. - * - * @When I go to the :action form of the :title :bundle - * @When I visit the :action form of the :title :bundle - */ - public function visitNodeForm(string $action, string $title, string $bundle): void { - if (!in_array($action, ['edit', 'delete'])) { - throw new \InvalidArgumentException('Only "edit" and "delete" actions are allowed.'); - } - $node = $this->getNodeByTitle($title, $bundle); - $path = $node->toUrl("{$action}-form")->getInternalPath(); - $this->visitPath($path); - } - /** * Update one of the date properties of a node. * diff --git a/tests/src/Context/JoinupContext.php b/tests/src/Context/JoinupContext.php index 391a7e2927..92e672d6a4 100644 --- a/tests/src/Context/JoinupContext.php +++ b/tests/src/Context/JoinupContext.php @@ -457,22 +457,21 @@ public function iCommitTheSolrIndex() { } /** - * Navigates to the edit form of a node entity. + * Navigates to the edit or delete form of an entity. * - * @param string $bundle - * The type of the node entity. + * @param string $action + * The action. Either 'edit' or 'delete'. * @param string $title - * The title of the node. - * - * @When I go to the :bundle (content ) :title edit screen - * @When I visit the :bundle (content ) :title edit screen + * The title of the entity. + * @param string $bundle + * An alias of a bundle as defined in the + * \Drupal\joinup\Traits\EntityTrait::bundleAliases method. * - * @throws \Drupal\Core\Entity\EntityMalformedException + * @When I go to the :action form of the :title :bundle + * @When I visit the :action form of the :title :bundle */ - public function visitNodeEditForm($bundle, $title) { - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->getNodeByTitle($title, $bundle); - $this->visitPath($node->toUrl('edit-form')->toString()); + public function goToEntityForm(string $action, string $title, string $bundle): void { + $this->visitEntityForm($action, $title, $bundle); } /** diff --git a/tests/src/Context/SolutionContext.php b/tests/src/Context/SolutionContext.php index f26036648d..0e5c3885f1 100644 --- a/tests/src/Context/SolutionContext.php +++ b/tests/src/Context/SolutionContext.php @@ -93,24 +93,6 @@ public function visitSolution($solution) { $this->visitPath($entity->toUrl()->toString()); } - /** - * Navigates to the edit form of a solution. - * - * @param string $solution - * The name of the solution. - * - * @When I go to the :solution solution edit form - * @When I visit the :solution solution edit form - * - * @throws \Drupal\Core\Entity\EntityMalformedException - */ - public function visitEditSolution($solution) { - /** @var \Drupal\rdf_entity\Entity\Rdf $entity */ - $entity = $this->getSolutionByName($solution); - $path = $entity->toUrl('edit-form')->toString(); - $this->visitPath($path); - } - /** * Navigates to the solution overview page. * @@ -676,7 +658,7 @@ public function verifyWorkflowStates(TableNode $check_table): void { } // Go to the edit form and check that the expected buttons are visible. - $this->visitEditSolution($values['solution']); + $this->visitEntityForm('edit', $values['solution'], 'solution'); $buttons = $this->explodeCommaSeparatedStepArgument($values['buttons']); $this->assertSubmitButtonsVisible($buttons); } diff --git a/tests/src/Traits/EntityTrait.php b/tests/src/Traits/EntityTrait.php index 6a4c1ee0cd..694e7296df 100644 --- a/tests/src/Traits/EntityTrait.php +++ b/tests/src/Traits/EntityTrait.php @@ -76,9 +76,21 @@ protected static function getEntityByLabel(string $entity_type_id, string $label protected static function entityTypeAliases(): array { return [ 'collection' => 'rdf_entity', + 'contact information' => 'rdf_entity', 'content' => 'node', + 'custom page' => 'node', + 'discussion' => 'node', + 'distribution' => 'rdf_entity', + 'document' => 'node', + 'event' => 'node', + 'glossary' => 'node', 'group' => 'rdf_entity', + 'news' => 'node', + 'owner' => 'rdf_entity', + 'release' => 'rdf_entity', 'solution' => 'rdf_entity', + 'spdx licence' => 'rdf_entity', + 'tallinn report' => 'node', ]; } @@ -126,10 +138,16 @@ protected static function translateBundle(string $bundle): string { */ protected static function bundleAliases(): array { return [ - 'contact information' => 'contact_information', + 'custom page' => 'custom_page', + 'discussion' => 'discussion', 'distribution' => 'asset_distribution', + 'document' => 'document', + 'event' => 'event', + 'glossary' => 'glossary', + 'news' => 'news', 'release' => 'asset_release', 'spdx licence' => 'spdx_licence', + 'tallinn report' => 'tallinn_report', ]; } @@ -184,4 +202,33 @@ protected function forceSearchApiReindex(ContentEntityInterface $entity): void { ContentEntity::indexEntity($entity); } + /** + * Navigates to the edit or delete form of an entity. + * + * @param string $action + * The action. Either 'edit' or 'delete'. + * @param string $title + * The title of the entity. + * @param string $bundle + * An alias of a bundle as defined in the + * \Drupal\joinup\Traits\EntityTrait::bundleAliases method. + * + * @throws \InvalidArgumentException + * Thrown when an invalid action is passed. + * @throws \Drupal\Core\Entity\EntityMalformedException + * Thrown when the form URL cannot be generated for the community content. + */ + public function visitEntityForm(string $action, string $title, string $bundle): void { + if (!in_array($action, ['edit', 'delete'])) { + throw new \InvalidArgumentException('Only "edit" and "delete" actions are allowed.'); + } + + $entity_type_id = $this->translateEntityTypeAlias($bundle); + + $bundle = $this->translateBundle($bundle); + $node = $this->getEntityByLabel($entity_type_id, $title, $bundle); + $path = $node->toUrl("{$action}-form")->getInternalPath(); + $this->visitPath($path); + } + } diff --git a/web/modules/custom/joinup_core/src/Plugin/Condition/RequestRouteCondition.php b/web/modules/custom/joinup_core/src/Plugin/Condition/RequestRouteCondition.php index 0b48aa93cb..7b172367a6 100644 --- a/web/modules/custom/joinup_core/src/Plugin/Condition/RequestRouteCondition.php +++ b/web/modules/custom/joinup_core/src/Plugin/Condition/RequestRouteCondition.php @@ -88,7 +88,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void { - $routes = array_filter(array_map('trim', explode("\n", str_replace("\r", "\n", $form_state->getValue('routes'))))); + $routes = array_values(array_filter(array_map('trim', explode("\n", str_replace("\r", "\n", $form_state->getValue('routes')))))); $this->setConfig('routes', $routes); parent::submitConfigurationForm($form, $form_state); }