Skip to content

Commit

Permalink
add search product
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizmaselli committed Nov 6, 2023
1 parent 829c543 commit bfc0063
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { testSetup, updateRetry } from '../support/common/support'
import { pickupTestCase } from '../support/outputvalidation.js'
import { searchProduct } from '../support/search_product.js'

describe('Test pickup in checkout with one of the pickup points created in 2.2 testcase', () => {
// Load test setup
Expand All @@ -10,7 +11,7 @@ describe('Test pickup in checkout with one of the pickup points created in 2.2 t

it(`${prefix} - Adding product to cart`, updateRetry(2), () => {
// Search the product
cy.searchProduct(productName)
searchProduct(productName)
// Add product to cart
cy.addProduct(productName)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Cypress.Commands.add('getPickupPointItem', () => {
})

Cypress.Commands.add('visitStore', () => {
cy.intercept('**/event-api/v1/productusqa/event').as('events')
cy.intercept('**/event-api/v1/*/event').as('events')
cy.visit('/api/io/stores')
cy.wait('@events')

Expand Down
27 changes: 27 additions & 0 deletions cypress/support/search_product.js
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)

Check failure on line 13 in cypress/support/search_product.js

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

'selectors' is not defined
.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)

Check failure on line 22 in cypress/support/search_product.js

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

'selectors' is not defined
.should('be.visible')
.should('have.text', searchKey.toLowerCase())
cy.qe(`Verifying the filterHeading should be visible`)
cy.get(selectors.FilterHeading).should('be.visible')

Check failure on line 26 in cypress/support/search_product.js

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

'selectors' is not defined
}

0 comments on commit bfc0063

Please sign in to comment.