PersistentLinks.feature

This commit is contained in:
Ulf Gebhardt 2021-04-10 23:13:00 +02:00
parent f0a112ec1c
commit 7f11e99229
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
3 changed files with 27 additions and 40 deletions

View File

@ -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 "<url>"
Then I get redirected to "<redirectUrl>"
Scenario Outline: Link with healable information is valid and gets auto-completed
When I navigate to page "<url>"
Then I am on page "<redirectUrl>"
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 "<url>"
Then I get redirected to "<redirectUrl>"
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 |

View File

@ -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,

View File

@ -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);
});
}
})