diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c23acab..fb7fa28 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: v3.5.1. +name: v3.5.1 on: push diff --git a/src/test/features/ShopBySearch.feature b/src/test/features/ShopBySearch.feature index 7653e6f..e7e191c 100644 --- a/src/test/features/ShopBySearch.feature +++ b/src/test/features/ShopBySearch.feature @@ -10,8 +10,8 @@ Feature: Verify that the user is able to purchase an item by searching. Scenario: User navigates to any random product to get its title. When The user clicks on the "
" section and the user clicks on "" option. And The products are shown and user navigates to a product. - And User searches that product. + And User searches that product, going to the cart. Examples: | Section | Attire | - | Men | Shorts | \ No newline at end of file + | Men | Shorts | \ No newline at end of file diff --git a/src/test/pages/ShopBySearch.ts b/src/test/pages/ShopBySearch.ts index c1c7d50..1eafc95 100644 --- a/src/test/pages/ShopBySearch.ts +++ b/src/test/pages/ShopBySearch.ts @@ -11,13 +11,18 @@ import { pageFixture } from "../hooks/pageFixture"; shopBySearchLocators = { lumaLogo:() => pageFixture.page.locator(getResource('lumaLogo').selectorValue), - searchBar:() => pageFixture.page.locator(getResource('searchBar').selectorValue) + searchBar:() => pageFixture.page.locator(getResource('searchBar').selectorValue), + addToCartBtn:() => pageFixture.page.locator(getResource('goToCartBtn').selectorValue) }; - public async searchProduct():Promise{ + public async searchProduct():Promise { console.log('Selected product:', UserShoppingByWear.globalArray[0]); await this.shopBySearchLocators.searchBar().fill(UserShoppingByWear.globalArray[0]); await pageFixture.page.keyboard.press('Enter'); }; - }; \ No newline at end of file + + public async checkOutToCart():Promise { + await this.shopBySearchLocators.addToCartBtn().click(); + }; +}; \ No newline at end of file diff --git a/src/test/resources/shopBySearchPage.json b/src/test/resources/shopBySearchPage.json index f762236..6f01525 100644 --- a/src/test/resources/shopBySearchPage.json +++ b/src/test/resources/shopBySearchPage.json @@ -8,6 +8,10 @@ { "elementName": "searchBar", "selectorValue": "//div[contains(@class,'field search')]//input" + }, + { + "elementName": "goToCartBtn", + "selectorValue": "//div[contains(@class, 'minicart')]//span[contains(.,'My Cart')]" } ] } diff --git a/src/test/steps/shopBySearch.ts b/src/test/steps/shopBySearch.ts index 5e45c26..15464e9 100644 --- a/src/test/steps/shopBySearch.ts +++ b/src/test/steps/shopBySearch.ts @@ -5,6 +5,7 @@ import { pageFixture } from "../hooks/pageFixture"; setDefaultTimeout(60000); let shopBySearch = new ShopBySearch(pageFixture.page); -When('User searches that product.', async function (){ +When('User searches that product, going to the cart.', async function (){ await shopBySearch.searchProduct(); + await shopBySearch.checkOutToCart(); }); \ No newline at end of file