Skip to content

Commit

Permalink
Fix: conflict issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Oct 8, 2024
1 parent 4d5a30e commit 60dfed8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 74 deletions.
93 changes: 22 additions & 71 deletions tests/pw/pages/productsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,55 +1149,6 @@ export class ProductsPage extends AdminPage {
}
}

// add product other options (product status, visibility, purchase note, reviews)
async addProductOtherOptions(productName: string, otherOption: product['productInfo']['otherOptions'], choice: string): Promise<void> {
await this.goToProductEdit(productName);

switch (choice) {
case 'status':
await this.selectByValue(productsVendor.otherOptions.productStatus, otherOption.status);
break;
case 'visibility':
await this.selectByValue(productsVendor.otherOptions.visibility, otherOption.visibility);
break;
case 'purchaseNote':
await this.clearAndType(productsVendor.otherOptions.purchaseNote, otherOption.purchaseNote);
break;
case 'reviews':
if (otherOption.enableReview) {
await this.check(productsVendor.otherOptions.enableProductReviews);
} else {
await this.uncheck(productsVendor.otherOptions.enableProductReviews);
}
break;
default:
break;
}

await this.saveProduct();

switch (choice) {
case 'status':
await this.toHaveSelectedValue(productsVendor.otherOptions.productStatus, otherOption.status);
break;
case 'visibility':
await this.toHaveSelectedValue(productsVendor.otherOptions.visibility, otherOption.visibility);
break;
case 'purchaseNote':
await this.toHaveValue(productsVendor.otherOptions.purchaseNote, otherOption.purchaseNote);
break;
case 'reviews':
if (otherOption.enableReview) {
await this.toBeChecked(productsVendor.otherOptions.enableProductReviews);
} else {
await this.notToBeChecked(productsVendor.otherOptions.enableProductReviews);
}
break;
default:
break;
}
}

// add product catalog mode
async addProductCatalogMode(productName: string, hidePrice: boolean = false): Promise<void> {
await this.goToProductEdit(productName);
Expand Down Expand Up @@ -1269,17 +1220,17 @@ export class ProductsPage extends AdminPage {
await this.goToProductEdit(productName);
switch (choice) {
case 'up-sells':
for (const product of linkedProducts.upSells) {
await this.typeAndWaitForResponse(data.subUrls.ajax, productsVendor.linkedProducts.upSells, product);
await this.click(productsVendor.linkedProducts.searchedResult(product));
await this.toBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(product));
for (const linkedProduct of linkedProducts.upSells) {
await this.typeAndWaitForResponse(data.subUrls.ajax, productsVendor.linkedProducts.upSells, linkedProduct);
await this.click(productsVendor.linkedProducts.searchedResult(linkedProduct));
await this.toBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(linkedProduct));
}
break;
case 'cross-sells':
for (const product of linkedProducts.crossSells) {
await this.typeAndWaitForResponse(data.subUrls.ajax, productsVendor.linkedProducts.crossSells, product);
await this.click(productsVendor.linkedProducts.searchedResult(product));
await this.toBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(product));
for (const linkedProduct of linkedProducts.crossSells) {
await this.typeAndWaitForResponse(data.subUrls.ajax, productsVendor.linkedProducts.crossSells, linkedProduct);
await this.click(productsVendor.linkedProducts.searchedResult(linkedProduct));
await this.toBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(linkedProduct));
}
break;
default:
Expand All @@ -1290,13 +1241,13 @@ export class ProductsPage extends AdminPage {

switch (choice) {
case 'up-sells':
for (const product of linkedProducts.upSells) {
await this.toBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(product));
for (const linkedProduct of linkedProducts.upSells) {
await this.toBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(linkedProduct));
}
break;
case 'cross-sells':
for (const product of linkedProducts.upSells) {
await this.toBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(product));
for (const linkedProduct of linkedProducts.crossSells) {
await this.toBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(linkedProduct));
}
break;
default:
Expand All @@ -1309,14 +1260,14 @@ export class ProductsPage extends AdminPage {
await this.goToProductEdit(productName);
switch (choice) {
case 'up-sells':
for (const product of linkedProducts.upSells) {
await this.click(productsVendor.linkedProducts.removeSelectedUpSellProduct(product));
for (const linkedProduct of linkedProducts.upSells) {
await this.click(productsVendor.linkedProducts.removeSelectedUpSellProduct(linkedProduct));
await this.press('Escape'); // shift focus from element
}
break;
case 'cross-sells':
for (const product of linkedProducts.crossSells) {
await this.click(productsVendor.linkedProducts.removeSelectedCrossSellProduct(product));
for (const linkedProduct of linkedProducts.crossSells) {
await this.click(productsVendor.linkedProducts.removeSelectedCrossSellProduct(linkedProduct));
await this.press('Escape'); // shift focus from element
}
break;
Expand All @@ -1328,13 +1279,13 @@ export class ProductsPage extends AdminPage {

switch (choice) {
case 'up-sells':
for (const product of linkedProducts.upSells) {
await this.notToBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(product));
for (const linkedProduct of linkedProducts.upSells) {
await this.notToBeVisible(productsVendor.linkedProducts.selectedUpSellProduct(linkedProduct));
}
break;
case 'cross-sells':
for (const product of linkedProducts.upSells) {
await this.notToBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(product));
for (const linkedProduct of linkedProducts.crossSells) {
await this.notToBeVisible(productsVendor.linkedProducts.selectedCrossSellProduct(linkedProduct));
}
break;
default:
Expand Down Expand Up @@ -1476,7 +1427,7 @@ export class ProductsPage extends AdminPage {
await this.selectByValue(productsVendor.addon.formatTitle, addon.formatTitle);
await this.check(productsVendor.addon.addDescription);
await this.clearAndType(productsVendor.addon.descriptionInput, addon.addDescription);
await this.click(productsVendor.addon.requiredField);
await this.check(productsVendor.addon.requiredField);
// option
await this.clearAndType(productsVendor.addon.option.enterAnOption, addon.enterAnOption);
await this.selectByValue(productsVendor.addon.option.optionPriceType, addon.optionPriceType);
Expand All @@ -1502,7 +1453,7 @@ export class ProductsPage extends AdminPage {
await this.toBeChecked(productsVendor.addon.excludeAddons);
}

// export addon
// import addon
async importAddon(productName: string, addon: string, addonTitle: string): Promise<void> {
await this.goToProductEdit(productName);
await this.click(productsVendor.addon.import);
Expand Down
4 changes: 2 additions & 2 deletions tests/pw/tests/e2e/productsDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ test.describe('Product details functionality test', () => {
});

test('vendor can remove product addon', { tag: ['@pro', '@vendor'] }, async () => {
const [, , productName, addonName] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth);
await vendor.removeAddon(productName, addonName[0] as string);
const [, , productName, addonNames] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth);
await vendor.removeAddon(productName, addonNames[0] as string);
});

// rma options
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/tests/e2e/requestForQuoteRules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe('Request for quotation Rules test', () => {
});

test('admin can edit quote rule', { tag: ['@pro', '@admin'] }, async () => {
await admin.editQuoteRule({ ...data.requestForQuotation.quoteRule(), title: quoteRuleTitle, specificProducts: false, });
await admin.editQuoteRule({ ...data.requestForQuotation.quoteRule(), title: quoteRuleTitle, specificProducts: false });
});

test('admin can trash quote rule', { tag: ['@pro', '@admin'] }, async () => {
Expand Down

0 comments on commit 60dfed8

Please sign in to comment.