From 373c220429547a098520eed2ba0b34a01449401e Mon Sep 17 00:00:00 2001 From: engcom-Kilo Date: Fri, 26 Feb 2021 14:30:35 +0200 Subject: [PATCH] MC-40983: Add to Cart broken on lists view with redirect to cart enabled. --- .../StorefrontProductCompareMainSection.xml | 1 + .../templates/product/compare/list.phtml | 16 ++--- .../frontend/templates/product/list.phtml | 16 ++--- ...uctToCartFromComparisonListActionGroup.xml | 25 ++++++++ .../Test/Mftf/Data/CheckoutConfigData.xml | 14 +++- ...ctToCartWithRedirectToShoppingCartTest.xml | 64 +++++++++++++++++++ 6 files changed, 117 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddSimpleProductToCartFromComparisonListActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddSimpleProductToCartWithRedirectToShoppingCartTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml index ad31be6b277ee..9096201fdfbeb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml @@ -14,5 +14,6 @@ + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index 0bea3ca03dee8..07cca77178a38 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -73,7 +73,7 @@ action="escapeUrl($this->helper(Magento\Catalog\Helper\Product\Compare::class)->getAddToCartUrl($item)) ?>" method="post"> getBlockHtml('formkey') ?> - @@ -144,15 +144,13 @@ - isRedirectToCartEnabled()) :?> - - + } +
escapeHtml(__('You have no items to compare.')) ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index 6a47978f1e5c6..a831bd7be6f71 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -154,15 +154,13 @@ $_helper = $block->getData('outputHelper'); getToolbarHtml() ?> - isRedirectToCartEnabled()): ?> - - + } + diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddSimpleProductToCartFromComparisonListActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddSimpleProductToCartFromComparisonListActionGroup.xml new file mode 100644 index 0000000000000..0a4f37e783f7b --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddSimpleProductToCartFromComparisonListActionGroup.xml @@ -0,0 +1,25 @@ + + + + + + + + Add simple product from comparison page to the cart. Starts on products comparison page. + + + + + + + + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Data/CheckoutConfigData.xml b/app/code/Magento/Checkout/Test/Mftf/Data/CheckoutConfigData.xml index 13d9385101f18..ebc69f7122385 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Data/CheckoutConfigData.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Data/CheckoutConfigData.xml @@ -32,4 +32,16 @@ No 0 - \ No newline at end of file + + checkout/cart/redirect_to_cart + 0 + Yes + 1 + + + checkout/cart/redirect_to_cart + 0 + No + 0 + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddSimpleProductToCartWithRedirectToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddSimpleProductToCartWithRedirectToShoppingCartTest.xml new file mode 100644 index 0000000000000..6718a566d523a --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddSimpleProductToCartWithRedirectToShoppingCartTest.xml @@ -0,0 +1,64 @@ + + + + + + + + + <description value="Verify, user able add simple product to shopping cart from category page and compare products page when 'redirect to shopping cart' is enabled."/> + <testCaseId value="MC-41079"/> + <useCaseId value="MC-40983"/> + <severity value="CRITICAL"/> + <group value="shoppingCart"/> + <group value="checkout"/> + </annotations> + + <before> + <!--Enable redirect to shopping cart.--> + <magentoCLI command="config:set {{EnableRedirectToShoppingCart.path}} {{EnableRedirectToShoppingCart.value}}" stepKey="enableRedirectToShippingCart"/> + <!--Create test data.--> + <createData entity="_defaultCategory" stepKey="category"/> + <createData entity="SimpleProduct" stepKey="product"> + <requiredEntity createDataKey="category"/> + </createData> + </before> + <after> + <!--Disable redirect to shopping cart.--> + <magentoCLI command="config:set {{DisableRedirectToShoppingCart.path}} {{DisableRedirectToShoppingCart.value}}" stepKey="disableRedirectToShippingCart"/> + <!--Delete test data.--> + <deleteData createDataKey="product" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> + </after> + + <!--Try to add simple product to shopping cart.--> + <actionGroup ref="StorefrontNavigateToCategoryUrlActionGroup" stepKey="goToCategoryPage"> + <argument name="categoryUrl" value="$category.custom_attributes[url_key]$"/> + </actionGroup> + <actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$product$"/> + </actionGroup> + <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="verifyCartRedirectAfterAddingProductFromCategoryPage"/> + <!-- Add product to compare list --> + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrl" value="$product.custom_attributes[url_key]$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="addProductToCompare"> + <argument name="productVar" value="$product$"/> + </actionGroup> + <!--Try to add simple product to shopping cart from compare products page.--> + <actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="checkProductInComparisonList"> + <argument name="productVar" value="$product$"/> + </actionGroup> + <actionGroup ref="StorefrontAddSimpleProductToCartFromComparisonListActionGroup" stepKey="addProductToCartFromComparisonList"> + <argument name="productName" value="$product.name$"/> + </actionGroup> + <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="verifyCartRedirectAfterAddingProductFromComparisonList"/> + </test> +</tests>