Skip to content

Commit

Permalink
Added initial Cypress test to for search results
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobArrow committed Jan 15, 2025
1 parent 25ebd4d commit c623fe0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cypress/e2e/search.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import SearchFacetsFactory from "../factories/searchFacets"
import SearchWithPaginationFactory from "../factories/searchWithPagination"

describe("Search Result Tests", () => {
beforeEach(() => {
// Intercept search request
cy.interceptGraphql({
operationName: "searchWithPagination",
factory: SearchWithPaginationFactory,
})
// Intercept search facets
cy.interceptGraphql({
operationName: "searchFacets",
factory: SearchFacetsFactory,
})
})

it("Should get results when searching", () => {
cy.visit("/")

// Search for harry potter and press enter
cy.dataCy("search-input").should("exist").focus().type("harry potter{enter}")

// Check if search results are displayed
cy.dataCy("work-card").should("have.length.above", 6)
})
})

0 comments on commit c623fe0

Please sign in to comment.