Skip to content

Commit

Permalink
Merge remote-tracking branches 'origin/MAGETWO-65484' and 'origin/MAG…
Browse files Browse the repository at this point in the history
…ETWO-65203' into pr-2.1.6
  • Loading branch information
Sergey Shvets committed Mar 9, 2017
3 parents f97c312 + 67b5ff7 + 147b0cd commit 1631c41
Show file tree
Hide file tree
Showing 102 changed files with 371 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,29 @@
*/
namespace Magento\Eav\Model\Entity\Attribute\Frontend;

use Magento\Framework\App\CacheInterface;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Eav\Model\Cache\Type as CacheType;
use Magento\Eav\Model\Entity\Attribute;

abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\Frontend\FrontendInterface
{
/**
* @var CacheInterface
*/
private $cache;

/**
* @var StoreResolverInterface
*/
private $storeResolver;

/**
* @var array
*/
private $cacheTags;

/**
* Reference to the attribute instance
*
Expand All @@ -27,11 +48,24 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F

/**
* @param \Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory $attrBooleanFactory
* @param CacheInterface $cache
* @param StoreResolverInterface $storeResolver
* @param array $cacheTags
* @codeCoverageIgnore
*/
public function __construct(\Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory $attrBooleanFactory)
{
public function __construct(
\Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory $attrBooleanFactory,
CacheInterface $cache = null,
StoreResolverInterface $storeResolver = null,
array $cacheTags = [
CacheType::CACHE_TAG,
Attribute::CACHE_TAG,
]
) {
$this->_attrBooleanFactory = $attrBooleanFactory;
$this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class);
$this->storeResolver = $storeResolver ?: ObjectManager::getInstance()->get(StoreResolverInterface::class);
$this->cacheTags = $cacheTags;
}

/**
Expand Down Expand Up @@ -216,7 +250,21 @@ public function getConfigField($fieldName)
*/
public function getSelectOptions()
{
return $this->getAttribute()->getSource()->getAllOptions();
$cacheKey = 'attribute-navigation-option-' .
$this->getAttribute()->getAttributeCode() . '-' .
$this->storeResolver->getCurrentStoreId();
$optionString = $this->cache->load($cacheKey);
if (false === $optionString) {
$options = $this->getAttribute()->getSource()->getAllOptions();
$this->cache->save(
json_encode($options),
$cacheKey,
$this->cacheTags
);
} else {
$options = json_decode($optionString, true);
}
return $options;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Mtf\Client\Element;

use Magento\Mtf\Client\Locator;

/**
* Class provides ability to work with page element radio button.
*/
class RadiobuttonElement extends SimpleElement
{
/**
* Label for radio button selector.
*
* @var string
*/
protected $labelSelector = './..//label[contains(., "%s")]';

/**
* Selector for selected label.
*
* @var string
*/
protected $selectedLabelSelector = 'input[type=radio]:checked + label';

/**
* Get value of the required element.
*
* @return string
*/
public function getValue()
{
$this->eventManager->dispatchEvent(['get_value'], [$this->getAbsoluteSelector()]);
return $this->find($this->selectedLabelSelector)->getText();
}

/**
* Select radio button based on label value.
*
* @param string $value
* @return void
*/
public function setValue($value)
{
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
$radioButtonLabel = $this->find(sprintf($this->labelSelector, $value), Locator::SELECTOR_XPATH);
if (!$this->isSelected()) {
$radioButtonLabel->click();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<item name="isClosed" xsi:type="string">No</item>
<item name="transactionType" xsi:type="string">Authorization</item>
</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test severity:S0</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
<constraint name="Magento\Checkout\Test\Constraint\AssertMinicartEmpty" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,31 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Backend\Test\TestCase\GlobalSearchEntityTest" summary="Global Search Backend " ticketId="MAGETWO-28457">
<variation name="GlobalSearchEntityTestVariation1">
<data name="tag" xsi:type="string">stable:no</data>
<data name="description" xsi:type="string">search shows admin preview</data>
<data name="search/data/query" xsi:type="string">Some search term</data>
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchPreview" />
</variation>
<variation name="GlobalSearchEntityTestVariation2">
<data name="tag" xsi:type="string">stable:no</data>
<data name="description" xsi:type="string">search with 2 sign return no results</data>
<data name="search/data/query" xsi:type="string">:)</data>
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchNoRecordsFound" />
</variation>
<variation name="GlobalSearchEntityTestVariation3">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="description" xsi:type="string">search product by sku</data>
<data name="search/data/query" xsi:type="string">orderInjectable::default::product::sku</data>
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchProductName" />
</variation>
<variation name="GlobalSearchEntityTestVariation4">
<data name="tag" xsi:type="string">stable:no</data>
<data name="description" xsi:type="string">search existed customer</data>
<data name="search/data/query" xsi:type="string">customer::johndoe_unique::lastname</data>
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchCustomerName" />
</variation>
<variation name="GlobalSearchEntityTestVariation5">
<data name="tag" xsi:type="string">stable:no</data>
<data name="description" xsi:type="string">search order (by order id)</data>
<data name="search/data/query" xsi:type="string">orderInjectable::default::id</data>
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchOrderId" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" />
</variation>
<variation name="CreateBundleProductEntityTestVariation5">
<data name="tag" xsi:type="string">stable:no</data>
<data name="description" xsi:type="string">Create fixed bundle with all types options</data>
<data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data>
Expand Down Expand Up @@ -187,6 +188,7 @@
<constraint name="Magento\Bundle\Test\Constraint\AssertTierPriceOnBundleProductPage" />
</variation>
<variation name="CreateBundleProductEntityTestVariation8">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="description" xsi:type="string">Create dynamic bundle with special price</data>
<data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data>
Expand Down Expand Up @@ -236,6 +238,7 @@
<constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" />
</variation>
<variation name="CreateBundleProductEntityTestVariation11">
<data name="issue" xsi:type="string">MAGETWO-60789: API wrong custom attributes order</data>
<data name="description" xsi:type="string">Create fixed product with checkout first option</data>
<data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Catalog\Test\TestCase\Product\DeleteProductEntityTest">
<variation name="DeleteProductEntityTestVariation4">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data>
<data name="isRequired" xsi:type="string">Yes</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSuccessDeleteMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductNotInGrid" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend" />
</variation>
<variation name="DeleteProductEntityTestVariation5">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data>
<data name="isRequired" xsi:type="string">No</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSuccessDeleteMessage" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\DeleteProductFromMiniShoppingCartTest" summary="Delete Bundle Product from Mini Shopping Cart" ticketId="MAGETWO-29104">
<variation name="DeleteBundleProductFromMiniShoppingCartTestVariation">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="products" xsi:type="string">bundleProduct::default</data>
<data name="deletedProductIndex" xsi:type="string">0</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ class ProductGrid extends Grid
*
* @var string
*/
protected $selectItem = 'tbody tr .col-in_category';
protected $selectItem = 'tbody tr .col-in_category input';
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" />
</variation>
<variation name="CreateCategoryEntityTestVariation2_RootCategory_AllFields">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="description" xsi:type="string">Create root category with all fields</data>
<data name="addCategory" xsi:type="string">addRootCategory</data>
<data name="category/data/is_active" xsi:type="string">Yes</data>
Expand Down Expand Up @@ -56,6 +57,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" />
</variation>
<variation name="CreateCategoryEntityTestVariation4_Subcategory_AllFields">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="description" xsi:type="string">Create not anchor subcategory specifying all fields</data>
<data name="addCategory" xsi:type="string">addSubcategory</data>
<data name="category/data/parent_id/dataset" xsi:type="string">default_category</data>
Expand Down Expand Up @@ -90,6 +92,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts" />
</variation>
<variation name="CreateCategoryEntityTestVariation5_Anchor_MostOfFields">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="description" xsi:type="string">Create anchor subcategory with all fields</data>
<data name="addCategory" xsi:type="string">addSubcategory</data>
<data name="category/data/parent_id/dataset" xsi:type="string">default_category</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" />
</variation>
<variation name="UpdateCategoryEntityTestVariation2_SortProductsBy_DefaultProductSorting_AddProduct">
<data name="tag" xsi:type="string">to_maintain:yes</data>
<data name="category/data/parent_id/dataset" xsi:type="string">default_category</data>
<data name="category/data/available_product_listing_config" xsi:type="string">Yes</data>
<data name="category/data/default_product_listing_config" xsi:type="string">No</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Catalog\Test\TestCase\Product\AddCompareProductsTest" summary="Add Products to Compare" ticketId="MAGETWO-25843">
<variation name="AddCompareProductsTestVariation1">
<data name="tag" xsi:type="string">stable:no</data>
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products</data>
<data name="isCustomerLoggedIn" xsi:type="string">No</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductComparePage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareBlockOnCmsPage" />
</variation>
<variation name="AddCompareProductsTestVariation2">
<data name="tag" xsi:type="string">stable:no</data>
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,bundleProduct::bundle_dynamic_product</data>
<data name="isCustomerLoggedIn" xsi:type="string">No</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
Expand All @@ -28,6 +30,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareBlockOnCmsPage" />
</variation>
<variation name="AddCompareProductsTestVariation4">
<data name="tag" xsi:type="string">stable:no</data>
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::configurable_with_qty_1,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
<data name="isCustomerLoggedIn" xsi:type="string">Yes</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Catalog\Test\TestCase\Product\ClearAllCompareProductsTest" summary="Clear All Compare Products" ticketId="MAGETWO-25961">
<variation name="ClearAllCompareProductsTestVariation1">
<data name="tag" xsi:type="string">stable:no</data>
<data name="config/dataset" xsi:type="string">compare_products</data>
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareSuccessRemoveAllProductsMessage" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" />
</variation>
<variation name="CreateSimpleProductEntityTestVariation18">
<data name="issue" xsi:type="string">MAGETWO-60789: API wrong custom attributes order</data>
<data name="description" xsi:type="string">Create product wit suite of custom options</data>
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
Expand Down Expand Up @@ -394,6 +395,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertAddToCartButtonAbsent" />
</variation>
<variation name="CreateSimpleProductEntityTestVariation23" summary="Create Simple Product with Creating New Category (Required Fields Only)" ticketId="MAGETWO-13345">
<data name="tag" xsi:type="string">stable:no</data>
<data name="product/data/category_ids/new_category" xsi:type="string">yes</data>
<data name="product/data/category_ids/dataset" xsi:type="string">default_subcategory</data>
<data name="product/data/url_key" xsi:type="string">simple%isolation%</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" />
</variation>
<variation name="CreateVirtualProductEntityTestVariation2" summary="Create product with tier price">
<data name="tag" xsi:type="string">test_type:extended_acceptance_test</data>
<data name="tag" xsi:type="string">test_type:extended_acceptance_test, stable:no</data>
<data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data>
<data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data>
Expand Down Expand Up @@ -71,6 +71,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPageWithCustomer" />
</variation>
<variation name="CreateVirtualProductEntityTestVariation5">
<data name="issue" xsi:type="string">MAGETWO-60789: API wrong custom attributes order</data>
<data name="description" xsi:type="string">Create product with custom options suite and import options</data>
<data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data>
<data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data>
Expand Down
Loading

0 comments on commit 1631c41

Please sign in to comment.