diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 1a9891a7a..d05f80f13 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -86,6 +86,10 @@ Given('my user account has the role {string}', role => { When('I log out', cy.logout) +When('I visit {string}', page => { + cy.openPage(page) +}) + When('I visit the {string} page', page => { cy.openPage(page) }) diff --git a/cypress/integration/identifier/PersistentLinks.feature b/cypress/integration/identifier/PersistentLinks.feature new file mode 100644 index 000000000..b4a55cee3 --- /dev/null +++ b/cypress/integration/identifier/PersistentLinks.feature @@ -0,0 +1,41 @@ +Feature: Persistent Links + As a user + I want to click on a link with an 'href' having an unmodifiable id of a user + In order to have persistent links even if the user changes a his/her slug + + | | Modifiable | Referenceable | Unique | Purpose | + | -- | -- | -- | -- | -- | + | ID | no | yes | yes | Identity, Traceability, Links | + | Slug | yes | yes | yes | @-Mentions, SEO-friendly URL | + | Name | yes | no | no | Search, self-description | + + + Background: + Given we have the following user accounts: + | id | name | slug | + | MHNqce98y1 | Stepen Hawking | thehawk | + And we have the following posts in our 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 "" + 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 |