Skip to content
Snippets Groups Projects
Commit 262ba0ee authored by Dmytro Aponasenko's avatar Dmytro Aponasenko
Browse files

Merge branch 'MTA-2483' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop

parents 9e369267 5b81c100
No related merge requests found
...@@ -7,30 +7,32 @@ ...@@ -7,30 +7,32 @@
namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit; namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit;
use Magento\Backend\Test\Block\Widget\FormTabs; use Magento\Backend\Test\Block\Widget\FormTabs;
use Magento\Mtf\Client\Element\SimpleElement;
use Magento\Mtf\Client\Locator;
use Magento\Mtf\Factory\Factory; use Magento\Mtf\Factory\Factory;
use Magento\Mtf\Fixture\FixtureInterface;
/** /**
* Class CategoryForm * Category container block.
* Category container block
*/ */
class CategoryForm extends FormTabs class CategoryForm extends FormTabs
{ {
/** /**
* Save button * Default sore switcher block locator.
* *
* @var string * @var string
*/ */
protected $saveButton = '[data-ui-id=category-edit-form-save-button]'; protected $storeSwitcherBlock = '.store-switcher';
/** /**
* Category Products grid * Dropdown block locator.
* *
* @var string * @var string
*/ */
protected $productsGridBlock = '#catalog_category_products'; protected $dropdownBlock = '.dropdown';
/** /**
* Get Category edit form * Get Category edit form.
* *
* @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tab\ProductGrid * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tab\ProductGrid
*/ */
...@@ -40,4 +42,25 @@ class CategoryForm extends FormTabs ...@@ -40,4 +42,25 @@ class CategoryForm extends FormTabs
$this->_rootElement->find($this->productsGridBlock) $this->_rootElement->find($this->productsGridBlock)
); );
} }
/**
* Fill form with tabs.
*
* @param FixtureInterface $fixture
* @param SimpleElement|null $element
* @return FormTabs
*/
public function fill(FixtureInterface $fixture, SimpleElement $element = null)
{
$tabs = $this->getFieldsByTabs($fixture);
if ($fixture->hasData('store_id')) {
$store = $fixture->getStoreId();
$storeSwitcherBlock = $this->browser->find($this->storeSwitcherBlock);
$storeSwitcherBlock->find($this->dropdownBlock, Locator::SELECTOR_CSS, 'liselectstore')->setValue($store);
$this->browser->acceptAlert();
}
return $this->fillTabs($tabs, $element);
}
} }
...@@ -9,8 +9,7 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit; ...@@ -9,8 +9,7 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit;
use Magento\Backend\Test\Block\FormPageActions; use Magento\Backend\Test\Block\FormPageActions;
/** /**
* Class PageActions * Category page actions.
* Category page actions
*/ */
class PageActions extends FormPageActions class PageActions extends FormPageActions
{ {
......
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Test\Constraint;
use Magento\Catalog\Test\Fixture\Category;
use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
use Magento\Mtf\Client\BrowserInterface;
use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Cms\Test\Page\CmsIndex;
/**
* Assert that category name is different on different store view.
*/
class AssertCategoryWithCustomStoreOnFrontend extends AbstractConstraint
{
/**
* Assert that category name is different on different store view.
*
* @param BrowserInterface $browser
* @param CatalogCategoryView $categoryView
* @param Category $category
* @param Category $initialCategory
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(
BrowserInterface $browser,
CatalogCategoryView $categoryView,
Category $category,
Category $initialCategory,
CmsIndex $cmsIndex
) {
$cmsIndex->open();
$cmsIndex->getLinksBlock()->waitWelcomeMessage();
$browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals(
$initialCategory->getName(),
$categoryView->getTitleBlock()->getTitle(),
'Wrong category name is displayed for default store.'
);
$store = $category->getDataFieldConfig('store_id')['source']->store->getName();
$cmsIndex->getStoreSwitcherBlock()->selectStoreView($store);
$cmsIndex->getLinksBlock()->waitWelcomeMessage();
$browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals(
$category->getName(),
$categoryView->getTitleBlock()->getTitle(),
'Wrong category name is displayed for ' . $store
);
}
/**
* Returns a string representation of the object.
*
* @return string
*/
public function toString()
{
return 'Category name is different on different store view.';
}
}
...@@ -41,5 +41,6 @@ ...@@ -41,5 +41,6 @@
<field name="landing_page" group="display_setting" source="Magento\Catalog\Test\Fixture\Category\LandingPage" /> <field name="landing_page" group="display_setting" source="Magento\Catalog\Test\Fixture\Category\LandingPage" />
<field name="display_mode" group="display_setting" /> <field name="display_mode" group="display_setting" />
<field name="category_products" group="category_products" source="Magento\Catalog\Test\Fixture\Category\CategoryProducts" /> <field name="category_products" group="category_products" source="Magento\Catalog\Test\Fixture\Category\CategoryProducts" />
<field name="store_id" group="null" source="Magento\Catalog\Test\Fixture\Category\StoreId" />
</fixture> </fixture>
</config> </config>
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Test\Fixture\Category;
use Magento\Mtf\Fixture\DataSource;
use Magento\Mtf\Fixture\FixtureFactory;
use Magento\Store\Test\Fixture\Store;
use Magento\Store\Test\Fixture\StoreGroup;
/**
* Category store id scope.
*/
class StoreId extends DataSource
{
/**
* Store fixture.
*
* @var Store
*/
public $store;
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (isset($data['dataset'])) {
$store = $fixtureFactory->createByCode('store', $data);
/** @var Store $store */
if (!$store->getStoreId()) {
$store->persist();
}
$this->store = $store;
$this->data = $store->getGroupId() . '/' . $store->getName();
} else {
$this->data = $data;
}
}
/**
* Return Store fixture.
*
* @return Store
*/
public function getStore()
{
return $this->store;
}
}
...@@ -46,5 +46,11 @@ ...@@ -46,5 +46,11 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" />
</variation> </variation>
<variation name="UpdateCategoryEntityTestVariation4" summary="Update Category with custom Store View.">
<data name="category/data/store_id/dataset" xsi:type="string">custom</data>
<data name="category/data/name" xsi:type="string">Category %isolation%</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend" />
</variation>
</testCase> </testCase>
</config> </config>
...@@ -151,4 +151,9 @@ ...@@ -151,4 +151,9 @@
<argument name="severity" xsi:type="string">high</argument> <argument name="severity" xsi:type="string">high</argument>
</arguments> </arguments>
</type> </type>
<type name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend">
<arguments>
<argument name="severity" xsi:type="string">low</argument>
</arguments>
</type>
</config> </config>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment