diff --git a/cypress/e2e/products/manageProducts/publishedProducts.js b/cypress/e2e/products/manageProducts/publishedProducts.js index 045c21e4d..63eb1c143 100644 --- a/cypress/e2e/products/manageProducts/publishedProducts.js +++ b/cypress/e2e/products/manageProducts/publishedProducts.js @@ -73,7 +73,8 @@ describe("Published products", () => { .then(({ product: productResp }) => { const product = productResp; const productUrl = productDetailsUrl(product.id); - updateProductPublish(productUrl, true); + cy.visit(productUrl); + updateProductPublish(true); getProductDetails(product.id, defaultChannel.slug); }) .then(resp => { @@ -101,7 +102,8 @@ describe("Published products", () => { .then(({ product: productResp }) => { product = productResp; const productUrl = productDetailsUrl(product.id); - updateProductPublish(productUrl, false); + cy.visit(productUrl); + updateProductPublish(false); getProductDetails(product.id, defaultChannel.slug); }) .then(resp => { diff --git a/cypress/e2e/products/manageProducts/visibleInListingsProducts.js b/cypress/e2e/products/manageProducts/visibleInListingsProducts.js index ce353b505..08efd9a41 100644 --- a/cypress/e2e/products/manageProducts/visibleInListingsProducts.js +++ b/cypress/e2e/products/manageProducts/visibleInListingsProducts.js @@ -72,7 +72,8 @@ describe("Products displayed in listings", () => { .then(({ product: productResp }) => { const product = productResp; const productUrl = productDetailsUrl(product.id); - updateProductVisibleInListings(productUrl); + cy.visit(productUrl); + updateProductVisibleInListings(); searchInShop(productName); }) .then(resp => { @@ -103,7 +104,8 @@ describe("Products displayed in listings", () => { .then(({ product: productResp }) => { const product = productResp; const productUrl = productDetailsUrl(product.id); - updateProductVisibleInListings(productUrl); + cy.visit(productUrl); + updateProductVisibleInListings(); searchInShop(productName).then(resp => { const isProductVisible = isProductVisibleInSearchResult( diff --git a/cypress/elements/channels/available-channels-form.js b/cypress/elements/channels/available-channels-form.js index bb91586a7..705a4e7b5 100644 --- a/cypress/elements/channels/available-channels-form.js +++ b/cypress/elements/channels/available-channels-form.js @@ -5,6 +5,6 @@ export const AVAILABLE_CHANNELS_FORM = { availableForPurchaseRadioButtons: "[name*='isAvailableForPurchase']", radioButtonsValueTrue: "[value='true']", radioButtonsValueFalse: "[value='false']", - visibleInListingsButton: "[name*='visibleInListings']", + visibleInListingsButton: "[id*='visibleInListings']", availableChannel: "[data-test-id*='channel-availability-item']", }; diff --git a/cypress/support/pages/catalog/products/productDetailsPage.js b/cypress/support/pages/catalog/products/productDetailsPage.js index 8bbc1c2ea..274807c90 100644 --- a/cypress/support/pages/catalog/products/productDetailsPage.js +++ b/cypress/support/pages/catalog/products/productDetailsPage.js @@ -16,33 +16,33 @@ export function updateProductIsAvailableForPurchase( ? valueTrue : valueFalse; const availableForPurchaseSelector = `${AVAILABLE_CHANNELS_FORM.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`; - updateProductManageInChannel(productUrl, availableForPurchaseSelector); + updateProductManageInChannel(availableForPurchaseSelector); } -export function updateProductPublish(productUrl, isPublished) { +export function updateProductPublish(isPublished) { const isPublishedSelector = isPublished ? valueTrue : valueFalse; const publishedSelector = `${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${isPublishedSelector}`; - updateProductManageInChannel(productUrl, publishedSelector); + updateProductManageInChannel(publishedSelector); } -export function updateProductVisibleInListings(productUrl) { - updateProductManageInChannel( - productUrl, - AVAILABLE_CHANNELS_FORM.visibleInListingsButton, - ); +export function updateProductVisibleInListings() { + updateProductManageInChannel(AVAILABLE_CHANNELS_FORM.visibleInListingsButton); } -function updateProductManageInChannel(productUrl, manageSelector) { - cy.visit(productUrl) - .get(AVAILABLE_CHANNELS_FORM.assignedChannels) +function updateProductManageInChannel(manageSelector) { + cy.get(AVAILABLE_CHANNELS_FORM.assignedChannels) .click() .get(manageSelector) .first() + .scrollIntoView() .click() + // cypress click is to fast - our app is nor ready to handle new event when click occurs - solution could be disabling save button until app is ready to handle new event + .wait(1000) .waitForProgressBarToNotBeVisible() .addAliasToGraphRequest("ProductChannelListingUpdate") .get(BUTTON_SELECTORS.confirm) .click() + .confirmationMessageShouldAppear() .wait("@ProductChannelListingUpdate"); }