Skip to content

fix: removed getProduct function and declared a globalArray to fetch … #27

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 1 commit into from
Jun 24, 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 src/test/features/ShopBySearch.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@ShopyBySearch
@ShopBySearch

Feature: Verify that the user is able to purchase an item by searching.

Expand Down
11 changes: 5 additions & 6 deletions src/test/pages/ShopBySearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import { pageFixture } from "../hooks/pageFixture";
};


public async searchProduct():Promise<any>{
const product: string = await this.saveSelectedProduct();
console.log('Selected product:', product);
await this.shopBySearchLocators.searchBar().fill(product); // Fill searchBarInput with the actual product name
await pageFixture.page.keyboard.press('Enter');
};
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');
};
};
10 changes: 4 additions & 6 deletions src/test/pages/UserShoppingByWear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { Page, expect } from "@playwright/test";
pageFixture.page = page;
};

// public static savedProductName:string;
public static globalArray: string[] = [];

userShoppingByWearByWearLocators = {
shoppingSectionHeader:() => pageFixture.page.locator(getResource('shoppingSectionHeader').selectorValue),
Expand Down Expand Up @@ -104,11 +104,9 @@ import { Page, expect } from "@playwright/test";
await pageFixture.logger.info('User navigated successfully.')
};
};
};

public async saveSelectedProduct():Promise<any>{
const productName = (await (this.userShoppingByWearByWearLocators.pageTitle().textContent())).trim();
return productName;
const productName = await this.userShoppingByWearByWearLocators.pageTitle().innerText();
UserShoppingByWear.globalArray.push(productName)
return console.log('inside the selectRandomProductFunction', UserShoppingByWear.globalArray)
};

public async getProductPriceAndSizes():Promise<void>{
Expand Down
Loading