diff --git a/cypress/integration/common/search.js b/cypress/integration/common/search.js index 1feece77e..5eae20a22 100644 --- a/cypress/integration/common/search.js +++ b/cypress/integration/common/search.js @@ -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", () => { diff --git a/cypress/integration/search/Search.feature b/cypress/integration/search/Search.feature index b77b45d8e..d128838f3 100644 --- a/cypress/integration/search/Search.feature +++ b/cypress/integration/search/Search.feature @@ -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 |