-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug: clear/change search not working
- Loading branch information
Showing
4 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
describe("Search page", () => { | ||
beforeEach(() => { | ||
// Cypress starts out with a blank slate for each test | ||
// so we must tell it to visit our website with the `cy.visit()` command. | ||
// Since we want to visit the same URL at the start of all our tests, | ||
// we include it in our beforeEach function so that it runs before each test | ||
cy.visit("/search"); | ||
}); | ||
|
||
it("Searching from filter input yields results", () => { | ||
cy.get("#filterSearchInput").type("press release{enter}"); | ||
cy.intercept("http://localhost:3000/search?search=press+release").as( | ||
"search" | ||
); | ||
cy.on("url:changed", (newUrl) => { | ||
expect(newUrl).to.contain("?search=press+release"); | ||
}); | ||
cy.get("ul li").its("length").should("be.gte", 1); | ||
}); | ||
it("Clear button resets search", () => { | ||
cy.get("[data-cy='clear']").click(); | ||
cy.intercept("http://localhost:3000/search?search=press+release").as( | ||
"search" | ||
); | ||
cy.on("url:changed", (newUrl) => { | ||
cy.get("#filterSearchInput").should("have.value", ""); | ||
expect(newUrl).to.be("http://localhost:3000/search"); | ||
}); | ||
}); | ||
}); |