-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4067 from magento-epam/EPAM-PR-51
- fixed MAGETWO-64260: Performance for grouped products with large # of options - fixed MAGETWO-98522: Adding out of stock items to comparison shows the success message but fails - fixed MAGETWO-98584: Google chart API used by Magento dashboard scheduled to be turned off - fixed MAGETWO-98947: UPS CGI url gateway to migrate from http to https
- Loading branch information
Showing
21 changed files
with
658 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="AddOutOfStockProductToCompareListTest"> | ||
<annotations> | ||
<features value="Catalog"/> | ||
<title value="Add out of stock product to compare list"/> | ||
<description value="Add out of stock product to compare list"/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MAGETWO-98644"/> | ||
<useCaseId value="MAGETWO-98522"/> | ||
<group value="Catalog"/> | ||
</annotations> | ||
<before> | ||
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> | ||
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 0" stepKey="displayOutOfStockNo"/> | ||
<magentoCLI command="cache:flush" stepKey="flushCache"/> | ||
<createData entity="SimpleSubCategory" stepKey="category"/> | ||
<createData entity="SimpleProduct4" stepKey="product"> | ||
<requiredEntity createDataKey="category"/> | ||
</createData> | ||
</before> | ||
<after> | ||
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 0" stepKey="displayOutOfStockNo2"/> | ||
<magentoCLI command="cache:flush" stepKey="flushCache"/> | ||
<deleteData createDataKey="product" stepKey="deleteProduct"/> | ||
<deleteData createDataKey="category" stepKey="deleteCategory"/> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
<!--Open product page--> | ||
<comment userInput="Open product page" stepKey="openProdPage"/> | ||
<amOnPage url="{{StorefrontProductPage.url($$product.name$$)}}" stepKey="goToSimpleProductPage"/> | ||
<waitForPageLoad stepKey="waitForSimpleProductPage"/> | ||
<!--'Add to compare' link is not available--> | ||
<comment userInput="'Add to compare' link is not available" stepKey="addToCompareLinkAvailability"/> | ||
<dontSeeElement selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="dontSeeAddToCompareLink"/> | ||
<!--Turn on 'out on stock' config--> | ||
<comment userInput="Turn on 'out of stock' config" stepKey="onOutOfStockConfig"/> | ||
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 1" stepKey="displayOutOfStockYes"/> | ||
<!--Clear cache and reindex--> | ||
<comment userInput="Clear cache and reindex" stepKey="cleanCache"/> | ||
<magentoCLI command="indexer:reindex" stepKey="reindex"/> | ||
<magentoCLI command="cache:flush" stepKey="flushCache"/> | ||
<!--Open product page--> | ||
<comment userInput="Open product page" stepKey="openProductPage"/> | ||
<amOnPage url="{{StorefrontProductPage.url($$product.name$$)}}" stepKey="goToSimpleProductPage2"/> | ||
<waitForPageLoad stepKey="waitForSimpleProductPage2"/> | ||
<!--Click on 'Add to Compare' link--> | ||
<comment userInput="Click on 'Add to Compare' link" stepKey="clickOnAddToCompareLink"/> | ||
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickOnAddToCompare"/> | ||
<waitForPageLoad stepKey="waitForProdAddToCmpList"/> | ||
<!--Assert success message--> | ||
<comment userInput="Assert success message" stepKey="assertSuccessMsg"/> | ||
<grabTextFrom selector="{{AdminProductMessagesSection.successMessage}}" stepKey="grabTextFromSuccessMessage"/> | ||
<assertEquals expected='You added product $$product.name$$ to the comparison list.' expectedType="string" actual="($grabTextFromSuccessMessage)" stepKey="assertSuccessMessage"/> | ||
<!--See product in the comparison list--> | ||
<comment userInput="See product in the comparison list" stepKey="seeProductInComparisonList"/> | ||
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> | ||
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/> | ||
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList"/> | ||
<!--Go to Category page and delete product from comparison list--> | ||
<comment userInput="Go to Category page and delete prduct from comparison list" stepKey="deletProdFromCmpList"/> | ||
<amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="onCategoryPage"/> | ||
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/> | ||
<click selector="{{StorefrontComparisonSidebarSection.ClearAll}}" stepKey="clickClearAll"/> | ||
<waitForPageLoad time="30" stepKey="waitForConfirmPageLoad"/> | ||
<click selector="{{AdminDeleteRoleSection.confirm}}" stepKey="confirmProdDelate"/> | ||
<waitForPageLoad time="30" stepKey="waitForConfirmLoad"/> | ||
<!--Add product to compare list from Category page--> | ||
<comment userInput="Add product to compare list fom Category page" stepKey="addToCmpFromCategPage"/> | ||
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/> | ||
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/> | ||
<waitForPageLoad stepKey="waitProdAddingToCmpList"/> | ||
<!--Assert success message--> | ||
<comment userInput="Assert success message" stepKey="assertSuccessMsg2"/> | ||
<grabTextFrom selector="{{AdminProductMessagesSection.successMessage}}" stepKey="grabTextFromSuccessMessage2"/> | ||
<assertEquals expected='You added product $$product.name$$ to the comparison list.' expectedType="string" actual="($grabTextFromSuccessMessage)" stepKey="assertSuccessMessage2"/> | ||
<!--Check that product displays on add to compare widget--> | ||
<comment userInput="Check that product displays on add to compare widget" stepKey="checkProdNameOnWidget"/> | ||
<seeElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName($$product.name$$)}}" stepKey="seeProdNameOnCmpWidget"/> | ||
<!--See product in the compare page--> | ||
<comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/> | ||
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage2"/> | ||
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad2"/> | ||
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList2"/> | ||
</test> | ||
</tests> |
58 changes: 58 additions & 0 deletions
58
app/code/Magento/Catalog/ViewModel/Product/Checker/AddToCompareAvailability.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\ViewModel\Product\Checker; | ||
|
||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\CatalogInventory\Api\StockConfigurationInterface; | ||
|
||
/** | ||
* Check is available add to compare. | ||
*/ | ||
class AddToCompareAvailability implements ArgumentInterface | ||
{ | ||
/** | ||
* @var StockConfigurationInterface | ||
*/ | ||
private $stockConfiguration; | ||
|
||
/** | ||
* @param StockConfigurationInterface $stockConfiguration | ||
*/ | ||
public function __construct(StockConfigurationInterface $stockConfiguration) | ||
{ | ||
$this->stockConfiguration = $stockConfiguration; | ||
} | ||
|
||
/** | ||
* Is product available for comparison. | ||
* | ||
* @param ProductInterface $product | ||
* @return bool | ||
*/ | ||
public function isAvailableForCompare(ProductInterface $product): bool | ||
{ | ||
return $this->isInStock($product) || $this->stockConfiguration->isShowOutOfStock(); | ||
} | ||
|
||
/** | ||
* Get is in stock status. | ||
* | ||
* @param ProductInterface $product | ||
* @return bool | ||
*/ | ||
private function isInStock(ProductInterface $product): bool | ||
{ | ||
$quantityAndStockStatus = $product->getQuantityAndStockStatus(); | ||
if (!$quantityAndStockStatus) { | ||
return $product->isSalable(); | ||
} | ||
|
||
return isset($quantityAndStockStatus['is_in_stock']) && $quantityAndStockStatus['is_in_stock']; | ||
} | ||
} |
Oops, something went wrong.