generated from vtex-apps/react-app-template
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
829c543
commit bfc0063
Showing
3 changed files
with
30 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export function searchProduct(searchKey) { | ||
cy.qe( | ||
`Adding intercept to wait for the events API to be completed before visting home page` | ||
) | ||
cy.intercept('**/event-api/v1/*/event').as('events') | ||
cy.visit('/') | ||
cy.wait('@events') | ||
cy.qe("Verify the store front page should contain 'Hello'") | ||
cy.get('body').should('contain', 'Hello') | ||
cy.qe('Verifying the search bar should be visible in the store front') | ||
cy.qe(`searching product - ${searchKey} in the store front search bar`) | ||
// Search product in search bar | ||
cy.get(selectors.Search) | ||
.should('be.visible') | ||
.clear() | ||
.type(searchKey) | ||
.type('{enter}') | ||
// Page should load successfully now searchResult & Filter should be visible | ||
cy.qe( | ||
`Verfiying the search result is visible and having the text ${searchKey} in lowercase` | ||
) | ||
cy.get(selectors.searchResult) | ||
.should('be.visible') | ||
.should('have.text', searchKey.toLowerCase()) | ||
cy.qe(`Verifying the filterHeading should be visible`) | ||
cy.get(selectors.FilterHeading).should('be.visible') | ||
} |