diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php
index 8801681596585..c3e5f20071394 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php
@@ -59,7 +59,16 @@ public function execute()
if ($storeId) {
$categoryId = (int)$this->storeManager->getStore($storeId)->getRootCategoryId();
} else {
- $categoryId = (int)$this->storeManager->getDefaultStoreView()->getRootCategoryId();
+ $defaultStoreView = $this->storeManager->getDefaultStoreView();
+ if ($defaultStoreView) {
+ $categoryId = (int)$defaultStoreView->getRootCategoryId();
+ } else {
+ $stores = $this->storeManager->getStores();
+ if (count($stores)) {
+ $store = reset($stores);
+ $categoryId = (int)$store->getRootCategoryId();
+ }
+ }
}
$this->getRequest()->setParam('id', $categoryId);
}
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php
index d50cdd9bbef3a..1c79bd728bfd1 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php
@@ -14,6 +14,13 @@
*/
class Template extends Block
{
+ /**
+ * Magento new loader.
+ *
+ * @var string
+ */
+ protected $spinner = '[data-role="spinner"]';
+
/**
* Magento loader.
*
@@ -35,6 +42,7 @@ class Template extends Block
*/
public function waitLoader()
{
+ $this->waitForElementNotVisible($this->spinner);
$this->waitForElementNotVisible($this->loader);
$this->waitForElementNotVisible($this->loaderOld);
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml
index 496f9e1a36b18..bd592ab930752 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml
@@ -101,9 +101,46 @@
//div[contains(@class,'admin__collapsible-block-wrapper')][descendant::div[@id='catalog_category_products']]
xpath
-
+
+ \Magento\Ui\Test\Block\Adminhtml\Section
+ //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::select[@name='page_layout']]
+ xpath
+
+
+ checkbox
+ input[name='custom_use_parent_settings']
+
+
+ select
+ select[name='page_layout']
+
+
+ textarea
+ textarea[name='custom_layout_update']
+
+
+ checkbox
+ input[name='custom_apply_to_products']
+
+
+
+
\Magento\Ui\Test\Block\Adminhtml\Section
//div[contains(@class,'admin__collapsible-block-wrapper')][descendant::input[@name='custom_design_to']]
xpath
-
+
+
+ text
+ input[name='custom_design_from']
+
+
+ text
+ input[name='custom_design_to']
+
+
+ select
+ select[name='custom_design']
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php
index 35662e78d52a2..4217ce5ceb67a 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php
@@ -53,6 +53,13 @@ class Tree extends Block
*/
protected $treeElement = '.tree-holder';
+ /**
+ * Page header selector.
+ *
+ * @var string
+ */
+ protected $header = 'header';
+
/**
* Get backend abstract block.
*
@@ -73,6 +80,7 @@ protected function getTemplateBlock()
*/
public function addSubcategory()
{
+ $this->browser->find($this->header)->hover();
$this->_rootElement->find($this->addSubcategory, Locator::SELECTOR_CSS)->click();
$this->getTemplateBlock()->waitLoader();
}
@@ -84,6 +92,7 @@ public function addSubcategory()
*/
public function addRootCategory()
{
+ $this->browser->find($this->header)->hover();
$this->_rootElement->find($this->addRootCategory, Locator::SELECTOR_CSS)->click();
$this->getTemplateBlock()->waitLoader();
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForm.php
index 2f17bd3a740a1..20fd06286245c 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForm.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForm.php
@@ -26,7 +26,8 @@ class AssertCategoryForm extends AbstractAssertForm
* @var array
*/
protected $skippedFixtureFields = [
- 'parent_id'
+ 'parent_id',
+ 'id'
];
/**
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotActive.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotActive.php
index ca07fb741585d..046897e7f3934 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotActive.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotActive.php
@@ -6,42 +6,68 @@
namespace Magento\Catalog\Test\Constraint;
+use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Catalog\Test\Fixture\Category;
-use Magento\Cms\Test\Page\CmsIndex;
+use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
use Magento\Mtf\Client\BrowserInterface;
-use Magento\Mtf\Constraint\AbstractConstraint;
/**
* Class AssertCategoryIsNotActive
- * Assert that the category cannot be accessed from the navigation bar in the frontend
+ * Assert that the category cannot be accessed using the direct URL and from the navigation bar in the frontend
*/
class AssertCategoryIsNotActive extends AbstractConstraint
{
const NOT_FOUND_MESSAGE = 'Whoops, our bad...';
/**
- * Assert that the category cannot be accessed from the navigation bar in the frontend
+ * Assert that the category cannot be accessed using the direct URL and from the navigation bar in the frontend
*
- * @param CmsIndex $cmsIndex
* @param Category $category
+ * @param CatalogCategoryView $categoryView
* @param BrowserInterface $browser
* @return void
*/
- public function processAssert(CmsIndex $cmsIndex, Category $category, BrowserInterface $browser)
- {
- $cmsIndex->open();
+ public function processAssert(
+ Category $category,
+ CatalogCategoryView $categoryView,
+ BrowserInterface $browser
+ ) {
+ $browser->open($this->getCategoryUrl($category));
\PHPUnit_Framework_Assert::assertFalse(
- $cmsIndex->getTopmenu()->isCategoryVisible($category->getName()),
+ $categoryView->getTopmenu()->isCategoryVisible($category->getName()),
'Category can be accessed from the navigation bar in the frontend.'
);
- $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals(
self::NOT_FOUND_MESSAGE,
- $cmsIndex->getTitleBlock()->getTitle(),
+ $categoryView->getTitleBlock()->getTitle(),
'Wrong page is displayed.'
);
}
+ /**
+ * Get category url to open.
+ *
+ * @param Category $category
+ * @return string
+ */
+ protected function getCategoryUrl(Category $category)
+ {
+ $categoryUrlKey = [];
+ while ($category) {
+ $categoryUrlKey[] = $category->hasData('url_key')
+ ? strtolower($category->getUrlKey())
+ : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
+
+ $category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory();
+ if (1 == $category->getParentId()) {
+ $category = null;
+ }
+ }
+
+ return $_ENV['app_frontend_url'] . implode('/', array_reverse($categoryUrlKey)) . '.html';
+ }
+
+
/**
* Category not find in top menu
*
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php
deleted file mode 100644
index d580889a348aa..0000000000000
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php
+++ /dev/null
@@ -1,68 +0,0 @@
-open();
- \PHPUnit_Framework_Assert::assertFalse(
- $cmsIndex->getTopmenu()->isCategoryVisible($category->getName()),
- 'Category can be accessed from the navigation bar in the frontend.'
- );
-
- $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
- \PHPUnit_Framework_Assert::assertEquals(
- $category->getName(),
- $categoryView->getTitleBlock()->getTitle(),
- 'Wrong page is displayed.'
- );
- if (isset($category->getDataFieldConfig('category_products')['source'])) {
- $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
- foreach ($products as $productFixture) {
- \PHPUnit_Framework_Assert::assertTrue(
- $categoryView->getListProductBlock()->getProductItem($productFixture)->isVisible(),
- "Products '{$productFixture->getName()}' not find."
- );
- }
- }
- }
-
- /**
- * Category is no longer available on the top menu bar, but can be viewed by URL with all assigned products
- *
- * @return string
- */
- public function toString()
- {
- return 'Category is not on the top menu bar, but can be viewed by URL.';
- }
-}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php
index 992fdc6c76702..45b3ec57b91e9 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php
@@ -11,10 +11,10 @@
use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
use Magento\Mtf\Client\BrowserInterface;
use Magento\Mtf\Constraint\AbstractConstraint;
-use Magento\Mtf\Fixture\FixtureFactory;
/**
* Assert that displayed category data on category page equals to passed from fixture.
+ * NOTE: Design settings, Meta Keywords and Meta Description are not verified.
*/
class AssertCategoryPage extends AbstractConstraint
{
@@ -42,55 +42,53 @@ class AssertCategoryPage extends AbstractConstraint
*/
protected $browser;
+ /**
+ * Category to test.
+ *
+ * @var Category
+ */
+ protected $category;
+
/**
* Assert that displayed category data on category page equals to passed from fixture.
*
* @param Category $category
- * @param Category $initialCategory
- * @param FixtureFactory $fixtureFactory
* @param CatalogCategoryView $categoryView
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(
Category $category,
- Category $initialCategory,
- FixtureFactory $fixtureFactory,
CatalogCategoryView $categoryView,
BrowserInterface $browser
) {
$this->browser = $browser;
+ $this->category = $category;
$this->categoryViewPage = $categoryView;
- $categoryData = $this->prepareData($fixtureFactory, $category, $initialCategory);
$this->browser->open($this->getCategoryUrl($category));
- $this->assertGeneralInformation($category, $categoryData);
- $this->assertDisplaySetting($category, $categoryData);
+ $categoryData = $this->prepareFixtureData($category->getData());
+ $diff = $this->verifyGeneralInformation($categoryData);
+ $diff = array_merge($diff, $this->verifyContent($categoryData));
+ $diff = array_merge($diff, $this->verifyDisplaySettings($categoryData));
+ $diff = array_merge($diff, $this->verifySearchEngineOptimization($categoryData));
+ \PHPUnit_Framework_Assert::assertEmpty(
+ $diff,
+ "Category settings on Storefront page are different.\n" . implode(' ', $diff)
+ );
}
/**
- * Prepare comparison data.
+ * Prepares fixture data for comparison.
*
- * @param FixtureFactory $fixtureFactory
- * @param Category $category
- * @param Category $initialCategory
+ * @param array $data
* @return array
*/
- protected function prepareData(FixtureFactory $fixtureFactory, Category $category, Category $initialCategory)
+ protected function prepareFixtureData(array $data)
{
- $product = $fixtureFactory->createByCode(
- 'catalogProductSimple',
- [
- 'dataset' => 'default',
- 'data' => [
- 'category_ids' => [
- 'category' => $initialCategory,
- ],
- ]
- ]
- );
- $product->persist();
-
- return array_merge($initialCategory->getData(), $category->getData());
+ if (isset($data['id'])) {
+ unset($data['id']);
+ }
+ return $data;
}
/**
@@ -108,7 +106,7 @@ protected function getCategoryUrl(Category $category)
: trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
$category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory();
- if (1 == $category->getParentId()) {
+ if ($category !== null && 1 == $category->getParentId()) {
$category = null;
}
}
@@ -117,83 +115,103 @@ protected function getCategoryUrl(Category $category)
}
/**
- * Assert category general information.
+ * Verify category general information:
+ * # Include in menu
+ * # Name
*
- * @param Category $category
* @param array $categoryData
- * @return void
+ * @return array
*/
- protected function assertGeneralInformation(Category $category, array $categoryData)
+ protected function verifyGeneralInformation(array $categoryData)
{
- $categoryUrl = $this->getCategoryUrl($category);
- \PHPUnit_Framework_Assert::assertEquals(
- $categoryUrl,
- $this->browser->getUrl(),
- 'Wrong page URL.'
- . "\nExpected: " . $categoryUrl
- . "\nActual: " . $this->browser->getUrl()
- );
+ $errorMessage = [];
+
+ if (isset($categoryData['include_in_menu']) && $categoryData['include_in_menu'] == 'Yes') {
+ if (!$this->categoryViewPage->getTopmenu()->isCategoryVisible($categoryData['name'])) {
+ $errorMessage[] = 'Category is not visible in the navigation pane.';
+ }
+ }
+ if (isset($categoryData['include_in_menu']) && $categoryData['include_in_menu'] == 'No') {
+ if ($this->categoryViewPage->getTopmenu()->isCategoryVisible($categoryData['name'])) {
+ $errorMessage[] = 'Category is visible in the navigation pane.';
+ }
+ }
if (isset($categoryData['name'])) {
$title = $this->categoryViewPage->getTitleBlock()->getTitle();
- \PHPUnit_Framework_Assert::assertEquals(
- $categoryData['name'],
- $title,
- 'Wrong page title.'
- . "\nExpected: " . $categoryData['name']
- . "\nActual: " . $title
- );
+ if ($categoryData['name'] != $title) {
+ $errorMessage[] = 'Wrong category name.'
+ . "\nExpected: " . $categoryData['name']
+ . "\nActual: " . $title;
+ }
}
- if (isset($categoryData['description'])) {
- $description = $this->categoryViewPage->getViewBlock()->getDescription();
- \PHPUnit_Framework_Assert::assertEquals(
- $categoryData['description'],
- $description,
- 'Wrong category description.'
- . "\nExpected: " . $categoryData['description']
- . "\nActual: " . $description
- );
- }
+ return $errorMessage;
}
/**
- * Assert category display settings.
+ * Verify category Content data:
+ * # Description
+ * # CMS Block content
*
- * @param Category $category
* @param array $categoryData
- * @return void
+ * @return array
*/
- protected function assertDisplaySetting(Category $category, array $categoryData)
+ protected function verifyContent(array $categoryData)
{
+ $errorMessage = [];
+
+ if (isset($categoryData['description'])) {
+ $description = $this->categoryViewPage->getViewBlock()->getDescription();
+ if ($categoryData['description'] != $description) {
+ $errorMessage[] = 'Wrong category description.'
+ . "\nExpected: " . $categoryData['description']
+ . "\nActual: " . $description;
+ }
+ }
+
if (
isset($categoryData['landing_page'])
&& isset($categoryData['display_mode'])
&& in_array($categoryData['display_mode'], $this->visibleCmsBlockMode)
) {
/** @var LandingPage $sourceLandingPage */
- $sourceLandingPage = $category->getDataFieldConfig('landing_page')['source'];
+ $sourceLandingPage = $this->category->getDataFieldConfig('landing_page')['source'];
$fixtureContent = $sourceLandingPage->getCmsBlock()->getContent();
$pageContent = $this->categoryViewPage->getViewBlock()->getContent();
- \PHPUnit_Framework_Assert::assertEquals(
- $fixtureContent,
- $pageContent,
- 'Wrong category landing page content.'
- . "\nExpected: " . $fixtureContent
- . "\nActual: " . $pageContent
- );
+ if ($fixtureContent != $pageContent) {
+ $errorMessage[] = 'Wrong category landing page content.'
+ . "\nExpected: " . $fixtureContent
+ . "\nActual: " . $pageContent;
+ }
}
+
+ return $errorMessage;
+ }
+
+ /**
+ * Verify category Display Settings data:
+ * # default_sort_by
+ * # available_sort_by
+ *
+ * @param array $categoryData
+ * @return array
+ */
+ protected function verifyDisplaySettings(array $categoryData)
+ {
+ $errorMessage = [];
+
+ //TODO: verify display_mode
+
if (isset($categoryData['default_sort_by'])) {
$sortBy = strtolower($categoryData['default_sort_by']);
$sortType = $this->categoryViewPage->getTopToolbar()->getSelectSortType();
- \PHPUnit_Framework_Assert::assertEquals(
- $sortBy,
- $sortType,
- 'Wrong sorting type.'
- . "\nExpected: " . $sortBy
- . "\nActual: " . $sortType
- );
+ if ($sortBy != $sortType) {
+ $errorMessage[] = 'Wrong sorting type.'
+ . "\nExpected: " . $sortBy
+ . "\nActual: " . $sortType;
+ }
}
if (isset($categoryData['available_sort_by'])) {
@@ -204,17 +222,50 @@ function (&$value) {
}
);
if ($availableSortType) {
- $availableSortType = array_values($availableSortType);
- $availableSortTypeOnPage = $this->categoryViewPage->getTopToolbar()->getSortType();
- \PHPUnit_Framework_Assert::assertEquals(
- $availableSortType,
- $availableSortTypeOnPage,
- 'Wrong available sorting type.'
- . "\nExpected: " . implode(PHP_EOL, $availableSortType)
- . "\nActual: " . implode(PHP_EOL, $availableSortTypeOnPage)
- );
+ $expected = array_values($availableSortType);
+ $actual = $this->categoryViewPage->getTopToolbar()->getSortType();
+ if ($expected != $actual) {
+ $errorMessage[] = 'Wrong available sorting type.'
+ . "\nExpected: " . implode(PHP_EOL, $expected)
+ . "\nActual: " . implode(PHP_EOL, $actual);
+ }
}
}
+
+ // TODO: verify Layered Navigation Price Step
+
+ return $errorMessage;
+ }
+
+ /**
+ * Verify category Search Engine Optimization data:
+ * # URL
+ * # Meta Title
+ *
+ * @param array $categoryData
+ * @return array
+ */
+ protected function verifySearchEngineOptimization(array $categoryData)
+ {
+ $errorMessage = [];
+
+ $categoryUrl = $this->getCategoryUrl($this->category);
+ if ($categoryUrl != $this->browser->getUrl()) {
+ $errorMessage[] = 'Wrong page URL.'
+ . "\nExpected: " . $categoryUrl
+ . "\nActual: " . $this->browser->getUrl();
+ };
+
+ if (isset($categoryData['meta_title'])) {
+ $actual = $this->categoryViewPage->getMetaInformation()->getTitle();
+ if ($categoryData['meta_title'] != $actual) {
+ $errorMessage[] = 'Wrong page title.'
+ . "\nExpected: " . $categoryData['meta_title']
+ . "\nActual: " . $actual;
+ };
+ }
+
+ return $errorMessage;
}
/**
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
index 032766276e5f9..07955270401b4 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
@@ -20,6 +20,7 @@
+
@@ -37,11 +38,19 @@
+
+
+
-
-
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/ParentId.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/ParentId.php
index 17a37eef163e4..cad40d5e71fc7 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/ParentId.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/ParentId.php
@@ -37,6 +37,9 @@ public function __construct(FixtureFactory $fixtureFactory, array $params, $data
$this->parentCategory->persist();
}
$this->data = $this->parentCategory->getId();
+ } else if (isset($data['source']) && $data['source'] instanceof Category) {
+ $this->parentCategory = $data['source'];
+ $this->data = $data['source']->getId();
} else {
$this->data = $data;
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
index 730724269f29e..1af5a4a50b1e4 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
@@ -7,6 +7,8 @@
-->
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml
index 24caf82178b02..4ec9224af53f9 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml
@@ -7,79 +7,95 @@
-->
-
- Create root category with required fields
+
+ Create root category with required fields only
addRootCategory
Yes
RootCategory%isolation%
- RootCategory Required
- No
- Position
- Name
- Price
-
+
Create root category with all fields
addRootCategory
Yes
Yes
RootCategory%isolation%
RootCategory All Fields
+ default
Static block and products
- Yes
+ No
No
- Position
- Name
- Price
+ Name
+ Price
No
- Name
+ Price
No
50
- RootCategory Page Title
+ Custom Meta Title %isolation%
+ custom meta keywords %isolation%
+ Custom meta description %isolation%
+ 2 columns with right bar
+ LAYOUT UPDATE XML
+ Yes
+ 01/10/2014
+ 12/31/2024
+ Magento Luma
-
- Create subcategory with required fields
+
addSubcategory
default_category
Yes
+ Yes
Subcategory%isolation%
- Subcategory Required
- Yes
- Subcategory%isolation%
+ test_type:acceptance_test
-
- Create not anchor subcategory with required fields
+
+ Create not anchor subcategory specifying all fields
addSubcategory
default_category
Yes
Yes
Subcategory%isolation%
Subcategory For Anchor Subcategory
+ default
+ Static block and products
No
- Yes
- Yes
- Yes
+ No
+ Name
+ Price
+ No
+ Price
+ No
+ 5
Subcategory%isolation%
+ Custom Meta Title %isolation%
+ custom meta keywords %isolation%
+ Custom meta description %isolation%
catalogProductSimple::default,catalogProductSimple::default
+ 2 columns with right bar
+ LAYOUT UPDATE XML
+ Yes
+ 01/10/2014
+ 12/31/2024
+ Magento Luma
-
+
Create anchor subcategory with all fields
addSubcategory
default_category
Yes
Yes
- Subcategory%isolation%
+ AnchorSubcategory%isolation%
Anchor Subcategory All Fields
default
Static block and products
@@ -89,56 +105,40 @@
Name
Price
No
- Price
+ Name
No
- 50
- Subcategory%isolation%
- Subcategory Page Title
- catalogProductSimple::default,catalogProductSimple::default
+ 5.5
+ AnchorSubcategory%isolation%
+ Anchor Subcategory Page Title
+ catalogProductSimple::default, configurableProduct::default
-
+
Create not active subcategory
addSubcategory
default_category
- Yes
+ No
Yes
- Subcategory%isolation%
- Not active category
- Yes
- Yes
- Yes
- Subcategory%isolation%
+ InactiveSubcategory%isolation%
+
-
+
Create not included in menu subcategory
addSubcategory
default_category
Yes
No
Subcategory%isolation%
- Not included in menu
- Subcategory%isolation%
-
-
-
-
- addSubcategory
- default_category
- Yes
- Yes
- Subcategory%isolation%
- test_type:acceptance_test
-
+
test_type:acceptance_test, test_type:extended_acceptance_test
addSubcategory
default_category
@@ -149,7 +149,7 @@
-
+
test_type:extended_acceptance_test
Create category with three nesting
addSubcategory
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.xml
index 7b256b47e0cd7..5e7941edeb238 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.xml
@@ -7,19 +7,19 @@
-->
-
+
root_category
-
+
root_subcategory
-
+
default_category
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php
index 7b43b0189048d..1577a9692355c 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php
@@ -10,6 +10,7 @@
use Magento\Catalog\Test\Page\Adminhtml\CatalogCategoryEdit;
use Magento\Catalog\Test\Page\Adminhtml\CatalogCategoryIndex;
use Magento\Mtf\TestCase\Injectable;
+use Magento\Mtf\Fixture\FixtureFactory;
/**
* Test Creation for UpdateCategoryEntity
@@ -50,19 +51,29 @@ class UpdateCategoryEntityTest extends Injectable
*/
protected $catalogCategoryEdit;
+ /**
+ * Fixture Factory.
+ *
+ * @var FixtureFactory
+ */
+ protected $fixtureFactory;
+
/**
* Inject page end prepare default category
*
* @param Category $initialCategory
* @param CatalogCategoryIndex $catalogCategoryIndex
* @param CatalogCategoryEdit $catalogCategoryEdit
+ * @param FixtureFactory $fixtureFactory
* @return array
*/
public function __inject(
Category $initialCategory,
CatalogCategoryIndex $catalogCategoryIndex,
- CatalogCategoryEdit $catalogCategoryEdit
+ CatalogCategoryEdit $catalogCategoryEdit,
+ FixtureFactory $fixtureFactory
) {
+ $this->fixtureFactory = $fixtureFactory;
$this->catalogCategoryIndex = $catalogCategoryIndex;
$this->catalogCategoryEdit = $catalogCategoryEdit;
$initialCategory->persist();
@@ -82,5 +93,31 @@ public function test(Category $category, Category $initialCategory)
$this->catalogCategoryIndex->getTreeCategories()->selectCategory($initialCategory);
$this->catalogCategoryEdit->getEditForm()->fill($category);
$this->catalogCategoryEdit->getFormPageActions()->save();
+
+ return ['category' => $this->prepareCategory($category, $initialCategory)];
+ }
+
+ /**
+ * Prepare Category fixture with the updated data.
+ *
+ * @param Category $category
+ * @param Category $initialCategory
+ * @return Category
+ */
+ protected function prepareCategory(Category $category, Category $initialCategory)
+ {
+ $parentCategory = $category->hasData('parent_id')
+ ? $category->getDataFieldConfig('parent_id')['source']->getParentCategory()
+ : $initialCategory->getDataFieldConfig('parent_id')['source']->getParentCategory();
+
+ $data = [
+ 'data' => array_merge(
+ $initialCategory->getData(),
+ $category->getData(),
+ ['parent_id' => ['source' => $parentCategory]]
+ )
+ ];
+
+ return $this->fixtureFactory->createByCode('category', $data);
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
index af091f73864d6..9c953ff93a232 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
@@ -7,46 +7,42 @@
-->
-
+
default_category
- Yes
- Yes
Name%isolation%
- Yes
- No
- Name
+ No
+ Category Description Updated
UrlKey%isolation%
+ Category Title Updated
-
+
default_category
- Yes
- Yes
- Name%isolation%
- Category Description
+ Yes
+ No
+ Name
No
- Position
+ Name
Price
- Yes
- UrlKey%isolation%
- Category Title
+ catalogProductSimple::default
-
+
-
+
default_category
No
Name%isolation%
+
-
+
custom
No
Category %isolation%
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/MetaInformation.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/MetaInformation.php
new file mode 100644
index 0000000000000..218bc268326c9
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/MetaInformation.php
@@ -0,0 +1,33 @@
+browser->getHtmlSource());
+ return (string)$pageContent->head->title;
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml
index 3c025006873c9..78f830f162bcc 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml
@@ -15,7 +15,7 @@
- all_store_views
- Enabled
+ Yes
description_%isolation%
diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php
index 51470d0552462..e9eed9c5a52aa 100644
--- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php
+++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php
@@ -76,9 +76,11 @@ protected function getSectionTitleElement($sectionName)
*/
public function openSection($sectionName)
{
- $this->browser->find($this->header)->hover();
if ($this->isCollapsible($sectionName)) {
$this->getSectionTitleElement($sectionName)->click();
+ } else {
+ //Scroll to the top of the page so that the page actions header does not overlap any controls
+ $this->browser->find($this->header)->hover();
}
return $this;
}
diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php
index ba1bc695a6f32..e3c4ab8d35dac 100644
--- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php
+++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php
@@ -5,6 +5,9 @@
*/
namespace Magento\Framework\Stdlib\DateTime;
+use \Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\Phrase;
+
/**
* Timezone library
*/
@@ -45,6 +48,11 @@ class Timezone implements TimezoneInterface
*/
protected $_scopeConfig;
+ /**
+ * @var \Magento\Framework\Locale\ResolverInterface
+ */
+ protected $_localeResolver;
+
/**
* @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
@@ -275,4 +283,30 @@ public function formatDateTime(
);
return $formatter->format($date);
}
+
+ /**
+ * Convert date from config timezone to Utc.
+ * If pass \DateTime object as argument be sure that timezone is the same with config timezone
+ *
+ * @param string|\DateTimeInterface $date
+ * @param string $format
+ * @throws LocalizedException
+ * @return string
+ */
+ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s')
+ {
+ if (!($date instanceof \DateTime)) {
+ $date = new \DateTime($date, new \DateTimeZone($this->getConfigTimezone()));
+ } else {
+ if ($date->getTimezone()->getName() !== $this->getConfigTimezone()) {
+ throw new LocalizedException(
+ new Phrase('DateTime object timezone must be the same as config - %1', $this->getConfigTimezone())
+ );
+ }
+ }
+
+ $date->setTimezone(new \DateTimeZone('UTC'));
+
+ return $date->format($format);
+ }
}
diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php
index 0ec49eedb748b..d08ac3fa282cb 100644
--- a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php
+++ b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php
@@ -134,4 +134,11 @@ public function formatDateTime(
$timezone = null,
$pattern = null
);
+
+ /**
+ * @param string|\DateTimeInterface $date
+ * @param string $format
+ * @return string
+ */
+ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s');
}