From 60e9d0d84d4bd8789b7a4326692f965bee14e7c9 Mon Sep 17 00:00:00 2001 From: beatrizmaselli Date: Mon, 6 Nov 2023 18:57:58 -0300 Subject: [PATCH] add cy.searchProduct --- ....4-order_product_via_pick_up_store.spec.js | 3 +-- cypress/support/search_product.js | 27 ------------------- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 cypress/support/search_product.js diff --git a/cypress/integration/2.4-order_product_via_pick_up_store.spec.js b/cypress/integration/2.4-order_product_via_pick_up_store.spec.js index 59a07f4..b42187f 100644 --- a/cypress/integration/2.4-order_product_via_pick_up_store.spec.js +++ b/cypress/integration/2.4-order_product_via_pick_up_store.spec.js @@ -1,6 +1,5 @@ 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 @@ -11,7 +10,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 - searchProduct(productName) + cy.searchProduct(productName) // Add product to cart cy.addProduct(productName) }) diff --git a/cypress/support/search_product.js b/cypress/support/search_product.js deleted file mode 100644 index 923466c..0000000 --- a/cypress/support/search_product.js +++ /dev/null @@ -1,27 +0,0 @@ -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') -}