Skip to content

Shop by search.feature #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: v3.5.1.
name: v3.5.1
on:
push

Expand Down
4 changes: 2 additions & 2 deletions src/test/features/ShopBySearch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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>" section and the user clicks on "<Attire>" 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 |
| Men | Shorts |
11 changes: 8 additions & 3 deletions src/test/pages/ShopBySearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>{
public async searchProduct():Promise<any> {
console.log('Selected product:', UserShoppingByWear.globalArray[0]);
await this.shopBySearchLocators.searchBar().fill(UserShoppingByWear.globalArray[0]);
await pageFixture.page.keyboard.press('Enter');
};
};

public async checkOutToCart():Promise<void> {
await this.shopBySearchLocators.addToCartBtn().click();
};
};
4 changes: 4 additions & 0 deletions src/test/resources/shopBySearchPage.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{
"elementName": "searchBar",
"selectorValue": "//div[contains(@class,'field search')]//input"
},
{
"elementName": "goToCartBtn",
"selectorValue": "//div[contains(@class, 'minicart')]//span[contains(.,'My Cart')]"
}
]
}
3 changes: 2 additions & 1 deletion src/test/steps/shopBySearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Loading