Skip to content

Commit

Permalink
Merge pull request #5544 from magento-tsg-csl3/2.4-develop-pr21
Browse files Browse the repository at this point in the history
[TSG-CSL3] For 2.4 (pr21)
  • Loading branch information
zakdma committed Apr 9, 2020
2 parents 42e615f + c0ddaff commit c9a246a
Show file tree
Hide file tree
Showing 50 changed files with 1,092 additions and 319 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,9 @@ public function addAttributeToSort($attribute, $dir = self::SORT_ORDER_ASC)
if ($attribute == 'price' && $storeId != 0) {
$this->addPriceData();
if ($this->_productLimitationFilters->isUsingPriceIndex()) {
$this->getSelect()->order("price_index.min_price {$dir}");
$this->getSelect()->order(
new \Zend_Db_Expr("price_index.min_price = 0, price_index.min_price {$dir}")
);
return $this;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<!-- Check the product not exist in recently compared widget -->
<actionGroup name="StorefrontAssertNotExistProductInRecentlyComparedWidgetActionGroup">
<annotations>
<description>Validate that the provided Product does not appear in the Recently Compared Products widget.</description>
</annotations>
<arguments>
<argument name="product"/>
</arguments>

<waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" stepKey="waitLoadingRecentlyComparedProductsGrid"/>
<dontSee selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="{{product.name}}" stepKey="dontSeeProductInRecentlyComparedWidget"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?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="StoreFrontRecentlyComparedAtWebsiteLevelTest">
<annotations>
<stories value="Recently Compared Product"/>
<title value="Recently Compared Product at website level"/>
<description value="Recently Compared Products widget appears on a page immediately after adding product to compare"/>
<useCaseId value="MC-32763"/>
<testCaseId value="MC-33099"/>
<severity value="MAJOR"/>
<group value="catalog"/>
<group value="widget"/>
</annotations>
<before>
<!--Create Simple Products and Category -->
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct" stepKey="createSimpleProductToCompareFirst">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="SimpleProduct" stepKey="createSimpleProductToCompareSecond">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="SimpleProduct" stepKey="createSimpleProductNotVisibleFirst">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="SimpleProduct" stepKey="createSimpleProductNotVisibleSecond">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<!-- Create product widget -->
<actionGroup ref="AdminCreateRecentlyProductsWidgetActionGroup" stepKey="createRecentlyComparedProductsWidget">
<argument name="widget" value="RecentlyComparedProductsWidget"/>
</actionGroup>
<!-- Set Stores > Configurations > Catalog > Recently Viewed/Compared Products > Show for Current = Website -->
<magentoCLI command="config:set {{RecentlyViewedProductScopeWebsite.path}} {{RecentlyViewedProductScopeWebsite.value}}" stepKey="RecentlyViewedProductScopeWebsiteGroup"/>
</before>
<after>
<!-- Customer Logout -->
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFromCustomer"/>
<!-- Delete product widget -->
<actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteRecentlyComparedProductsWidget">
<argument name="widget" value="RecentlyComparedProductsWidget"/>
</actionGroup>
<!-- Logout Admin -->
<actionGroup ref="logout" stepKey="logout"/>
<!-- Reset Stores > Configurations > Catalog > Recently Viewed/Compared Products > Show for Current = Website-->
<magentoCLI command="config:set {{RecentlyViewedProductScopeWebsite.path}} {{RecentlyViewedProductScopeWebsite.value}}" stepKey="RecentlyViewedProductScopeWebsite"/>
<!-- Delete Products and Category -->
<deleteData createDataKey="createSimpleProductToCompareFirst" stepKey="deleteSimpleProductToCompareFirst"/>
<deleteData createDataKey="createSimpleProductToCompareSecond" stepKey="deleteSimpleProductToCompareSecond"/>
<deleteData createDataKey="createSimpleProductNotVisibleFirst" stepKey="deleteSimpleProductNotVisibleFirst"/>
<deleteData createDataKey="createSimpleProductNotVisibleSecond" stepKey="deleteSimpleProductNotVisibleSecond"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
</after>
<!--Login to storefront from customer-->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>
<see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="checkWelcomeMessage"/>
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="openCategoryPageAfterAddedProductToCart"/>
<!--Add to compare Simple Product and Simple Product 2-->
<actionGroup ref="StorefrontAddCategoryProductToCompareActionGroup" stepKey="addSimpleProduct1ToCompare" >
<argument name="productVar" value="$$createSimpleProductToCompareFirst$$"/>
</actionGroup>
<actionGroup ref="StorefrontAddCategoryProductToCompareActionGroup" stepKey="addSimpleProduct2ToCompare" >
<argument name="productVar" value="$$createSimpleProductToCompareSecond$$"/>
</actionGroup>
<!--The Compare Products widget displays Simple Product 1 and Simple Product 2-->
<actionGroup ref="StorefrontCheckCompareSidebarProductActionGroup" stepKey="checkSimpleProduct1InCompareSidebar">
<argument name="productVar" value="$$createSimpleProductToCompareFirst$$"/>
</actionGroup>
<actionGroup ref="StorefrontCheckCompareSidebarProductActionGroup" stepKey="checkSimpleProduct2InCompareSidebar">
<argument name="productVar" value="$$createSimpleProductToCompareSecond$$"/>
</actionGroup>

<!--Click Clear all in the Compare Products widget-->
<actionGroup ref="StorefrontClearCompareActionGroup" stepKey="clearCompareList"/>
<!--The Recently Compared widget displays Simple Product 1 and Simple Product 2-->
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="openCategoryPageToCheckProductsInRecentlyComparedSidebar"/>
<actionGroup ref="StorefrontAssertProductInRecentlyComparedWidgetActionGroup" stepKey="checkSimpleProduct1ExistInRecentlyComparedWidget">
<argument name="product" value="$$createSimpleProductToCompareFirst$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductInRecentlyComparedWidgetActionGroup" stepKey="checkSimpleProduct2ExistInRecentlyComparedWidget">
<argument name="product" value="$$createSimpleProductToCompareSecond$$"/>
</actionGroup>
<!--The Recently Compared widget not displays Simple Product 3 and Simple Product 4-->
<actionGroup ref="StorefrontAssertNotExistProductInRecentlyComparedWidgetActionGroup" stepKey="checkSimpleProduct3NotExistInRecentlyComparedWidget">
<argument name="product" value="$$createSimpleProductNotVisibleFirst$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertNotExistProductInRecentlyComparedWidgetActionGroup" stepKey="checkSimpleProduct4NotExistInRecentlyComparedWidget">
<argument name="product" value="$$createSimpleProductNotVisibleSecond$$"/>
</actionGroup>
<amOnPage url="customer/account/logout/" stepKey="logoutCustomer"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad2"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,27 @@ define([
*/
dataFilter: function (data) {
var providerData = this.idsStorage.prepareData(customerData.get(this.identifiersConfig.provider)().items),
result = {};
result = {},
productCurrentScope,
scopeId;

_.each(data, function (value, key) {
if (!providerData[key]) {
result[key] = value;
}
});
if (typeof this.data.productCurrentScope !== 'undefined') {
productCurrentScope = this.data.productCurrentScope;
scopeId = productCurrentScope === 'store' ? window.checkout.storeId :
productCurrentScope === 'group' ? window.checkout.storeGroupId :
window.checkout.websiteId;
_.each(data, function (value, key) {
if (!providerData[productCurrentScope + '-' + scopeId + '-' + key]) {
result[key] = value;
}
});
} else {
_.each(data, function (value, key) {
if (!providerData[key]) {
result[key] = value;
}
});
}

return result;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
namespace Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Image;

use Magento\Catalog\Model\View\Asset\PlaceholderFactory;
use Magento\Framework\App\Area;
use Magento\Framework\View\Asset\Repository as AssetRepository;
use Magento\Framework\View\DesignInterface;

/**
* Image Placeholder provider
Expand All @@ -25,16 +27,24 @@ class Placeholder
*/
private $assetRepository;

/**
* @var DesignInterface
*/
private $themeDesign;

/**
* @param PlaceholderFactory $placeholderFactory
* @param AssetRepository $assetRepository
* @param DesignInterface $themeDesign
*/
public function __construct(
PlaceholderFactory $placeholderFactory,
AssetRepository $assetRepository
AssetRepository $assetRepository,
DesignInterface $themeDesign
) {
$this->placeholderFactory = $placeholderFactory;
$this->assetRepository = $assetRepository;
$this->themeDesign = $themeDesign;
}

/**
Expand All @@ -52,8 +62,14 @@ public function getPlaceholder(string $imageType): string
return $imageAsset->getUrl();
}

return $this->assetRepository->getUrl(
"Magento_Catalog::images/product/placeholder/{$imageType}.jpg"
$params = [
'area' => Area::AREA_FRONTEND,
'themeId' => $this->themeDesign->getConfigurationDesignTheme(Area::AREA_FRONTEND),
];

return $this->assetRepository->getUrlWithParams(
"Magento_Catalog::images/product/placeholder/{$imageType}.jpg",
$params
);
}
}

This file was deleted.

Loading

0 comments on commit c9a246a

Please sign in to comment.