press enter shows search result page

This commit is contained in:
Moriz Wahl 2020-06-04 16:01:03 +02:00
parent a9b1958161
commit 08aaf9c7a6
2 changed files with 25 additions and 5 deletions

View File

@ -37,7 +37,7 @@ Then("I should see the following posts in the select dropdown:", table => {
});
Then("I should see the following users in the select dropdown:", table => {
cy.get(".ds-heading").should("contain", "Users");
cy.get(".search-heading").should("contain", "Users");
table.hashes().forEach(({ slug }) => {
cy.get(".ds-select-dropdown").should("contain", slug);
});
@ -85,6 +85,26 @@ Then(
}
);
Then("I should see the search results page", () => {
cy.location("pathname").should(
"eq",
"/search/search-results"
);
cy.location("search").should(
"eq",
"?search=PR"
);
});
Then("I should see the following posts on the search results page",
() => {
cy.get(".post-teaser").should(
"contain",
"101 Essays that will change the way you think"
);
}
);
Then(
"I should not see posts without the searched-for term in the select dropdown",
() => {

View File

@ -8,7 +8,7 @@ Feature: Search
And we have the following posts in our database:
| id | title | content |
| p1 | 101 Essays that will change the way you think | 101 Essays, of course (PR)! |
| p2 | No searched for content | will be found in this post, I guarantee |
| p2 | No content | will be found in this post, I guarantee |
And we have the following user accounts:
| slug | name | id |
| search-for-me | Search for me | user-for-search |
@ -23,10 +23,10 @@ Feature: Search
| title |
| 101 Essays that will change the way you think |
Scenario: Press enter starts search
Scenario: Press enter opens search page
When I type "PR" and press Enter
Then I should have one item in the select dropdown
Then I should see the following posts in the select dropdown:
Then I should see the search results page
Then I should see the following posts on the search results page
| title |
| 101 Essays that will change the way you think |