2021-03-02 08:38:24 +00:00
|
|
|
import { PRODUCTS_SELECTORS } from "../elements/catalog/products/product-selectors";
|
2021-02-12 14:36:13 +00:00
|
|
|
|
|
|
|
class ProductSteps {
|
2021-02-23 12:09:58 +00:00
|
|
|
valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
|
|
|
valueFalse = PRODUCTS_SELECTORS.radioButtonsValueFalse;
|
|
|
|
|
2021-02-12 14:36:13 +00:00
|
|
|
updateProductIsAvailableForPurchase(productUrl, isAvailableForPurchase) {
|
2021-02-23 12:09:58 +00:00
|
|
|
const isAvailableForPurchaseSelector = isAvailableForPurchase
|
|
|
|
? this.valueTrue
|
|
|
|
: this.valueFalse;
|
|
|
|
const availableForPurchaseSelector = `${PRODUCTS_SELECTORS.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`;
|
|
|
|
this.updateProductMenageInChannel(productUrl, availableForPurchaseSelector);
|
2021-02-12 14:36:13 +00:00
|
|
|
}
|
|
|
|
updateProductPublish(productUrl, isPublished) {
|
2021-02-23 12:09:58 +00:00
|
|
|
const isPublishedSelector = isPublished ? this.valueTrue : this.valueFalse;
|
|
|
|
const publishedSelector = `${PRODUCTS_SELECTORS.publishedRadioButtons}${isPublishedSelector}`;
|
|
|
|
this.updateProductMenageInChannel(productUrl, publishedSelector);
|
2021-02-12 14:36:13 +00:00
|
|
|
}
|
|
|
|
updateProductVisibleInListings(productUrl) {
|
|
|
|
this.updateProductMenageInChannel(
|
|
|
|
productUrl,
|
|
|
|
PRODUCTS_SELECTORS.visibleInListingsButton
|
|
|
|
);
|
|
|
|
}
|
|
|
|
updateProductMenageInChannel(productUrl, menageSelector) {
|
|
|
|
cy.visit(productUrl)
|
|
|
|
.get(PRODUCTS_SELECTORS.assignedChannels)
|
|
|
|
.click()
|
|
|
|
.get(menageSelector)
|
2021-02-23 12:09:58 +00:00
|
|
|
.click();
|
|
|
|
cy.addAliasToGraphRequest("ProductChannelListingUpdate");
|
|
|
|
cy.get(PRODUCTS_SELECTORS.saveBtn)
|
2021-02-12 14:36:13 +00:00
|
|
|
.click()
|
2021-02-23 12:09:58 +00:00
|
|
|
.wait("@ProductChannelListingUpdate");
|
2021-02-12 14:36:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
export default ProductSteps;
|