Skip to content

Commit

Permalink
Merge pull request #217 from scientist-softserv/210-search-on-browse-…
Browse files Browse the repository at this point in the history
…tests

210-search-on-browse-tests
  • Loading branch information
DiemBTran authored Feb 17, 2023
2 parents 8b669cf + 1f124ef commit b925b6a
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion cypress/e2e/browsing.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,41 @@ describe('Browsing', () => {
cy.get('button.search-button').click()

// The new url should include "/browse"
cy.url().should('include', '/browse?=next')
cy.url().should('include', '/browse?q=next')

// The search bar on the browse page should have the text that was searched for
cy.get('input.search-bar').should('have.value', 'next')
})

it('completes a search from the "/browse" with a blank query', () => {
// Start from the browse page
cy.visit('/browse')

// Find the search button and perform an empty search, which should lead to the browse page
cy.get('button.search-button').click()

// The new url should include "/browse"
cy.url().should('include', '/browse')

// The new url should not contain a query
cy.url().should('not.include', '?')

// The search bar on the browse page should remain blank
cy.get('input.search-bar').should('have.value', '')
})

it('completes a search from "/browse" with a query term', () => {
// Start from the browse page
cy.visit('/browse')

// type an example search into the searchbar
cy.get('input.search-bar').type('next')

// Press the search button
cy.get('button.search-button').click()

// The new url should include "/browse"
cy.url().should('include', '/browse?q=next')

// The search bar on the browse page should have the text that was searched for
cy.get('input.search-bar').should('have.value', 'next')
Expand Down

0 comments on commit b925b6a

Please sign in to comment.