diff --git a/cypress/integration/post/.PersistentLinks.feature b/cypress/integration/PersistentLinks.feature similarity index 56% rename from cypress/integration/post/.PersistentLinks.feature rename to cypress/integration/PersistentLinks.feature index 5ea48ef6a..8b519ddcd 100644 --- a/cypress/integration/post/.PersistentLinks.feature +++ b/cypress/integration/PersistentLinks.feature @@ -2,7 +2,6 @@ Feature: Persistent Links As a user I want all links to carry permanent information that identifies the linked resource In order to have persistent links even if a part of the URL might change - | | Modifiable | Referenceable | Unique | Purpose | | -- | -- | -- | -- | -- | | ID | no | yes | yes | Identity, Traceability, Links | @@ -11,31 +10,23 @@ Feature: Persistent Links Background: - Given we have the following user accounts: + Given I have an user account + And I am logged in + And the following "users" are in the database: | id | name | slug | | MHNqce98y1 | Stephen Hawking | thehawk | - And we have the following posts in our database: + And the following "posts" are in the database: | id | title | slug | | bWBjpkTKZp | 101 Essays that will change the way you think | 101-essays | - And I have a user account - And I am logged in - Scenario Outline: Link with slug only is valid and gets auto-completed - When I visit "" - Then I get redirected to "" + Scenario Outline: Link with healable information is valid and gets auto-completed + When I navigate to page "" + Then I am on page "" Examples: - | url | redirectUrl | - | /profile/thehawk | /profile/MHNqce98y1/thehawk | - | /post/101-essays | /post/bWBjpkTKZp/101-essays | - - Scenario: Link with id only will always point to the same user - When I visit "/profile/MHNqce98y1" - Then I get redirected to "/profile/MHNqce98y1/thehawk" - - Scenario Outline: ID takes precedence over slug - When I visit "" - Then I get redirected to "" - Examples: - | url | redirectUrl | - | /profile/MHNqce98y1/stephen-hawking | /profile/MHNqce98y1/thehawk | - | /post/bWBjpkTKZp/the-way-you-think | /post/bWBjpkTKZp/101-essays | + | url | redirectUrl | reason | + | /profile/thehawk | /profile/MHNqce98y1/thehawk | Identifiable user slug | + | /post/101-essays | /post/bWBjpkTKZp/101-essays | Identifiable post slug | + | /profile/MHNqce98y1 | /profile/MHNqce98y1/thehawk | Identifiable user ID | + | /post/bWBjpkTKZp | /post/bWBjpkTKZp/101-essays | Identifiable post ID | + | /profile/MHNqce98y1/stephen-hawking | /profile/MHNqce98y1/thehawk | Identifiable user ID takes precedence over slug | + | /post/bWBjpkTKZp/the-way-you-think | /post/bWBjpkTKZp/101-essays | Identifiable post ID takes precedence over slug | diff --git a/cypress/integration/common/.steps.js b/cypress/integration/common/.steps.js index 9b1c9a6d0..85415da67 100644 --- a/cypress/integration/common/.steps.js +++ b/cypress/integration/common/.steps.js @@ -84,15 +84,6 @@ Given("we have a selection of tags and categories as well as posts", () => { }) }); -Given("we have the following user accounts:", table => { - table.hashes().forEach(params => { - cy.factory().build("user", { - ...params, - ...termsAndConditionsAgreedVersion - }, params); - }); -}); - Given("my user account has the role {string}", role => { cy.factory().build("user", { role, diff --git a/cypress/integration/common/the_following_{string}_are_in_the_database.js b/cypress/integration/common/the_following_{string}_are_in_the_database.js index 1e1abbbf3..a6462092b 100644 --- a/cypress/integration/common/the_following_{string}_are_in_the_database.js +++ b/cypress/integration/common/the_following_{string}_are_in_the_database.js @@ -9,19 +9,24 @@ Given("the following {string} are in the database:", (table,data) => { deleted: Boolean(attributesOrOptions.deleted), disabled: Boolean(attributesOrOptions.disabled), pinned: Boolean(attributesOrOptions.pinned), - }, { - ...attributesOrOptions, - }); + }, + attributesOrOptions, + ); }) break case "comments": data.hashes().forEach((attributesOrOptions, i) => { - cy.factory().build("comment", { - ...attributesOrOptions, - }, { - ...attributesOrOptions, - }); + cy.factory().build("comment", + attributesOrOptions, + attributesOrOptions, + ); }) break + case "users": + data.hashes().forEach(params => { + cy.factory().build("user", + params, + params); + }); } }) \ No newline at end of file