diff --git a/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php b/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php new file mode 100644 index 0000000000000..abd0c0b1627fc --- /dev/null +++ b/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php @@ -0,0 +1,62 @@ +data; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } +} diff --git a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..0e5e1e6e6137a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ + + + + + + System > Notifications + Notifications + + + + diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php index 735b24eed10dd..bd99359490b6c 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php @@ -10,24 +10,37 @@ use Magento\Mtf\Client\Locator; /** - * Class Login - * Login form for backend user - * + * Login form for backend user. */ class Login extends Form { /** - * 'Log in' button + * 'Log in' button. * * @var string */ protected $submit = '.action-login'; /** - * Submit login form + * Submit login form. */ public function submit() { $this->_rootElement->find($this->submit, Locator::SELECTOR_CSS)->click(); } + + /** + * Wait for Login form is not visible in the page. + * + * @return void + */ + public function waitFormNotVisible() + { + $form = $this->_rootElement; + $this->browser->waitUntil( + function () use ($form) { + return $form->isVisible() ? null : true; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php index c1a645760bb36..1d683f1ef9034 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php @@ -6,15 +6,43 @@ namespace Magento\Backend\Test\Block; use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; /** - * Class Menu - * Class top menu navigation block + * Top menu navigation block. */ class Menu extends Block { /** - * Returns array of parent menu items present on dashboard menu + * Main menu selector. + * + * @var string + */ + protected $mainMenu = './/li/a[span="%s"]'; + + /** + * Submenu selector. + * + * @var string + */ + protected $subMenu = './/li[a[span="%s"]]/div[@class="submenu" and @style="display: block;"]'; + + /** + * Submenu item selector. + * + * @var string + */ + protected $subMenuItem = './/a[span="%s"]'; + + /** + * Parent menu item. + * + * @var string + */ + protected $parentMenuLevel = 'li.parent.level-0:nth-of-type(%s)'; + + /** + * Returns array of parent menu items present on dashboard menu. * * @return array */ @@ -24,9 +52,9 @@ public function getTopMenuItems() $menuItems = []; $counter = 1; $textSelector = 'a span'; - while ($navigationMenu->find('li.parent.level-0:nth-of-type(' . $counter . ')')->isVisible()) { + while ($navigationMenu->find(sprintf($this->parentMenuLevel, $counter))->isVisible()) { $menuItems[] = strtolower( - $navigationMenu->find('li.parent.level-0:nth-of-type(' . $counter . ')') + $navigationMenu->find(sprintf($this->parentMenuLevel, $counter)) ->find($textSelector) ->getText() ); @@ -34,4 +62,39 @@ public function getTopMenuItems() } return $menuItems; } + + /** + * Open backend page via menu. + * + * @param string $menuItem + * @return void + * @throws \Exception + */ + public function navigate($menuItem) + { + $menuChain = array_map('trim', explode('>', $menuItem)); + $mainMenu = $menuChain[0]; + $subMenu = isset($menuChain[1]) ? $menuChain[1] : null; + + // Click on element in main menu + $mainMenuElement = $this->_rootElement->find(sprintf($this->mainMenu, $mainMenu), Locator::SELECTOR_XPATH); + if (!$mainMenuElement->isVisible()) { + throw new \Exception('Main menu item "' . $mainMenu . '" is not visible.'); + } + $mainMenuElement->click(); + + // Click on element in submenu + if ($subMenu === null) { + return; + } + $subMenuSelector = sprintf($this->subMenu, $mainMenu); + $this->waitForElementVisible($subMenuSelector, Locator::SELECTOR_XPATH); + $subMenuItem = $this->_rootElement->find($subMenuSelector, Locator::SELECTOR_XPATH) + ->find(sprintf($this->subMenuItem, $subMenu), Locator::SELECTOR_XPATH); + if (!$subMenuItem->isVisible()) { + throw new \Exception('Submenu item "' . $subMenu . '" is not visible in "' . $mainMenu . '"'); + } + $subMenuItem->click(); + $this->waitForElementNotVisible($subMenuSelector, Locator::SELECTOR_XPATH); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php new file mode 100644 index 0000000000000..b74ea513d578e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php @@ -0,0 +1,25 @@ +_rootElement->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php index 9de2cdc434983..3971b6e5d5b96 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php @@ -9,7 +9,7 @@ use Magento\Mtf\Block\Block; /** - * Main block. + * Main dashboard block. */ class Main extends Block { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php new file mode 100644 index 0000000000000..0a72723984994 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php @@ -0,0 +1,50 @@ +getTitleBlock()->getTitle(), + 'Invalid page title is displayed.' + ); + \PHPUnit_Framework_Assert::assertNotContains( + self::ERROR_TEXT, + $dashboard->getErrorBlock()->getContent(), + "404 Error is displayed on '$pageTitle' page." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Backend has correct title and 404 page content is absent.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php new file mode 100644 index 0000000000000..754278899b0b4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php @@ -0,0 +1,59 @@ +open(); + $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName()); + $configGroup = $systemConfig->getForm()->getGroup('Locale Options'); + $configGroup->open(); + $configGroup->setValue('select-groups-locale-fields-code-value', $locale); + $systemConfig->getPageActions()->save(); + $systemConfig->getMessagesBlock()->waitSuccessMessage(); + + // Check presents income text on index page + $cmsIndex->open(); + $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName()); + + \PHPUnit_Framework_Assert::assertTrue( + $cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), + "Locale not applied." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store locale has changed successfully.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php index c53ef25e6dc0a..02f5655d35fa0 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php @@ -10,40 +10,39 @@ use Magento\Mtf\Page\Page; /** - * Class AdminAuthLogin - * Login page for backend + * Login page for backend. * */ class AdminAuthLogin extends Page { /** - * URL part for backend authorization + * URL part for backend authorization. */ const MCA = 'admin/auth/login'; /** - * Form for login + * Form for login. * * @var string */ protected $loginBlock = '#login-form'; /** - * Header panel of admin dashboard + * Header panel of admin dashboard. * * @var string */ protected $headerBlock = '.page-header .admin-user'; /** - * Global messages block + * Global messages block. * * @var string */ protected $messagesBlock = '#messages .messages'; /** - * Constructor + * Constructor. */ protected function _init() { @@ -51,7 +50,7 @@ protected function _init() } /** - * Get the login form block + * Get the login form block. * * @return \Magento\Backend\Test\Block\Admin\Login */ @@ -63,7 +62,7 @@ public function getLoginBlock() } /** - * Get the header panel block of admin dashboard + * Get the header panel block of admin dashboard. * * @return \Magento\Backend\Test\Block\Page\Header */ @@ -75,7 +74,7 @@ public function getHeaderBlock() } /** - * Get global messages block + * Get global messages block. * * @return \Magento\Core\Test\Block\Messages */ @@ -84,6 +83,11 @@ public function getMessagesBlock() return Factory::getBlockFactory()->getMagentoCoreMessages($this->_browser->find($this->messagesBlock)); } + /** + * Wait for Header block is visible in the page. + * + * @return void + */ public function waitForHeaderBlock() { $browser = $this->_browser; diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml index 77f4285338fc4..b7f64e34db13d 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml @@ -6,11 +6,13 @@ */ --> - - - - - - - + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml index 6f486d22e4276..be9dea9366587 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php new file mode 100644 index 0000000000000..5ddeae663986f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php @@ -0,0 +1,39 @@ +open(); + $dashboard->getMenuBlock()->navigate($menuItem); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..2cc5603938057 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,36 @@ + + + + + + Dashboard + Dashboard + + + + Content > Schedule + Store Design Schedule + + + + Stores > All Stores + Stores + + + + Stores > Configuration + Configuration + + + + System > Cache Management + Cache Management + + + + diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml new file mode 100644 index 0000000000000..ba16bc1f7220b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml @@ -0,0 +1,19 @@ + + + + + + high + + + + + high + + + diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..e9ac9e52ca3db --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ + + + + + + System > Backups + Backups + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php index d457d3fae63ea..0423a2e4a4091 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php @@ -64,6 +64,14 @@ public function __construct( $this->browser->switchToFrame(new Locator($this->iFrame)); } + /** + * @destructor + */ + public function __destruct() + { + $this->browser->switchToFrame(); + } + /** * Fill the attribute form. * @@ -112,6 +120,5 @@ public function openTab($tabName) public function saveAttributeForm() { $this->browser->find($this->saveButton)->click(); - $this->browser->selectWindow(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index b1091273427d3..8a6c5bc78830d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -11,27 +11,26 @@ use Magento\Mtf\Client\Element; /** - * Class AdvancedPropertiesTab - * Tab "Advanced Attribute Properties" + * Tab "Advanced Attribute Properties". */ class Advanced extends Tab { /** - * "Advanced Attribute Properties" tab-button + * "Advanced Attribute Properties" tab-button. * * @var string */ protected $propertiesTab = '[data-target="#advanced_fieldset-content"][data-toggle="collapse"]'; /** - * "Advanced Attribute Properties" tab-button active + * "Advanced Attribute Properties" content. * * @var string */ - protected $propertiesTabActive = '.title.active'; + protected $propertiesTabContent = '#advanced_fieldset-content'; /** - * Fill 'Advanced Attribute Properties' tab + * Fill 'Advanced Attribute Properties' tab. * * @param array $fields * @param SimpleElement|null $element @@ -39,10 +38,10 @@ class Advanced extends Tab */ public function fillFormTab(array $fields, SimpleElement $element = null) { - if (!$this->_rootElement->find($this->propertiesTabActive)->isVisible()) { + if (!$this->_rootElement->find($this->propertiesTabContent)->isVisible()) { $this->_rootElement->find($this->propertiesTab)->click(); } - return parent::fillFormTab($fields); + return parent::fillFormTab($fields, $element); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php index 68a4971aba92a..699bc721e7d1e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php @@ -113,11 +113,6 @@ public function fill(FixtureInterface $product, SimpleElement $element = null, F } else { $tabs = $this->getFieldsByTabs($product); - //TODO: Remove after old product fixture will be deleted - if (null === $category && $product instanceof DataFixture) { - $categories = $product->getCategories(); - $category = reset($categories); - } if ($category) { $tabs['product-details']['category_ids']['value'] = $category->getName(); } @@ -147,7 +142,7 @@ protected function createCustomAttribute(InjectableFixture $product, $tabName = /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\ProductDetails $tab */ $tab = $this->openTab($tabName); $tab->addNewAttribute($tabName); - $this->fillAttributeForm($attribute); + $this->getAttributeForm()->fill($attribute); } } @@ -286,18 +281,6 @@ public function getRequireNoticeAttributes(InjectableFixture $product) return $data; } - /** - * Fill product attribute form. - * - * @param CatalogProductAttribute $productAttribute - * @return void - */ - public function fillAttributeForm(CatalogProductAttribute $productAttribute) - { - $attributeForm = $this->getAttributeForm(); - $attributeForm->fill($productAttribute); - } - /** * Click "Save" button on attribute form. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php index b8c85e290dd14..9c9e9dd1f19e9 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php @@ -11,34 +11,33 @@ use Magento\Mtf\Client\Locator; /** - * Class View - * Category view block on the category page + * Category view block on the category page. */ class View extends Block { /** - * Recently Viewed Products selectors + * Recently Viewed Products selectors. * * @var string */ protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]'; /** - * Description CSS selector + * Description CSS selector. * * @var string */ protected $description = '.category-description'; /** - * Locator for category content + * Locator for category content. * * @var string */ protected $content = '.category-cms'; /** - * Get description + * Get description. * * @return string */ @@ -48,17 +47,18 @@ public function getDescription() } /** - * Get Category Content + * Get Category Content. * * @return string */ public function getContent() { - return $this->_rootElement->find($this->content)->getText(); + $categoryContent = $this->_rootElement->find($this->content); + return $categoryContent->isVisible() ? $categoryContent->getText() : ''; } /** - * Get products from Recently Viewed block + * Get products from Recently Viewed block. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php index 34b3fc49ec2a0..dd2265411c098 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php @@ -20,7 +20,7 @@ class Search extends Block * * @var string */ - protected $searchAutocomplete = './/div[@id="search_autocomplete"]//li[span[text()="%s"]]'; + protected $searchAutocomplete = './/div[@id="search_autocomplete"]//li[span[text()[normalize-space()="%s"]]]'; /** * Selector number of matches for a given row 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 636a0e12ebdac..663a249b5da66 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 @@ -78,7 +78,7 @@ Yes - + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php index add0a7c40e1bc..22ac44c8c5e55 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php @@ -45,6 +45,7 @@ class LandingPage implements FixtureInterface public function __construct(FixtureFactory $fixtureFactory, array $params, $data = []) { $this->params = $params; + $this->data = $data; if (isset($data['preset'])) { /** @var CmsBlock $cmsBlock */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php index 66ae5c3e9048d..9770e6726048c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php @@ -14,13 +14,12 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Create new category via curl + * Create new category via curl. */ class Curl extends AbstractCurl implements CategoryInterface { /** - * Data use config for category + * Data use config for category. * * @var array */ @@ -56,25 +55,16 @@ class Curl extends AbstractCurl implements CategoryInterface ]; /** - * Post request for creating Subcategory + * Post request for creating Subcategory. * * @param FixtureInterface|null $fixture [optional] * @return array */ public function persist(FixtureInterface $fixture = null) { - $data['general'] = $this->replaceMappingData($fixture->getData()); - if ($fixture->hasData('landing_page')) { - $data['general']['landing_page'] = $this->getBlockId($fixture->getLandingPage()); - } + $data = $this->prepareData($fixture); - $diff = array_diff($this->dataUseConfig, array_keys($data['general'])); - if (!empty($diff)) { - $data['use_config'] = $diff; - } - $parentCategoryId = $data['general']['parent_id']; - - $url = $_ENV['app_backend_url'] . 'catalog/category/save/store/0/parent/' . $parentCategoryId . '/'; + $url = $_ENV['app_backend_url'] . 'catalog/category/save/store/0/parent/' . $data['general']['parent_id'] . '/'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); @@ -87,12 +77,34 @@ public function persist(FixtureInterface $fixture = null) } /** - * Getting block id by name + * Prepare category data for curl. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture) + { + $data['general'] = $this->replaceMappingData($fixture->getData()); + $data['is_anchor'] = isset($data['is_anchor']) ? $data['is_anchor'] : 0; + if ($fixture->hasData('landing_page')) { + $data['general']['landing_page'] = $this->getBlockId($fixture->getLandingPage()); + } + + $diff = array_diff($this->dataUseConfig, array_keys($data['general'])); + if (!empty($diff)) { + $data['use_config'] = $diff; + } + + return $data; + } + + /** + * Getting block id by name. * * @param string $landingName * @return int|null */ - public function getBlockId($landingName) + protected function getBlockId($landingName) { $url = $_ENV['app_backend_url'] . 'catalog/category'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml index 5872271e30c50..df6bf92efaf4d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml @@ -6,10 +6,9 @@ */ --> - - - - - - + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index b7060994fbd50..4998c9d960474 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -277,7 +277,7 @@ 100 - Main W"e + Main Website simple-product-%isolation% 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 395dc632a4049..590204f0d4d3b 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 @@ -18,7 +18,6 @@ - - - - - - No Position @@ -44,7 +43,6 @@ RootCategory Page Title Yes Static block and products - - Yes No Position @@ -70,7 +68,6 @@ - - - - - - Yes - @@ -97,7 +94,6 @@ - Yes - - - No Yes - @@ -125,7 +121,7 @@ Subcategory Page Title Yes Static block and products - default + default Yes No Position @@ -153,7 +149,6 @@ - Yes - - - - Yes - @@ -179,7 +174,6 @@ - No - - - - - - @@ -205,7 +199,6 @@ - Yes - - - - - - @@ -233,7 +226,6 @@ - Yes - - - - - - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..a42733b3587f1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ + + + + + + Products > Catalog + Inventory + + + + Products > Categories + Categories + + + + Stores > Product + Product Attributes + + + + Stores > Product Template + Product Templates + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index dcbe8113bdd36..364854e6870bb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -6,856 +6,457 @@ */ --> - - - Create product with custom options(fixed price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10000 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 50 - 657 - - - - - - - - - drop_down_with_one_option_fixed_price - drop_down_with_one_option_fixed_price - - - drop_down_with_one_option_fixed_price - - - - - - - - - - - - - - - - - - Create product with custom options(percent price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10001 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 51 - 658 - - - - - - - - - drop_down_with_one_option_percent_price - drop_down_with_one_option_percent_price - - - drop_down_with_one_option_percent_price - - - - - - - - - - - - - - - - - - Create product with special price and custom options(fixed price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10002 - 90 - Simple Product short_description %isolation% - Simple Product description %isolation% - 52 - 659 - - - - - - - - - drop_down_with_one_option_fixed_price - drop_down_with_one_option_fixed_price - - - MAGETWO-23029 - - - - - - - - - - - - - - - - - - Create product with special price and custom options(percent price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10003 - 90 - Simple Product short_description %isolation% - Simple Product description %isolation% - 53 - 660 - - - - - - - - - drop_down_with_one_option_percent_price - drop_down_with_one_option_percent_price - - - MAGETWO-23030 - - - - - - - - - - - - - - - - - - Create product with group price and custom options(percent price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10004 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 54 - 661 - - - - - - - - - drop_down_with_one_option_percent_price - drop_down_with_one_option_percent_price - - - MAGETWO-23030 - MAGETWO-23055 - - - - - - - - - - - - - - - - Create product with group price and custom options(fixed price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10005 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 55 - 662 - - - - - - - - - drop_down_with_one_option_fixed_price - drop_down_with_one_option_fixed_price - - - MAGETWO-23029 - MAGETWO-23055 - - - - - - - - - - - - - - - - Create product with tier price and custom options(percent price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10006 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 56 - 663 - - - - - - - - - drop_down_with_one_option_percent_price - drop_down_with_one_option_percent_price - - - MAGETWO-23030 - - - MAGETWO-23002 - - - - - - - - - - - - - - Create product with tier price and custom options(fixed price) - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10007 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 57 - 664 - - - - - - - - - drop_down_with_one_option_fixed_price - drop_down_with_one_option_fixed_price - - - MAGETWO-23029 - - - MAGETWO-23002 - - - - - - - - - - - - - - Create product without custom options - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10008 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 58 - 665 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create product that is in stock - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10009 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 59 - 75 - In Stock - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create product that is out stock - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10010 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 60 - 0 - Out of Stock - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create product that visible only in search - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10011 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 61 - 138 - - - - - - - Search - - - - - - - - - - - - - - - - - - - - - - - Create simple product and check search by sku - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10012 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 62 - 139 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create simple product and check visibility in category - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10013 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 63 - 140 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create product with tax class and group price - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - taxable_goods - 10014 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 64 - 141 - - - - - - - - - - - - - - - - - default - - - - - - - - - - - - - - - - - - Create product with tax class and check absent special price - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - taxable_goods - 10015 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 65 - 142 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create product without tax class and tier price - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - None - 10016 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 66 - 143 - - - - - - - - - - - - - - - - - - - default - - - - - - - - - - - - - - - - Create product wit suite of custom options - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10017 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 67 - 144 - - - - - - - - - options-suite - options-suite - catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option - - - - - - - - - - - - - - - - - - - - - - Create product with cross-sell products - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10018 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 59 - 75 - In Stock - - - - - - - - - - - - - - - - - - - catalogProductSimple::default, configurableProduct::default - - - - - - - - - - - Create product with up-sell products - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10019 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 59 - 75 - In Stock - - - - - - - - - - - - - - - - - - - - - catalogProductSimple::default, configurableProduct::default - - - - - - - - - Create product with related products - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10020 - - - Simple Product short_description %isolation% - Simple Product description %isolation% - 59 - 75 - In Stock - - - - - - - - - - - - - - - - - - - - - - - catalogProductSimple::default, configurableProduct::default - - - - - - - MAGETWO-12423: Can't Add Out of Stock Products to Shopping Cart - display_out_of_stock - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10021 - - - - - - - 68 - 0 - Out of Stock - - - - - - - - - - - - - - - - - - - - - - - - - test_type:acceptance_test - - - - - MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only) - yes - default_subcategory - simple%isolation% - simple%isolation% - simple%isolation% - - - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MAGETWO-12514: Create Simple Product and Assigning It to Category - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - taxable_goods - 10 - - - - - - - 1 - 1000 - In Stock - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MAGETWO-12703: Create Simple Product with Custom Options and Assign it to the Category - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - taxable_goods - 10 - - - - - - - 1 - 1000 - In Stock - - - - - - - drop_down_with_one_option_fixed_price - - - - - - - - - - - - - - - - - test_type:acceptance_test - - - - - - - - MAGETWO-12914: Create Simple Product with Advanced Inventory and Assign It to the Category - - - - - simple-product-%isolation% - Simple Product %isolation% - simple_sku_%isolation% - - - 10 - - - - - - - - - - - - - Yes - 1 - - - - - - - - - - - - - - - - - - - - - test_type:acceptance_test - - - - + + + Create product with custom options(fixed price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10000 + Simple Product short_description %isolation% + Simple Product description %isolation% + 50 + 657 + drop_down_with_one_option_fixed_price + drop_down_with_one_option_fixed_price + drop_down_with_one_option_fixed_price + + + + + + + + Create product with custom options(percent price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10001 + Simple Product short_description %isolation% + Simple Product description %isolation% + 51 + 658 + drop_down_with_one_option_percent_price + drop_down_with_one_option_percent_price + drop_down_with_one_option_percent_price + + + + + + + + Create product with special price and custom options(fixed price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10002 + 90 + Simple Product short_description %isolation% + Simple Product description %isolation% + 52 + 659 + drop_down_with_one_option_fixed_price + drop_down_with_one_option_fixed_price + MAGETWO-23029 + + + + + + + + Create product with special price and custom options(percent price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10003 + 90 + Simple Product short_description %isolation% + Simple Product description %isolation% + 53 + 660 + drop_down_with_one_option_percent_price + drop_down_with_one_option_percent_price + MAGETWO-23030 + + + + + + + + Create product with group price and custom options(percent price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10004 + Simple Product short_description %isolation% + Simple Product description %isolation% + 54 + 661 + drop_down_with_one_option_percent_price + drop_down_with_one_option_percent_price + MAGETWO-23030 + MAGETWO-23055 + + + + + + + + Create product with group price and custom options(fixed price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10005 + Simple Product short_description %isolation% + Simple Product description %isolation% + 55 + 662 + drop_down_with_one_option_fixed_price + drop_down_with_one_option_fixed_price + MAGETWO-23029 + MAGETWO-23055 + + + + + + + + Create product with tier price and custom options(percent price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10006 + Simple Product short_description %isolation% + Simple Product description %isolation% + 56 + 663 + drop_down_with_one_option_percent_price + drop_down_with_one_option_percent_price + MAGETWO-23030 + MAGETWO-23002 + + + + + + + + Create product with tier price and custom options(fixed price) + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10007 + Simple Product short_description %isolation% + Simple Product description %isolation% + 57 + 664 + drop_down_with_one_option_fixed_price + drop_down_with_one_option_fixed_price + MAGETWO-23029 + MAGETWO-23002 + + + + + + + + Create product without custom options + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10008 + Simple Product short_description %isolation% + Simple Product description %isolation% + 58 + 665 + + + + + + + Create product that is in stock + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10009 + Simple Product short_description %isolation% + Simple Product description %isolation% + 59 + 75 + In Stock + + + + + Create product that is out stock + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10010 + Simple Product short_description %isolation% + Simple Product description %isolation% + 60 + 0 + Out of Stock + + + + + Create product that visible only in search + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10011 + Simple Product short_description %isolation% + Simple Product description %isolation% + 61 + 138 + Search + + + + + Create simple product and check search by sku + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10012 + Simple Product short_description %isolation% + Simple Product description %isolation% + 62 + 139 + + + + + + + + + Create simple product and check visibility in category + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10013 + Simple Product short_description %isolation% + Simple Product description %isolation% + 63 + 140 + + + + + + + + + Create product with tax class and group price + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + taxable_goods + 10014 + Simple Product short_description %isolation% + Simple Product description %isolation% + 64 + 141 + default + + + + + + + + + + Create product with tax class and check absent special price + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + taxable_goods + 10015 + Simple Product short_description %isolation% + Simple Product description %isolation% + 65 + 142 + + + + + + + + + + Create product without tax class and tier price + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + None + 10016 + Simple Product short_description %isolation% + Simple Product description %isolation% + 66 + 143 + default + + + + + + + + + + Create product wit suite of custom options + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10017 + Simple Product short_description %isolation% + Simple Product description %isolation% + 67 + 144 + options-suite + options-suite + catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option + + + + + + + + + + Create product with cross-sell products + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10018 + Simple Product short_description %isolation% + Simple Product description %isolation% + 59 + 75 + In Stock + catalogProductSimple::default, configurableProduct::default + + + + + + + Create product with up-sell products + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10019 + Simple Product short_description %isolation% + Simple Product description %isolation% + 59 + 75 + In Stock + catalogProductSimple::default, configurableProduct::default + + + + + + + Create product with related products + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10020 + Simple Product short_description %isolation% + Simple Product description %isolation% + 59 + 75 + In Stock + catalogProductSimple::default, configurableProduct::default + + + + + + + MAGETWO-12423: Can't Add Out of Stock Products to Shopping Cart + display_out_of_stock + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10021 + 68 + 0 + Out of Stock + test_type:acceptance_test + + + + + MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only) + yes + default_subcategory + simple%isolation% + simple%isolation% + simple%isolation% + 10 + + + + + + MAGETWO-12514: Create Simple Product and Assigning It to Category + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + taxable_goods + 10 + 1 + 1000 + In Stock + + + + + + + MAGETWO-12703: Create Simple Product with Custom Options and Assign it to the Category + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + taxable_goods + 10 + 1 + 1000 + In Stock + drop_down_with_one_option_fixed_price + test_type:acceptance_test + + + + + + + + MAGETWO-12914: Create Simple Product with Advanced Inventory and Assign It to the Category + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10 + Yes + 1 + test_type:acceptance_test + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php new file mode 100644 index 0000000000000..d9e73e456e618 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php @@ -0,0 +1,130 @@ + Catalog. + * 3. Click Product from grid. + * 4. Click "Save & Duplicate". + * 5. Perform asserts. + * + * @group Products_(MX) + * @ZephyrId MAGETWO-23294 + */ +class DuplicateProductEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'MX'; + /* end tags */ + + /** + * Category fixture. + * + * @var Category + */ + protected $category; + + /** + * Product page with a grid. + * + * @var CatalogProductIndex + */ + protected $productGrid; + + /** + * Page to update a product. + * + * @var CatalogProductEdit + */ + protected $editProductPage; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Prepare data. + * + * @param Category $category + * @param CatalogProductIndex $productGrid + * @param CatalogProductEdit $editProductPage + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __prepare( + Category $category, + CatalogProductIndex $productGrid, + CatalogProductEdit $editProductPage, + FixtureFactory $fixtureFactory + ) { + $this->category = $category; + $this->category->persist(); + $this->productGrid = $productGrid; + $this->editProductPage = $editProductPage; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Run test duplicate product entity. + * + * @param string $productType + * @return array + */ + public function test($productType) + { + // Precondition + $product = $this->createProduct($productType); + + // Steps + $filter = ['sku' => $product->getSku()]; + $this->productGrid->open(); + $this->productGrid->getProductGrid()->searchAndOpen($filter); + $this->editProductPage->getFormPageActions()->saveAndDuplicate(); + + return ['product' => $product]; + } + + /** + * Creating a product according to the type of. + * + * @param string $productType + * @return array + */ + protected function createProduct($productType) + { + list($fixture, $dataSet) = explode('::', $productType); + $product = $this->fixtureFactory->createByCode( + $fixture, + [ + 'dataSet' => $dataSet, + 'data' => [ + 'category_ids' => [ + 'category' => $this->category, + ], + ] + ] + ); + $product->persist(); + + return $product; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000..3f2950f6efc1b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ + + + + + + catalogProductSimple::default + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml index 34bbab86b5883..d0bd1c40c54cb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml @@ -8,6 +8,7 @@ + Bug: MAGETWO-34630 simple configurableProduct::default @@ -44,6 +45,7 @@ + Bug: MAGETWO-34630 virtual configurableProduct::not_virtual_for_type_switching @@ -71,6 +73,7 @@ + Bug: MAGETWO-34630 downloadable configurableProduct::not_virtual_for_type_switching diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml index d82f009bac2d5..b862b94987c5d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml @@ -6,106 +6,107 @@ */ --> - - - catalogProductSimple::default - configurableProduct::default - - - - - - - - - - - - catalogProductSimple::default - catalogProductVirtual::default - - - - - - - configurableProduct::default - catalogProductSimple::default - deleteAttributes - - - - - configurableProduct::default - catalogProductVirtual::default - deleteAttributes - - - - - catalogProductVirtual::default - catalogProductSimple::default - - - - - - - catalogProductVirtual::default - configurableProduct::not_virtual_for_type_switching - - - - - - - - - - - - catalogProductVirtual::default - downloadableProduct::default - - - - - - - - - - - downloadableProduct::default - catalogProductSimple::default - - - - - - - downloadableProduct::default - configurableProduct::not_virtual_for_type_switching - - - - - - - - - - - - downloadableProduct::default - catalogProductVirtual::default - clearDownloadableData - - - - - catalogProductSimple::default - downloadableProduct::default - - - - - - - - - - + + + Bug: MAGETWO-34630 + catalogProductSimple::default + configurableProduct::default + - + + + + + + + + + + catalogProductSimple::default + catalogProductVirtual::default + - + + + + + configurableProduct::default + catalogProductSimple::default + deleteAttributes + + + + + configurableProduct::default + catalogProductVirtual::default + deleteAttributes + + + + + catalogProductVirtual::default + catalogProductSimple::default + - + + + + + catalogProductVirtual::default + configurableProduct::not_virtual_for_type_switching + - + + + + + + + + + + catalogProductVirtual::default + downloadableProduct::default + - + + + + + + + + + downloadableProduct::default + catalogProductSimple::default + - + + + + + downloadableProduct::default + configurableProduct::not_virtual_for_type_switching + - + + + + + + + + + + downloadableProduct::default + catalogProductVirtual::default + clearDownloadableData + + + + + catalogProductSimple::default + downloadableProduct::default + - + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php index 897c4eb57180a..d17441b09b1fc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php @@ -54,7 +54,6 @@ class CreateProductAttributeEntityFromProductPageTest extends Scenario */ public function __prepare(FixtureFactory $fixtureFactory) { - $this->markTestIncomplete('Bug: MTA-1616'); $product = $fixtureFactory->createByCode( 'catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor'] diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml index f88391d8938b5..2a0d3215e00f3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml @@ -6,109 +6,67 @@ */ --> - - - Text_Field_Admin_%isolation% - Text Field - - - No - attr_text_%isolation% - Global - <b><i>default_value_text%isolation%</i></b> - - - Yes - - - Yes - Yes - Yes - - - - - - - Yes - Yes - - - Yes - - - - - - - - - - - - - Dropdown_Admin_%isolation% - Dropdown - two_options - No - attr_dropdown_%isolation% - Global - - - - - - - - - - - - - - - Filterable (with results) - Yes - - - - - - - - - - - - - - - - Text_Field_Admin_%isolation% - Text Field - - - Yes - attr_text_%isolation% - - - default_value_text%isolation% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Text_Field_Admin_%isolation% - Text Field - - - No - attr_text_%isolation% - - - default_value_text%isolation% - - - Yes - - - - - - - - - - - - - - - - - - - - - - - - - + + + Text_Field_Admin_%isolation% + Text Field + No + attr_text_%isolation% + Global + <b><i>default_value_text%isolation%</i></b> + - + Yes + Yes + Yes + Yes + - + Yes + Yes + Yes + + + + + + + + + + + + + Dropdown_Admin_%isolation% + Dropdown + two_options + No + attr_dropdown_%isolation% + Global + - + Filterable (with results) + Yes + + + + + + Text_Field_Admin_%isolation% + Text Field + Yes + attr_text_%isolation% + default_value_text%isolation% + - + - + - + + + + Text_Field_Admin_%isolation% + Text Field + No + attr_text_%isolation% + default_value_text%isolation% + Yes + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php index 2d867c8aaa5d1..620475dbb3882 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php @@ -47,7 +47,7 @@ public function __construct(CatalogProductAttribute $attribute, CatalogProductEd */ public function run() { - $this->catalogProductEdit->getProductForm()->fillAttributeForm($this->attribute); + $this->catalogProductEdit->getProductForm()->getAttributeForm()->fill($this->attribute); return ['attribute' => $this->attribute]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php index f982dafef1378..1eab3289e6597 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php @@ -6,49 +6,60 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; /** - * Class AssertCatalogPriceRuleAppliedCatalogPage + * Assert that Catalog Price Rule is applied for product(s) in Catalog. */ class AssertCatalogPriceRuleAppliedCatalogPage extends AbstractConstraint { /** * Assert that Catalog Price Rule is applied for product(s) in Catalog - * according to Priority(Priority/Stop Further Rules Processing) + * according to Priority(Priority/Stop Further Rules Processing). * - * @param CatalogProductSimple $product - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param array $price + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - array $price + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $productPriceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); - $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; - $diff = $this->verifyData($actualPrice, $price); - \PHPUnit_Framework_Assert::assertTrue( - empty($diff), - implode(' ', $diff) - ); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $cmsIndexPage->open(); + foreach ($products as $key => $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); + $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); + $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + $diff = $this->verifyData($actualPrice, $productPrice[$key]); + \PHPUnit_Framework_Assert::assertTrue( + empty($diff), + implode(' ', $diff) + ); + } } /** - * Check if arrays have equal values + * Check if arrays have equal values. * * @param array $formData * @param array $fixtureData @@ -59,16 +70,16 @@ protected function verifyData(array $formData, array $fixtureData) $errorMessage = []; foreach ($formData as $key => $value) { if ($value != $fixtureData[$key]) { - $errorMessage[] = "Data not equal." + $errorMessage[] = "Value " . $key . " is not equal." . "\nExpected: " . $fixtureData[$key] - . "\nActual: " . $value; + . "\nActual: " . $value . "\n"; } } return $errorMessage; } /** - * Text of catalog price rule visibility on catalog page (frontend) + * Text of catalog price rule visibility on catalog page (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php new file mode 100644 index 0000000000000..a68f7719e1862 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php @@ -0,0 +1,82 @@ +objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $this->objectManager->create('\Magento\Checkout\Test\TestStep\ProceedToCheckoutStep')->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\FillBillingInformationStep', + ['customer' => $customer, 'checkoutMethod' => 'register'] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\FillShippingMethodStep', + ['shipping' => $shipping] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\SelectPaymentMethodStep', + ['payment' => $payment] + )->run(); + $actualPrices['grand_total'] = $checkoutOnepage->getReviewBlock()->getGrandTotal(); + $actualPrices['sub_total'] = $checkoutOnepage->getReviewBlock()->getSubtotal(); + $expectedPrices['grand_total'] = $cartPrice['grand_total'] + $cartPrice['shipping_price']; + $expectedPrices['sub_total'] = $cartPrice['sub_total']; + \PHPUnit_Framework_Assert::assertEquals( + $expectedPrices, + $actualPrices, + 'Wrong total cart prices are displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Displayed catalog price rule data on OnePage Checkout equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php index 3dc3d40203234..821f48e277300 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php @@ -6,52 +6,62 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; -use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; /** - * Class AssertCatalogPriceRuleAppliedProductPage + * Assert that Catalog Price Rule is applied on Product page. */ class AssertCatalogPriceRuleAppliedProductPage extends AbstractConstraint { /** - * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page + * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page. * - * @param CatalogProductSimple $product - * @param CatalogProductView $pageCatalogProductView - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param array $price + * @param CatalogProductView $catalogProductViewPage + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CatalogProductView $pageCatalogProductView, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - array $price + CatalogProductView $catalogProductViewPage, + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); - $productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock(); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); - $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; - $diff = $this->verifyData($actualPrice, $price); - \PHPUnit_Framework_Assert::assertTrue( - empty($diff), - implode(' ', $diff) - ); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $cmsIndexPage->open(); + foreach ($products as $key => $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); + $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); + $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + $diff = $this->verifyData($actualPrice, $productPrice[$key]); + \PHPUnit_Framework_Assert::assertTrue( + empty($diff), + implode(' ', $diff) + ); + } } /** - * Check if arrays have equal values + * Check if arrays have equal values. * * @param array $formData * @param array $fixtureData @@ -71,7 +81,7 @@ protected function verifyData(array $formData, array $fixtureData) } /** - * Text of catalog price rule visibility on product page (frontend) + * Text of catalog price rule visibility on product page (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php index 783eba7bfa8fd..e3b15f78366b0 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php @@ -6,56 +6,68 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; -use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Customer\Test\Fixture\Customer; use Magento\Checkout\Test\Page\CheckoutCart; -use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; /** - * Class AssertCatalogPriceRuleAppliedShoppingCart + * Assert that Catalog Price Rule is applied in Shopping Cart. */ class AssertCatalogPriceRuleAppliedShoppingCart extends AbstractConstraint { /** * Assert that Catalog Price Rule is applied for product(s) in Shopping Cart - * according to Priority(Priority/Stop Further Rules Processing) + * according to Priority(Priority/Stop Further Rules Processing). * - * @param CatalogProductSimple $product - * @param CatalogProductView $pageCatalogProductView - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param CheckoutCart $pageCheckoutCart - * @param array $price + * @param CheckoutCart $checkoutCartPage + * @param array $products + * @param array $cartPrice + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CatalogProductView $pageCatalogProductView, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - CheckoutCart $pageCheckoutCart, - array $price + CheckoutCart $checkoutCartPage, + array $products, + array $cartPrice, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); - $pageCatalogProductView->getViewBlock()->clickAddToCartButton(); - $actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getPrice(); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $checkoutCartPage->open(); + foreach ($products as $key => $product) { + $actualPrice = $checkoutCartPage->getCartBlock()->getCartItem($product)->getSubtotalPrice(); + \PHPUnit_Framework_Assert::assertEquals( + $productPrice[$key]['sub_total'], + $actualPrice, + 'Wrong product price is displayed.' + . "\nExpected: " . $productPrice[$key]['sub_total'] + . "\nActual: " . $actualPrice . "\n" + ); + } + $actualPrices['sub_total'] = $checkoutCartPage->getTotalsBlock()->getSubtotal(); + $actualPrices['grand_total'] = $checkoutCartPage->getTotalsBlock()->getGrandTotal(); + $expectedPrices['sub_total'] = $cartPrice['sub_total']; + $expectedPrices['grand_total'] = $cartPrice['grand_total']; \PHPUnit_Framework_Assert::assertEquals( - $price['grand_total'], - $actualGrandTotal, - 'Wrong grand total price is displayed.' - . "\nExpected: " . $price['grand_total'] - . "\nActual: " . $actualGrandTotal + $expectedPrices, + $actualPrices, + 'Wrong total cart prices are displayed.' ); } /** - * Text of catalog price rule visibility in Shopping Cart (frontend) + * Text of catalog price rule visibility in Shopping Cart (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php new file mode 100644 index 0000000000000..4b6b244d48f3d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php @@ -0,0 +1,53 @@ +open(); + foreach ($products as $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); + \PHPUnit_Framework_Assert::assertFalse( + $productPriceBlock->isSpecialPriceVisible(), + "Catalog price rule is applied!\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Catalog price rule was not applied to products on catalog page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php new file mode 100644 index 0000000000000..8b5dc40eb97bf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php @@ -0,0 +1,57 @@ +open(); + foreach ($products as $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); + \PHPUnit_Framework_Assert::assertFalse( + $productPriceBlock->isSpecialPriceVisible(), + "Catalog price rule is applied!\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Catalog price rule was not applied to products on product page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php new file mode 100644 index 0000000000000..bea638692dc20 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php @@ -0,0 +1,56 @@ +objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $checkoutCartPage->open(); + foreach ($products as $key => $product) { + $actualPrice = $checkoutCartPage->getCartBlock()->getCartItem($product)->getSubtotalPrice(); + \PHPUnit_Framework_Assert::assertEquals( + $productPrice[$key]['regular'], + $actualPrice, + 'Wrong product price is displayed.' + . "\nExpected: " . $productPrice[$key]['regular'] + . "\nActual: " . $actualPrice . "\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Displayed catalog price rule data in shopping cart(frontend) equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php deleted file mode 100644 index ff33ac103f3b0..0000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php +++ /dev/null @@ -1,46 +0,0 @@ -_repository = Factory::getRepositoryFactory() - ->getMagentoCatalogRuleCatalogPriceRule($this->_dataConfig, $this->_data); - - //Default data set - $this->switchData(Repository::CATALOG_PRICE_RULE); - } - - /** - * Get the rule name value - */ - public function getRuleName() - { - return $this->getData('fields/name/value'); - } - - /** - * Get the discount amount value - */ - public function getDiscountAmount() - { - return $this->getData('fields/discount_amount/value'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php deleted file mode 100644 index 548477e346f9a..0000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php +++ /dev/null @@ -1,106 +0,0 @@ - $value) { - $parts[$key] = trim($value); - } - - if ($parts[0] == 'Category') { - $this->data['conditions']['1--1']['attribute'] = 'category_ids'; - } elseif ($parts[1] == 'AttributeSet') { - $this->data['conditions']['1--1']['attribute'] = 'attribute_set_id'; - } - - if ($parts[1] == 'is') { - $this->data['conditions']['1--1']['operator'] = '=='; - } else { - $this->data['conditions']['1--1']['operator'] = '!='; - } - - $this->data['conditions']['1--1']['type'] = 'Magento\CatalogRule\Model\Rule\Condition\Product'; - - if (!empty($parts[2])) { - $this->data['conditions']['1--1']['value'] = $parts[2]; - } - } - - /** - * Persist custom selections conditions - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param string|null $key - * @return array|mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php deleted file mode 100644 index ed8f775509728..0000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php +++ /dev/null @@ -1,114 +0,0 @@ -fixtureFactory = $fixtureFactory; - - $this->data = $data; - - if (isset($this->data['products'])) { - $products = explode(',', $this->data['products']); - $this->data['products'] = []; - foreach ($products as $key => $product) { - list($fixture, $dataSet) = explode('::', $product); - $this->data['products'][$key] = $this->fixtureFactory - ->createByCode($fixture, ['dataSet' => $dataSet]); - } - } - - $this->data['preset'] = $this->getPreset($this->data['preset']); - - $this->params = $params; - if ($persist) { - $this->persist(); - } - } - - /** - * Persist bundle selections products - * - * @return void - */ - public function persist() - { - if (isset($this->data['products'])) { - foreach ($this->data['products'] as $product) { - /** @var $product FixtureInterface */ - $product->persist(); - } - } - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * @param $name - * @return mixed - * @throws \InvalidArgumentException - */ - protected function getPreset($name) - { - $presets = [ - 'simple_category' => [ - 'name' => 'Simple With Category', - ], - ]; - if (!isset($presets[$name])) { - return null; - } - return $presets[$name]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php deleted file mode 100755 index 1a9b4268b9ffb..0000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php +++ /dev/null @@ -1,94 +0,0 @@ -_data['default'] = ['config' => $defaultConfig, 'data' => $defaultData]; - $this->_data[self::CATALOG_PRICE_RULE] = $this->_getCatalogPriceRule(); - $this->_data[self::CATALOG_PRICE_RULE_ALL_GROUPS] = array_replace_recursive( - $this->_getCatalogPriceRule(), - $this->_getCatalogPriceRuleAllGroups() - ); - } - - protected function _getCatalogPriceRule() - { - return [ - 'data' => [ - 'fields' => [ - 'name' => ['value' => 'Rule %isolation%', 'group' => static::GROUP_RULE_INFORMATION], - 'is_active' => [ - 'value' => 'Active', - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'select', - ], - 'website_ids' => [ - 'value' => ['Main Website'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['1'], - ], - 'customer_group_ids' => [ - 'value' => ['%group_value%'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['%group_id%'], - ], - 'simple_action' => [ - 'value' => 'By Percentage of the Original Price', - 'group' => static::GROUP_ACTIONS, - 'input' => 'select', - ], - 'discount_amount' => ['value' => '50.0000', 'group' => static::GROUP_ACTIONS], - 'conditions' => [ - 'value' => '[Category|is|%category_id%]', - 'group' => static::GROUP_CONDITIONS, - 'input' => 'conditions', - 'input_value' => 'Magento\CatalogRule\Model\Rule\Condition\Product|category_ids', - ], - ], - ] - ]; - } - - protected function _getCatalogPriceRuleAllGroups() - { - return [ - 'data' => [ - 'fields' => [ - 'customer_group_ids' => [ - 'value' => ['NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['0', '1', '2', '3'], - ], - ], - ] - ]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php index c9e412c975af7..84f9cd923b6ef 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php @@ -58,12 +58,14 @@ public function testApplySeveralCatalogPriceRules(array $catalogRulesOriginal) $this->catalogRuleNew->getFormPageActions()->saveAndApply(); } // Create product - $productSimple = $this->fixtureFactory->createByCode( - 'catalogProductSimple', - ['dataSet' => 'simple_for_salesrule_1'] - ); - $productSimple->persist(); + $products = $this->objectManager->create( + '\Magento\Catalog\Test\TestStep\CreateProductsStep', + ['products' => 'catalogProductSimple::simple_for_salesrule_1'] + )->run(); - return ['product' => $productSimple]; + return [ + 'products' => $products['products'], + 'category' => $products['products'][0]->getDataFieldConfig('category_ids')['source']->getCategories()[0], + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml index 59418b9161ce4..6f335c06d63af 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml @@ -11,11 +11,12 @@ catalog_price_rule_priority_0 - catalog_price_rule_priority_2 - 100 - 40 - 60 - 40 - 100 + 40 + 40 + 60 + 40 + 40 + 100 @@ -24,11 +25,12 @@ catalog_price_rule_priority_0 catalog_price_rule_priority_1_stop_further_rules catalog_price_rule_priority_2 - 100 - 45 - 55 - 45 - 100 + 45 + 45 + 55 + 45 + 45 + 100 diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php index b16659bb3aa2d..cff1f6ac7037a 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php @@ -6,8 +6,10 @@ namespace Magento\CatalogRule\Test\TestCase; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Customer\Test\Fixture\Customer; use Magento\CatalogRule\Test\Fixture\CatalogRule; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Customer\Test\Fixture\CustomerGroupInjectable; /** * Test Coverage for Create Catalog Rule @@ -28,20 +30,28 @@ class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest { /* tags */ + const TEST_TYPE = 'acceptance_test'; const MVP = 'yes'; const DOMAIN = 'MX'; + const STABLE = 'no'; /* end tags */ /** * Create Catalog Price Rule * * @param CatalogRule $catalogPriceRule + * @param Customer $customer + * @param string $product * @return array */ - public function testCreate(CatalogRule $catalogPriceRule) - { - $productSimple = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'MAGETWO-23036']); + public function testCreate( + CatalogRule $catalogPriceRule, + $product, + Customer $customer = null + ) { + $productSimple = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => $product]); // Prepare data + $catalogPriceRule = $this->applyCustomerGroup($catalogPriceRule, $customer); $replace = [ 'conditions' => [ 'conditions' => [ @@ -60,6 +70,9 @@ public function testCreate(CatalogRule $catalogPriceRule) $this->catalogRuleNew->getEditForm()->fill($catalogPriceRule, null, $replace); $this->catalogRuleNew->getFormPageActions()->save(); + // Prepare data for tear down + $this->catalogRules[] = $catalogPriceRule; + // Apply Catalog Price Rule $this->catalogRuleIndex->getGridPageActions()->applyRules(); @@ -71,9 +84,36 @@ public function testCreate(CatalogRule $catalogPriceRule) $this->adminCache->getActionsBlock()->flushMagentoCache(); $this->adminCache->getMessagesBlock()->waitSuccessMessage(); - // Prepare data for tear down - $this->catalogRules[] = $catalogPriceRule; + return [ + 'products' => [$productSimple], + 'category' => $productSimple->getDataFieldConfig('category_ids')['source']->getCategories()[0], + ]; + } + + /** + * Create customer with customer group and apply customer group to catalog price rule. + * + * @param CatalogRule $catalogPriceRule + * @param Customer|null $customer + * @return CustomerGroupInjectable + */ + public function applyCustomerGroup(CatalogRule $catalogPriceRule, Customer $customer = null) + { + if ($customer !== null) { + $customer->persist(); + /** @var \Magento\Customer\Test\Fixture\CustomerGroupInjectable $customerGroup */ + $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup(); + $catalogPriceRule = $this->fixtureFactory->createByCode( + 'catalogRule', + [ + 'data' => array_merge( + $catalogPriceRule->getData(), + ['customer_group_ids' => $customerGroup->getCustomerGroupCode()] + ) + ] + ); + } - return ['product' => $productSimple]; + return $catalogPriceRule; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml index 676f80d505035..91556d40fba7f 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml @@ -6,24 +6,51 @@ */ --> - - - rule_name%isolation% - Active - Main Website - NOT LOGGED IN - [Category|is|%category_1%] - To Percentage of the Original Price - 90 - 100 - 90 - 10 - 90 - 100 - - - - - - + + + MAGETWO-23036 + rule_name%isolation% + Active + Main Website + NOT LOGGED IN + [Category|is|%category_1%] + To Percentage of the Original Price + 90 + 90 + 90 + 10 + 90 + 90 + 100 + + + + + + + MAGETWO-12908: Apply Catalog Price Rules to Specific Customer Group. + customer_with_new_customer_group + simple_10_dollar + rule_name%isolation% + Active + Main Website + [Category|is|%category_1%] + By Percentage of the Original Price + 50 + 5 + 5 + 5 + 5 + 5 + 10 + test_type:acceptance_test + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..b3ba80fd81086 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ + + + + + + Marketing > Catalog Price Rules + Catalog Price Rules + + + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php index 189ebcaaca3f0..8178bd9dbbf38 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php @@ -80,12 +80,12 @@ public function testUpdateCatalogPriceRule( $this->catalogRuleNew->getEditForm()->fill($catalogPriceRule, null, $replace); $this->catalogRuleNew->getFormPageActions()->$saveAction(); - // Create simple product with category - $productSimple->persist(); - // Prepare data for tear down $this->catalogRules[] = $catalogPriceRule; - return ['product' => $productSimple]; + // Create simple product with category + $productSimple->persist(); + + return ['products' => [$productSimple]]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php index 106070b62ec4e..aa4f63f5cd977 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php @@ -12,20 +12,16 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for CreateSearchTermEntity - * - * Test Flow: - * * Preconditions: - * 1. Product is created + * 1. Product is created. * * Steps: - * 1. Go to backend as admin user - * 4. Navigate to Marketing->SEO&Search->Search Terms - * 5. Click "Add New Search Term" button - * 6. Fill out all data according to dataset - * 7. Save the Search Term - * 8. Perform all assertions + * 1. Go to backend as admin user. + * 4. Navigate to Marketing > SEO&Search > Search Terms. + * 5. Click "Add New Search Term" button. + * 6. Fill out all data according to dataset. + * 7. Save the Search Term. + * 8. Perform all assertions. * * @group Search_Terms_(MX) * @ZephyrId MAGETWO-26165 @@ -38,21 +34,21 @@ class CreateSearchTermEntityTest extends Injectable /* end tags */ /** - * Search term page + * Search term page. * * @var CatalogSearchIndex */ protected $indexPage; /** - * Search term edit page + * Search term edit page. * * @var CatalogSearchEdit */ protected $editPage; /** - * Inject pages + * Inject pages. * * @param CatalogSearchIndex $indexPage * @param CatalogSearchEdit $editPage @@ -65,7 +61,7 @@ public function __inject(CatalogSearchIndex $indexPage, CatalogSearchEdit $editP } /** - * Run create search term test + * Run create search term test. * * @param CatalogSearchQuery $searchTerm * @return void diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml index cc92653c73f77..02a7b1b0d410e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml @@ -6,18 +6,18 @@ */ --> - - - catalogProductSimple::getSku - Main Website/Main Website Store/Default Store View - Search Term Synonym %isolation% - http://example.com/ - No - - - - - - - + + + catalogProductSimple::sku + Main Website/Main Website Store/Default Store View + Search Term Synonym %isolation% + http://example.com/ + No + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml deleted file mode 100644 index 113e7c222fcbc..0000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - catalogProductSimple::getSku - Main Website/Main Website Store/Default Store View - 1 - 20 - simple%isolation% - http://example.com/ - No - - - - - - - diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..51a39239a23c7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ + + + + + + Marketing > Search Terms + Search Terms + + + + Reports > Search Terms + Search Terms Report + + + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php index d4ce912e61386..146f33e1212fb 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php @@ -11,10 +11,6 @@ use Magento\Mtf\TestCase\Injectable; /** - * Cover Suggest Searching Result (SearchEntity) - * - * Test Flow: - * * Preconditions: * 1. Two "default" test simple products is created. * 2. Navigate to frontend. @@ -36,7 +32,7 @@ class SuggestSearchingResultEntityTest extends Injectable /* end tags */ /** - * Run suggest searching result test + * Run suggest searching result test. * * @param CmsIndex $cmsIndex * @param CatalogSearchQuery $catalogSearch diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php similarity index 77% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php index a2b143d4786f0..e81e138f19279 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php @@ -13,27 +13,23 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for EditSearchTermEntity - * - * Test Flow: - * * Preconditions: - * 1. Product is created + * 1. Product is created. * * Steps: - * 1. Go to frontend - * 2. Test word into the Search field at the top of the page and click Go - * 3. Go to backend as admin user - * 4. Navigate to Marketing->SEO&Search->Search Terms - * 5. Click "Edit" link of just added test word search term - * 6. Fill out all data according to dataset - * 7. Save the Search Term - * 8. Perform all assertions + * 1. Go to frontend. + * 2. Test word into the Search field at the top of the page and click Go. + * 3. Go to backend as admin user. + * 4. Navigate to Marketing > SEO&Search > Search Terms. + * 5. Click "Edit" link of just added test word search term. + * 6. Fill out all data according to dataset. + * 7. Save the Search Term. + * 8. Perform all assertions. * * @group Search_Terms_(MX) * @ZephyrId MAGETWO-26100 */ -class EditSearchTermEntityTest extends Injectable +class UpdateSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; @@ -41,28 +37,28 @@ class EditSearchTermEntityTest extends Injectable /* end tags */ /** - * CMS index page + * CMS index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Search term page + * Search term page. * * @var CatalogSearchIndex */ protected $indexPage; /** - * Search term edit page + * Search term edit page. * * @var CatalogSearchEdit */ protected $editPage; /** - * Inject pages + * Inject pages. * * @param CmsIndex $cmsIndex * @param CatalogSearchIndex $indexPage @@ -80,7 +76,7 @@ public function __inject( } /** - * Run edit search term test + * Run update search term test. * * @param CatalogSearchQuery $searchTerm * @return void diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml new file mode 100644 index 0000000000000..af1eb669e1f62 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml @@ -0,0 +1,24 @@ + + + + + + catalogProductSimple::sku + Main Website/Main Website Store/Default Store View + 1 + 20 + simple%isolation% + http://example.com/ + No + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php index 2802929c1069c..dcd021475a053 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php @@ -48,7 +48,7 @@ class Cart extends Block * * @var string */ - protected $updateShoppingCart = '[name="update_cart_action"]'; + protected $updateShoppingCart = '.update[name="update_cart_action"]'; /** * Cart empty block selector diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml index ebe516f24fa44..165315f753cb3 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml @@ -19,6 +19,6 @@ catalogProductSimple::default 0 - + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php index f5d30d2f9bdc2..b99ac46a7261d 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php @@ -85,6 +85,7 @@ public function __inject( */ public function test($originalProduct, $checkoutData) { + $this->markTestIncomplete('Bug: MAGETWO-34259'); // Preconditions: $product = $this->createProduct($originalProduct); $this->addToCart($product); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php index bd3f7381fb4ad..f30e937e0ace3 100755 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php @@ -15,9 +15,6 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Update ShoppingCart - * - * Test Flow: * Precondition: * 1. Simple product is created * 2. Clear shopping cart @@ -113,6 +110,7 @@ public function test(CatalogProductSimple $product) $productView->fillOptions($product); $productView->setQty(1); $productView->clickAddToCart(); + $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); $qty = $product->getCheckoutData()['qty']; $this->checkoutCart->open(); diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php index 9bcca39ddd4b5..f14298e28858e 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php @@ -16,7 +16,6 @@ use Magento\Mtf\ObjectManager; /** - * Class AssertTermAbsentOnCheckout * Check that Checkout Agreement is absent in the Place order tab. */ class AssertTermAbsentOnCheckout extends AbstractConstraint @@ -60,6 +59,8 @@ public function processAssert( $browser->open($_ENV['app_frontend_url'] . $product['products'][0]->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCartButton(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); + $checkoutCart->open(); $checkoutCart->getCartBlock()->getOnepageLinkBlock()->proceedToCheckout(); $checkoutOnepage->getLoginBlock()->guestCheckout(); $checkoutOnepage->getLoginBlock()->clickContinue(); diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml index e6462a16bf8d7..4a9a438e8460a 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml @@ -6,44 +6,48 @@ */ --> - - - DefaultName%isolation% - Enabled - Text - - default - - test_checkbox%isolation% - TestMessage%isolation% - - - - - - DefaultName%isolation% - - - TestMessage%isolation% - - - - - - test_checkbox%isolation% - - - Enabled - - - Text - - - + + + DefaultName%isolation% + Enabled + Text + + default + + test_checkbox%isolation% + TestMessage%isolation% + + + + + + DefaultName%isolation% + + + TestMessage%isolation% + + + + + + test_checkbox%isolation% + + + Enabled + + + Text + + + default - - + + diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php index 54db2bc5d2105..ca9dbfda8de6e 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php @@ -13,19 +13,15 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test creation for DeleteTermEntityTest. - * - * Test Flow: - * * Preconditions: - * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options - * 2. Create term according to dataSet + * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options. + * 2. Create term according to dataSet. * * Steps: - * 1. Open Backend Stores > Terms and Conditions - * 2. Open created Term from preconditions - * 3. Click on 'Delete' button - * 4. Perform all assertions + * 1. Open Backend Stores > Terms and Conditions. + * 2. Open created Term from preconditions. + * 3. Click on 'Delete' button. + * 4. Perform all assertions. * * @group Terms_and_Conditions_(CS) * @ZephyrId MAGETWO-29687 @@ -96,7 +92,7 @@ public function test(CheckoutAgreement $agreement) */ public function tearDown() { - ObjectManager::getInstance()->create( + $this->objectManager->create( 'Magento\Core\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition', 'rollback' => true] )->run(); diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..0c231f25d3f3f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ + + + + + + Stores > Terms and Conditions + Terms and Conditions + + + + diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php new file mode 100644 index 0000000000000..df52dfb3a70cb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php @@ -0,0 +1,66 @@ + [ + 'selector' => '#title', + ], + 'identifier' => [ + 'selector' => '#identifier', + ], + 'is_active' => [ + 'selector' => '#is_active', + 'input' => 'select', + ], + 'creation_time_from' => [ + 'selector' => '(//span[.="Created"]/following::input[contains(@placeholder,"From")])[1]', + 'strategy' => 'xpath', + ], + 'update_time_from' => [ + 'selector' => '(//span[.="Created"]/following::input[contains(@placeholder,"From")])[2]', + 'strategy' => 'xpath', + ], + 'store_id' => [ + 'selector' => 'label[for="store_id"] + div > select', + 'input' => 'selectstore' + ], + ]; + + /** + * Locator value for 'Search' button. + * + * @var string + */ + protected $searchButton = '.action-apply'; + + /** + * Locator value for 'Reset' button. + * + * @var string + */ + protected $resetButton = '.action-reset'; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'td[data-part="body.row.cell"]'; +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php new file mode 100644 index 0000000000000..4a09e7545f775 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php @@ -0,0 +1,85 @@ +_rootElement->find($this->addVariableButton); + if ($addVariableButton->isVisible()) { + $addVariableButton->click(); + } + } + + /** + * Get for wysiwyg config block. + * + * @return Config + */ + public function getWysiwygConfig() + { + return $this->blockFactory->create( + 'Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config', + ['element' => $this->_rootElement->find($this->customVariableBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Page Content Show/Hide Editor toggle button. + * + * @return void + */ + public function toggleEditor() + { + $content = $this->_rootElement->find($this->contentForm, Locator::SELECTOR_CSS); + $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php new file mode 100644 index 0000000000000..2f8d8f341a9b5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php @@ -0,0 +1,58 @@ +hideEditor(); + return parent::fill($fixture, $element); + } + + /** + * Hide WYSIWYG editor. + * + * @return void + */ + protected function hideEditor() + { + $content = $this->_rootElement->find($this->contentForm); + $toggleButton = $this->_rootElement->find($this->toggleButton); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml new file mode 100644 index 0000000000000..8fc957726181e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml @@ -0,0 +1,18 @@ + + + + + + [name="stores[]"] + multiselectgrouplist + + + select + + + diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php new file mode 100644 index 0000000000000..5338aaaead068 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php @@ -0,0 +1,61 @@ +_rootElement->find($this->contentForm, Locator::SELECTOR_CSS); + $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } + + /** + * Returns array with System Variables. + * + * @return array + */ + public function getSystemVariables() + { + $this->openTab('content'); + /** @var \Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab\Content $contentTab */ + $contentTab = $this->getTabElement('content'); + /** @var \Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config $config */ + $contentTab->clickInsertVariable(); + $config = $contentTab->getWysiwygConfig(); + + return $config->getAllVariables(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml new file mode 100644 index 0000000000000..454cd9e0f50c6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml @@ -0,0 +1,75 @@ + + + + + \Magento\Backend\Test\Block\Widget\Tab + #page_tabs_main_section + css selector + + + <identifier /> + <store_id> + <selector>[name='stores[]']</selector> + <input>multiselectgrouplist</input> + </store_id> + <is_active> + <input>select</input> + </is_active> + </fields> + </page_information> + <content> + <class>\Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab\Content</class> + <selector>#page_tabs_content_section</selector> + <strategy>css selector</strategy> + <fields> + <content_heading /> + <content /> + </fields> + </content> + <design> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#page_tabs_design_section</selector> + <strategy>css selector</strategy> + <fields> + <page_layout> + <input>select</input> + </page_layout> + <layout_update_xml> + <selector>#page_layout_update_xml</selector> + <input>textarea</input> + </layout_update_xml> + <custom_theme_from /> + <custom_theme_to /> + <custom_theme> + <input>select</input> + </custom_theme> + <custom_page_layout> + <input>select</input> + </custom_page_layout> + <custom_layout_update_xml> + <selector>#page_custom_layout_update_xml</selector> + <input>textarea</input> + </custom_layout_update_xml> + </fields> + </design> + <meta_data> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#page_tabs_meta_section</selector> + <strategy>css selector</strategy> + <fields> + <meta_keywords> + <selector>#page_meta_keywords</selector> + <input>textarea</input> + </meta_keywords> + <meta_description> + <selector>#page_meta_description</selector> + <input>textarea</input> + </meta_description> + </fields> + </meta_data> +</tabs> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php new file mode 100644 index 0000000000000..5ac929cb93770 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab; + +use Magento\Mtf\Client\Locator; +use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Widget\Test\Block\Adminhtml\WidgetForm; +use Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config; + +/** + * Backend cms page content tab. + */ +class Content extends Tab +{ + /** + * System Variable block selector. + * + * @var string + */ + protected $systemVariableBlock = "./ancestor::body//div[div[@id='variables-chooser']]"; + + /** + * Widget block selector. + * + * @var string + */ + protected $widgetBlock = "./ancestor::body/div[div/div/*[@id='widget_options_form']]"; + + /** + * Insert Variable button selector. + * + * @var string + */ + protected $addVariableButton = ".add-variable"; + + /** + * Insert Widget button selector. + * + * @var string + */ + protected $addWidgetButton = '.action-add-widget'; + + /** + * Content input locator. + * + * @var string + */ + protected $content = '#page_content'; + + /** + * Content Heading input locator. + * + * @var string + */ + protected $contentHeading = '#page_content_heading'; + + /** + * Clicking in content tab 'Insert Variable' button. + * + * @return void + */ + public function clickInsertVariable() + { + $addVariableButton = $this->_rootElement->find($this->addVariableButton); + if ($addVariableButton->isVisible()) { + $addVariableButton->click(); + } + } + + /** + * Clicking in content tab 'Insert Widget' button. + * + * @return void + */ + public function clickInsertWidget() + { + $addWidgetButton = $this->_rootElement->find($this->addWidgetButton); + if ($addWidgetButton->isVisible()) { + $addWidgetButton->click(); + } + } + + /** + * Get for wysiwyg config block. + * + * @return Config + */ + public function getWysiwygConfig() + { + return $this->blockFactory->create( + 'Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config', + ['element' => $this->_rootElement->find($this->systemVariableBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Get widget block. + * + * @return WidgetForm + */ + public function getWidgetBlock() + { + return $this->blockFactory->create( + 'Magento\Widget\Test\Block\Adminhtml\WidgetForm', + ['element' => $this->_rootElement->find($this->widgetBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Fill data to content fields on content tab. + * + * @param array $fields + * @param SimpleElement|null $element + * @return $this + */ + public function fillFormTab(array $fields, SimpleElement $element = null) + { + $element->find($this->content)->setValue($fields['content']['value']['content']); + if (isset($fields['content_heading']['value'])) { + $element->find($this->contentHeading)->setValue($fields['content_heading']['value']); + } + if (isset($fields['content']['value']['widget']['preset'])) { + foreach ($fields['content']['value']['widget']['preset'] as $widget) { + $this->clickInsertWidget(); + $this->getWidgetBlock()->addWidget($widget); + } + } + if (isset($fields['content']['value']['variable'])) { + $this->clickInsertVariable(); + $config = $this->getWysiwygConfig(); + $config->selectVariableByName($fields['content']['value']['variable']); + } + + return $this; + } + + /** + * Get data of content tab. + * + * @param array|null $fields + * @param SimpleElement|null $element + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getDataFormTab($fields = null, SimpleElement $element = null) + { + return [ + 'content' => [], + 'content_heading' => '' + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php new file mode 100644 index 0000000000000..b58dfde4c16cb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page; + +use Magento\Backend\Test\Block\Widget\Grid as ParentGrid; +use Magento\Mtf\Client\Locator; + +/** + * Backend Cms Page grid. + */ +class Grid extends ParentGrid +{ + /** + * Locator value for 'Search' button. + * + * @var string + */ + protected $searchButton = '.action.primary.action-apply'; + + /** + * Locator value for 'Reset' button. + * + * @var string + */ + protected $resetButton = '.action.secondary.action-reset'; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'td[data-part="body.row.cell"]'; + + /** + * 'Preview' cms page link. + * + * @var string + */ + protected $previewCmsPage = "//a[contains(text(),'Preview')]"; + + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'title' => [ + 'selector' => '#title', + ], + ]; + + /** + * Search item and open it on front. + * + * @param array $filter + * @throws \Exception + * @return void + */ + public function searchAndPreview(array $filter) + { + $this->search($filter); + $rowItem = $this->_rootElement->find($this->rowItem); + if ($rowItem->isVisible()) { + $rowItem->find($this->previewCmsPage, Locator::SELECTOR_XPATH)->click(); + $this->waitForElement(); + } else { + throw new \Exception('Searched item was not found.'); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php new file mode 100644 index 0000000000000..a71f9e953f857 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page\Widget; + +use Magento\Backend\Test\Block\Widget\Grid; + +/** + * Backend select page, block grid. + */ +class Chooser extends Grid +{ + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'chooser_identifier' => [ + 'selector' => 'input[name="chooser_identifier"]', + ], + ]; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'tbody tr .col-chooser_title'; +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php new file mode 100644 index 0000000000000..8b73955af2298 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Wysiwyg; + +use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; + +/** + * System variable management block. + */ +class Config extends Block +{ + /** + * Selector for getting all variables in list. + * + * @var string + */ + protected $variablesSelector = '.insert-variable > li > a'; + + /** + * Variable link selector. + * + * @var string + */ + protected $variableSelector = '//*[@class="insert-variable"]//a[contains(text(),"%s")]'; + + /** + * Returns array with all variables. + * + * @return array + */ + public function getAllVariables() + { + $values = []; + + $variableElements = $this->_rootElement->getElements($this->variablesSelector); + foreach ($variableElements as $variableElement) { + if ($variableElement->isVisible()) { + $values[] = $variableElement->getText(); + } + } + + return $values; + } + + /** + * Select variable by name. + * + * @param string $variableName + * @return void + */ + public function selectVariableByName($variableName) + { + $this->_rootElement->find(sprintf($this->variableSelector, $variableName), Locator::SELECTOR_XPATH)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php index 7589ec398662e..69b0d9aa409c6 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php @@ -14,6 +14,13 @@ */ class Page extends Block { + /** + * Selector for uninitialized page. + * + * @var string + */ + protected $uninitialized = '//body[(@data-mage-init) or (@aria-busy="true")]'; + /** * Cms page content class. * @@ -107,4 +114,21 @@ public function isWidgetVisible($widgetType, $widgetText) throw new \Exception('Determine how to find the widget on the page.'); } } + + /** + * Waiting page initialization. + * + * @return void + */ + public function waitPageInit() + { + $browser = $this->browser; + $uninitialized = $this->uninitialized; + + $this->_rootElement->waitUntil( + function () use ($browser, $uninitialized) { + return $browser->find($uninitialized, Locator::SELECTOR_XPATH)->isVisible() == false ? true : null; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php new file mode 100644 index 0000000000000..36d25d1c49f55 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after delete CMS block successful message appears. + */ +class AssertCmsBlockDeleteMessage extends AbstractConstraint +{ + const SUCCESS_DELETE_MESSAGE = 'The block has been deleted.'; + + /** + * Assert that after delete CMS block successful message appears. + * + * @param CmsBlockIndex $cmsBlockIndex + * @return void + */ + public function processAssert(CmsBlockIndex $cmsBlockIndex) + { + $actualMessage = $cmsBlockIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php new file mode 100644 index 0000000000000..539882b47a497 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS block can be found in grid. + */ +class AssertCmsBlockInGrid extends AbstractConstraint +{ + /** + * Assert that created CMS block can be found in grid via: + * title, identifier, store view, status, created and modified date. + * + * @param CmsBlock $cmsBlock + * @param CmsBlockIndex $cmsBlockIndex + * @return void + * + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex) + { + $cmsBlockIndex->open(); + $data = $cmsBlock->getData(); + $filter = [ + 'title' => $data['title'], + 'identifier' => $data['identifier'], + 'is_active' => $data['is_active'], + ]; + + if (isset($data['stores'])) { + $filter['store_id'] = is_array($data['stores']) ? reset($data['stores']) : $data['stores']; + } + // add creation_time & update_time to filter if there are ones + if (isset($data['creation_time'])) { + $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime())); + } + if (isset($data['update_time'])) { + $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime())); + } + + $cmsBlockIndex->getCmsBlockGrid()->search($filter); + + if (isset($filter['store_id'])) { + $pieces = explode('/', $filter['store_id']); + $filter['store_id'] = end($pieces); + } + \PHPUnit_Framework_Assert::assertTrue( + $cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, false, false), + 'CMS Block with ' + . 'title \'' . $filter['title'] . '\', ' + . 'identifier \'' . $filter['identifier'] . '\', ' + . 'store view \'' . $filter['store_id'] . '\', ' + . 'status \'' . $filter['is_active'] . '\', ' + . (isset($filter['creation_time_from']) + ? ('creation_time \'' . $filter['creation_time_from'] . '\', ') + : '') + . (isset($filter['update_time_from']) ? ('update_time \'' . $filter['update_time_from'] . '\'') : '') + . 'is absent in CMS Block grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block is present in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php new file mode 100644 index 0000000000000..ad3ce5daef521 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS block can't be found in grid. + */ +class AssertCmsBlockNotInGrid extends AbstractConstraint +{ + /** + * Assert that created CMS block can't be found in grid via: + * title, identifier, store view, status, created and modified date + * + * @param CmsBlock $cmsBlock + * @param CmsBlockIndex $cmsBlockIndex + * @return void + * + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex) + { + $cmsBlockIndex->open(); + $data = $cmsBlock->getData(); + if (isset($data['stores'])) { + $storeId = is_array($data['stores']) ? reset($data['stores']) : $data['stores']; + $parts = explode("/", $storeId); + } + + $filter = [ + 'title' => $data['title'], + 'identifier' => $data['identifier'], + 'is_active' => $data['is_active'], + 'store_id' => end($parts), + ]; + + // add creation_time & update_time to filter if there are ones + if (isset($data['creation_time'])) { + $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime())); + } + if (isset($data['update_time'])) { + $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime())); + } + + \PHPUnit_Framework_Assert::assertFalse( + $cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, true, false), + 'CMS Block with ' + . 'title \'' . $filter['title'] . '\', ' + . 'identifier \'' . $filter['identifier'] . '\', ' + . 'store view \'' . $filter['store_id'] . '\', ' + . 'status \'' . $filter['is_active'] . '\', ' + . (isset($filter['creation_time_from']) + ? ('creation_time \'' . $filter['creation_time_from'] . '\', ') + : '') + . (isset($filter['update_time_from']) ? ('update_time \'' . $filter['update_time_from'] . '\'') : '') + . 'exists in CMS Block grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block is not present in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php new file mode 100644 index 0000000000000..96eeb2aa0d04f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureFactory; + +/** + * Assert that created CMS block non visible on frontend category page. + */ +class AssertCmsBlockNotOnCategoryPage extends AbstractConstraint +{ + /** + * Assert that created CMS block non visible on frontend category page + * (in order to assign block to category: go to category page> Display settings> CMS Block) + * + * @param CmsIndex $cmsIndex + * @param CmsBlock $cmsBlock + * @param CatalogCategoryView $catalogCategoryView + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CmsBlock $cmsBlock, + CatalogCategoryView $catalogCategoryView, + FixtureFactory $fixtureFactory + ) { + $category = $fixtureFactory->createByCode( + 'category', + [ + 'dataSet' => 'default_subcategory', + 'data' => [ + 'display_mode' => 'Static block and products', + 'landing_page' => $cmsBlock->getTitle(), + ] + ] + ); + $category->persist(); + + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($category->getName()); + $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent(); + + \PHPUnit_Framework_Assert::assertNotEquals( + $cmsBlock->getContent(), + $categoryViewContent, + 'Wrong block content on category is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS block description is absent on Category page (frontend).'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php new file mode 100644 index 0000000000000..2cc8650a1f924 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureFactory; + +/** + * Assert that created CMS block displayed on frontend category page. + */ +class AssertCmsBlockOnCategoryPage extends AbstractConstraint +{ + /** + * Assert that created CMS block displayed on frontend category page (in order to assign block to category: + * go to category page> Display settings> CMS Block). + * + * @param CmsIndex $cmsIndex + * @param CmsBlock $cmsBlock + * @param CatalogCategoryView $catalogCategoryView + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CmsBlock $cmsBlock, + CatalogCategoryView $catalogCategoryView, + FixtureFactory $fixtureFactory + ) { + $category = $fixtureFactory->createByCode( + 'category', + [ + 'dataSet' => 'default_subcategory', + 'data' => [ + 'display_mode' => 'Static block and products', + 'landing_page' => $cmsBlock->getTitle(), + ] + ] + ); + $category->persist(); + + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($category->getName()); + $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent(); + + \PHPUnit_Framework_Assert::assertEquals( + $cmsBlock->getContent(), + $categoryViewContent, + 'Wrong block content on category is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS block description is present on Category page (frontend).'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php new file mode 100644 index 0000000000000..615c4b06fb44a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after save block successful message appears. + */ +class AssertCmsBlockSuccessSaveMessage extends AbstractConstraint +{ + const SUCCESS_SAVE_MESSAGE = 'The block has been saved.'; + + /** + * Assert that after save block successful message appears. + * + * @param CmsBlockIndex $cmsBlockIndex + * @return void + */ + public function processAssert(CmsBlockIndex $cmsBlockIndex) + { + $actualMessage = $cmsBlockIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_SAVE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_SAVE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block success create message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php new file mode 100644 index 0000000000000..ff01fa41f99e1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert success delete message. + */ +class AssertCmsPageDeleteMessage extends AbstractConstraint +{ + const SUCCESS_DELETE_MESSAGE = 'The page has been deleted.'; + + /** + * Assert that success message is displayed after Cms page delete. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $actualMessage = $cmsIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php new file mode 100644 index 0000000000000..98d8fbaecd074 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\CmsIndex as FrontCmsIndex; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. + */ +class AssertCmsPageDisabledOnFrontend extends AbstractConstraint +{ + const NOT_FOUND_MESSAGE = 'Whoops, our bad...'; + + /** + * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. + * + * @param CmsPage $cms + * @param FrontCmsIndex $frontCmsIndex + * @param CmsPageIndex $cmsIndex + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + CmsPage $cms, + FrontCmsIndex $frontCmsIndex, + CmsPageIndex $cmsIndex, + BrowserInterface $browser + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); + $browser->selectWindow(); + \PHPUnit_Framework_Assert::assertEquals( + self::NOT_FOUND_MESSAGE, + $frontCmsIndex->getTitleBlock()->getTitle(), + 'Wrong page is displayed.' + ); + } + + /** + * Not found page is display. + * + * @return string + */ + public function toString() + { + return 'Not found page is display.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php new file mode 100644 index 0000000000000..97e5247f658a8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Verify that page has not been created. + */ +class AssertCmsPageDuplicateErrorMessage extends AbstractConstraint +{ + const ERROR_SAVE_MESSAGE = 'A page URL key for specified store already exists.'; + + /** + * Verify that page has not been created. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $message = $cmsIndex->getMessagesBlock()->getErrorMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::ERROR_SAVE_MESSAGE, + $message, + 'Wrong error message is displayed.' + . "\nExpected: " . self::ERROR_SAVE_MESSAGE + . "\nActual: " . $message + ); + } + + /** + * Page with duplicated identifier has not been created. + * + * @return string + */ + public function toString() + { + return 'Assert that page with duplicated identifier has not been created.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php new file mode 100644 index 0000000000000..7edf213e1d208 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\Constraint\AbstractAssertForm; + +/** + * Assert that displayed CMS page data on edit page equals passed from fixture. + */ +class AssertCmsPageForm extends AbstractAssertForm +{ + /** + * Skipped fields for verify data. + * + * @var array + */ + protected $skippedFields = [ + 'page_id', + 'content', + 'content_heading', + 'custom_theme_from', + 'custom_theme_to', + ]; + + /** + * Assert that displayed CMS page data on edit page equals passed from fixture. + * + * @param CmsPage $cms + * @param CmsPageIndex $cmsIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function processAssert( + CmsPage $cms, + CmsPageIndex $cmsIndex, + CmsPageNew $cmsPageNew + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndOpen($filter); + + $cmsFormData = $cmsPageNew->getPageForm()->getData($cms); + $cmsFormData['store_id'] = implode('/', $cmsFormData['store_id']); + $errors = $this->verifyData($cms->getData(), $cmsFormData); + \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + } + + /** + * CMS page data on edit page equals data from fixture. + * + * @return string + */ + public function toString() + { + return 'CMS page data on edit page equals data from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php new file mode 100644 index 0000000000000..650151b1db998 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that CMS page present in grid and can be found by title. + */ +class AssertCmsPageInGrid extends AbstractConstraint +{ + /** + * Assert that cms page is present in pages grid. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPage $cms + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cms) + { + $filter = [ + 'title' => $cms->getTitle(), + ]; + $cmsIndex->open(); + \PHPUnit_Framework_Assert::assertTrue( + $cmsIndex->getCmsPageGridBlock()->isRowVisible($filter, true, false), + 'Cms page \'' . $cms->getTitle() . '\' is not present in pages grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page is present in pages grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php new file mode 100644 index 0000000000000..f781faec06d96 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert Cms page is absent in grid. + */ +class AssertCmsPageNotInGrid extends AbstractConstraint +{ + /** + * Assert that Cms page is not present in pages grid. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPage $cmsPage + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage) + { + $filter = [ + 'title' => $cmsPage->getTitle(), + ]; + \PHPUnit_Framework_Assert::assertFalse( + $cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), + 'Cms page \'' . $cmsPage->getTitle() . '\' is present in pages grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page is not present in pages grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php new file mode 100644 index 0000000000000..2f8203b640e6c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\CmsIndex as FrontCmsIndex; +use Magento\Cms\Test\Page\CmsPage as FrontCmsPage; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. + */ +class AssertCmsPagePreview extends AbstractConstraint +{ + /* tags */ + const SEVERITY = 'low'; + /* end tags */ + + /** + * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. + * + * @param CmsPageIndex $cmsIndex + * @param FrontCmsIndex $frontCmsIndex + * @param FrontCmsPage $frontCmsPage + * @param CmsPage $cms + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + CmsPageIndex $cmsIndex, + FrontCmsIndex $frontCmsIndex, + FrontCmsPage $frontCmsPage, + CmsPage $cms, + BrowserInterface $browser + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); + $browser->selectWindow(); + + $fixtureContent = $cms->getContent(); + \PHPUnit_Framework_Assert::assertContains( + $fixtureContent['content'], + $frontCmsPage->getCmsPageBlock()->getPageContent(), + 'Wrong content is displayed.' + ); + if (isset($fixtureContent['widget'])) { + foreach ($fixtureContent['widget']['preset'] as $widget) { + \PHPUnit_Framework_Assert::assertTrue( + $frontCmsPage->getCmsPageBlock()->isWidgetVisible($widget['widget_type'], $widget['anchor_text']), + 'Widget \'' . $widget['widget_type'] . '\' is not displayed.' + ); + } + } + if ($cms->getContentHeading()) { + \PHPUnit_Framework_Assert::assertEquals( + $cms->getContentHeading(), + $frontCmsIndex->getTitleBlock()->getTitle(), + 'Wrong title is displayed.' + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Page content equals to data from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php new file mode 100644 index 0000000000000..e047e5de15ac0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after save a CMS page "The page has been saved." successful message appears. + */ +class AssertCmsPageSuccessSaveMessage extends AbstractConstraint +{ + const SUCCESS_SAVE_MESSAGE = 'The page has been saved.'; + + /** + * Assert that after save a CMS page "The page has been saved." successful message appears. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $actualMessage = $cmsIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_SAVE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_SAVE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Success message is displayed. + * + * @return string + */ + public function toString() + { + return 'Success message is displayed.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php new file mode 100644 index 0000000000000..b237391de4237 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\Core\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS Page URL Rewrite lead to appropriate page in frontend. + */ +class AssertUrlRewriteCmsPageRedirect extends AbstractConstraint +{ + /** + * Assert that created CMS Page URL Rewrite lead to appropriate page in frontend. + * + * @param UrlRewrite $urlRewrite + * @param CmsPage $cmsPage + * @param SystemVariableNew $systemVariableNew + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + UrlRewrite $urlRewrite, + CmsPage $cmsPage, + SystemVariableNew $systemVariableNew, + BrowserInterface $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath()); + if ($urlRewrite->hasData('store_id')) { + $store = explode('/', $urlRewrite->getStoreId()); + $systemVariableNew->getFormPageActions()->selectStoreView($store[2]); + } + $url = $urlRewrite->getRedirectType() == 'No' + ? $urlRewrite->getRequestPath() + : $cmsPage->getTitle(); + + \PHPUnit_Framework_Assert::assertEquals( + $_ENV['app_frontend_url'] . $url, + $browser->getUrl(), + 'URL rewrite CMS Page redirect false.' + ); + } + + /** + * URL Rewrite lead to appropriate page in frontend. + * + * @return string + */ + public function toString() + { + return 'URL Rewrite lead to appropriate page in frontend.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml new file mode 100644 index 0000000000000..36bb9cf39af04 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="cmsBlock" module="Magento_Cms" type="flat" entity_type="cms_block" collection="Magento\Cms\Model\Resource\Block\Grid\Collection" identifier="identifier" + handler_interface="Magento\Cms\Test\Handler\CmsBlock\CmsBlockInterface" class="Magento\Cms\Test\Fixture\CmsBlock"> + <dataset name="default"> + <field name="title" xsi:type="string">block_%isolation%</field> + <field name="identifier" xsi:type="string">identifier_%isolation%</field> + <field name="stores" xsi:type="array"> + <item name="dataSet" xsi:type="string">All Store Views</item> + </field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="string">description_%isolation%</field> + </dataset> + <field name="block_id" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="title" is_required=""> + <default_value xsi:type="string">block_%isolation%</default_value> + </field> + <field name="identifier" is_required=""> + <default_value xsi:type="string">identifier_%isolation%</default_value> + </field> + <field name="content" is_required=""> + <default_value xsi:type="string">description_%isolation%</default_value> + </field> + <field name="creation_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="update_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="is_active" is_required=""> + <default_value xsi:type="string">Enabled</default_value> + </field> + <field name="stores" is_required="1" source="Magento\Cms\Test\Fixture\CmsBlock\Stores"> + <default_value xsi:type="array"> + <item name="dataSet" xsi:type="array"> + <item name="0" xsi:type="string">All Store Views</item> + </item> + </default_value> + </field> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php new file mode 100644 index 0000000000000..4622537127e7f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php @@ -0,0 +1,110 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Fixture\CmsBlock; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Data source for 'stores' field. + * + * Data keys: + * - dataSet + */ +class Stores implements FixtureInterface +{ + /** + * Array with store names. + * + * @var array + */ + protected $data = []; + + /** + * Array with store fixtures. + * + * @var array + */ + protected $stores; + + /** + * Data set configuration settings. + * + * @var array + */ + protected $params; + + /** + * Create custom Store if we have block with custom store view. + * + * @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'])) { + $dataSets = is_array($data['dataSet']) ? $data['dataSet'] : [$data['dataSet']]; + foreach ($dataSets as $dataSet) { + /** @var \Magento\Store\Test\Fixture\Store $store */ + $store = $fixtureFactory->createByCode('store', ['dataSet' => $dataSet]); + if (!$store->hasData('store_id')) { + $store->persist(); + } + $this->stores[] = $store; + $this->data[] = $store->getName() == 'All Store Views' + ? $store->getName() + : $store->getGroupId() . '/' . $store->getName(); + } + } + } + + /** + * Persist custom selections store view. + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set. + * + * @param string|null $key [optional] + * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return stores. + * + * @return array + */ + public function getStores() + { + return $this->stores; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml new file mode 100644 index 0000000000000..149bef091c831 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="cmsPage" module="Magento_Cms" type="flat" entity_type="cms_page" collection="Magento\Cms\Model\Resource\Page\Grid\Collection" identifier="identifier" + repository_class="Magento\Cms\Test\Repository\CmsPage" handler_interface="Magento\Cms\Test\Handler\CmsPage\CmsPageInterface" class="Magento\Cms\Test\Fixture\CmsPage"> + <dataset name="default"> + <field name="title" xsi:type="string">CMS Page%isolation%</field> + <field name="identifier" xsi:type="string">identifier%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_actice" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">description_%isolation%</item> + </field> + </dataset> + <field name="page_id" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="title" is_required="" group="page_information"> + <default_value xsi:type="null" /> + </field> + <field name="is_active" is_required="" group="page_information"> + <default_value xsi:type="string">Enabled</default_value> + </field> + <field name="page_layout" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="meta_keywords" is_required="" group="meta_data"> + <default_value xsi:type="null" /> + </field> + <field name="meta_description" is_required="" group="meta_data"> + <default_value xsi:type="null" /> + </field> + <field name="identifier" group="page_information" is_required=""> + <default_value xsi:type="string">identifier%isolation%</default_value> + </field> + <field name="content_heading" is_required="" group="content"> + <default_value xsi:type="null" /> + </field> + <field name="content" is_required="" group="content" source="Magento\Cms\Test\Fixture\CmsPage\Content"> + <default_value xsi:type="array"> + <item name="content" xsi:type="string">Text %isolation%</item> + </default_value> + </field> + <field name="creation_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="update_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="layout_update_xml" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_theme" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_page_layout" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_layout_update_xml" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_theme_from" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="custom_theme_to" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="website_root" is_required=""> + <default_value xsi:type="string">1</default_value> + </field> + <field name="store_id" is_required="1" group="page_information"> + <default_value xsi:type="string">All Store Views</default_value> + </field> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php new file mode 100644 index 0000000000000..fc3d5f72bf9c2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php @@ -0,0 +1,250 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Fixture\CmsPage; + +use Magento\Catalog\Test\Fixture\Category; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Prepare content for cms page. + */ +class Content implements FixtureInterface +{ + /** + * Content data. + * + * @var array + */ + protected $data = []; + + /** + * Fixture params. + * + * @var array + */ + protected $params; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * @constructor + * @param array $params + * @param array $data + * @param FixtureFactory $fixtureFactory + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->fixtureFactory = $fixtureFactory; + $this->params = $params; + $this->data = $data; + if (isset($data['widget']['preset'])) { + $this->data['widget']['preset'] = $this->getPreset($data['widget']['preset']); + foreach ($this->data['widget']['preset'] as $key => $widget) { + if (isset($widget['chosen_option']['category_path']) + && !isset($widget['chosen_option']['filter_sku']) + ) { + $category = $this->createCategory($widget); + $categoryName = $category->getData('name'); + $this->data['widget']['preset'][$key]['chosen_option']['category_path'] = $categoryName; + } + if (isset($widget['chosen_option']['category_path']) && isset($widget['chosen_option']['filter_sku'])) { + $product = $this->createProduct($widget); + $categoryName = $product->getCategoryIds()[0]['name']; + $productSku = $product->getData('sku'); + $this->data['widget']['preset'][$key]['chosen_option']['category_path'] = $categoryName; + $this->data['widget']['preset'][$key]['chosen_option']['filter_sku'] = $productSku; + } + if ($widget['widget_type'] == 'Catalog New Products List') { + $this->createProduct(); + } + if ($widget['widget_type'] == 'CMS Static Block') { + $block = $this->createBlock($widget); + $blockIdentifier = $block->getIdentifier(); + $this->data['widget']['preset'][$key]['chosen_option']['filter_identifier'] = $blockIdentifier; + } + } + } + } + + /** + * Create category. + * + * @param array $widget + * @return Category + */ + protected function createCategory($widget) + { + /** @var Category $category */ + $category = $this->fixtureFactory->createByCode( + 'category', + ['dataSet' => $widget['chosen_option']['category_path']] + ); + if (!$category->hasData('id')) { + $category->persist(); + } + + return $category; + } + + /** + * Create product. + * + * @param array|null $widget [optional] + * @return CatalogProductSimple + */ + protected function createProduct($widget = null) + { + $dataSet = $widget === null ? 'default' : $widget['chosen_option']['category_path']; + /** @var CatalogProductSimple $product */ + $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => $dataSet]); + if (!$product->hasData('id')) { + $product->persist(); + } + + return $product; + } + + /** + * Create block. + * + * @param array $widget + * @return CmsBlock + */ + protected function createBlock($widget) + { + /** @var CmsBlock $block */ + $block = $this->fixtureFactory->createByCode($widget['chosen_option']['filter_identifier']); + if (!$block->hasData('block_id')) { + $block->persist(); + } + + return $block; + } + + /** + * Persist attribute options. + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set. + * + * @param string|null $key + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } + + /** + * Preset for Widgets. + * + * @param string $name + * @return array|null + */ + protected function getPreset($name) + { + $presets = [ + 'default' => [ + 'widget_1' => [ + 'widget_type' => 'CMS Page Link', + 'anchor_text' => 'CMS Page Link anchor_text_%isolation%', + 'title' => 'CMS Page Link anchor_title_%isolation%', + 'template' => 'CMS Page Link Block Template', + 'chosen_option' => [ + 'filter_url_key' => 'home', + ], + ], + ], + 'all_widgets' => [ + 'widget_1' => [ + 'widget_type' => 'CMS Page Link', + 'anchor_text' => 'CMS Page Link anchor_text_%isolation%', + 'title' => 'CMS Page Link anchor_title_%isolation%', + 'template' => 'CMS Page Link Block Template', + 'chosen_option' => [ + 'filter_url_key' => 'home', + ], + ], + 'widget_2' => [ + 'widget_type' => 'CMS Static Block', + 'template' => 'CMS Static Block Default Template', + 'chosen_option' => [ + 'filter_identifier' => 'cmsBlock', + ], + ], + 'widget_3' => [ + 'widget_type' => 'Catalog Category Link', + 'anchor_text' => 'Catalog Category Link anchor_text_%isolation%', + 'title' => 'Catalog Category Link anchor_title_%isolation%', + 'template' => 'Category Link Block Template', + 'chosen_option' => [ + 'category_path' => 'default_subcategory', + ], + ], + 'widget_4' => [ + 'widget_type' => 'Catalog New Products List', + 'display_type' => 'All products', + 'show_pager' => 'Yes', + 'products_count' => 10, + 'template' => 'New Products Grid Template', + 'cache_lifetime' => 86400, + ], + 'widget_5' => [ + 'widget_type' => 'Catalog Product Link', + 'anchor_text' => 'Catalog Product Link anchor_text_%isolation%', + 'title' => 'Catalog Product Link anchor_title_%isolation%', + 'template' => 'Product Link Block Template', + 'chosen_option' => [ + 'category_path' => 'product_with_category', + 'filter_sku' => 'product_with_category', + ], + ], + 'widget_6' => [ + 'widget_type' => 'Recently Compared Products', + 'page_size' => 10, + 'template' => 'Compared Products Grid Template', + ], + 'widget_7' => [ + 'widget_type' => 'Recently Viewed Products', + 'page_size' => 10, + 'template' => 'Viewed Products Grid Template', + ], + ], + ]; + if (!isset($presets[$name])) { + return null; + } + return $presets[$name]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php index 7e76b450a61a2..c3aefd941fc29 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php @@ -14,20 +14,19 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating CMS Block + * Curl handler for creating CMS Block. */ class Curl extends AbstractCurl implements CmsBlockInterface { /** - * Url for saving data + * Url for saving data. * * @var string */ protected $saveUrl = 'cms/block/save/back/edit'; /** - * Mapping values for data + * Mapping values for data. * * @var array */ @@ -39,7 +38,7 @@ class Curl extends AbstractCurl implements CmsBlockInterface ]; /** - * Mapping values for Stores + * Mapping values for Stores. * * @var array */ @@ -48,7 +47,7 @@ class Curl extends AbstractCurl implements CmsBlockInterface ]; /** - * POST request for creating CMS Block + * POST request for creating CMS Block. * * @param FixtureInterface|null $fixture [optional] * @return array @@ -73,7 +72,7 @@ public function persist(FixtureInterface $fixture = null) } /** - * Prepare data from text to values + * Prepare data from text to values. * * @param FixtureInterface $fixture * @return array diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php index 6e1f950470302..4187350d28d7a 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php @@ -14,8 +14,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating Cms page + * Curl handler for creating Cms page. */ class Curl extends Conditions implements CmsPageInterface { @@ -26,7 +25,7 @@ class Curl extends Conditions implements CmsPageInterface */ protected $mappingData = [ 'is_active' => [ - 'Published' => 1, + 'Enabled' => 1, 'Disabled' => 0, ], 'store_id' => [ @@ -37,22 +36,35 @@ class Curl extends Conditions implements CmsPageInterface '2 columns with left bar' => '2columns-left', '2 columns with right bar' => '2columns-right', '3 columns' => '3columns', - ], - 'under_version_control' => [ - 'Yes' => 1, - 'No' => 0, - ], + ] ]; /** - * Url for save cms page + * Url for save cms page. * * @var string */ - protected $url = 'admin/cms_page/save/back/edit/active_tab/main_section/'; + protected $url = 'cms/page/save/back/edit/active_tab/main_section/'; + + /** + * Mapping values for data. + * + * @var array + */ + protected $additionalMappingData = []; + + /** + * @constructor + * @param Config $configuration + */ + public function __construct(Config $configuration) + { + $this->mappingData = array_merge($this->mappingData, $this->additionalMappingData); + parent::__construct($configuration); + } /** - * Post request for creating a cms page + * Post request for creating a cms page. * * @param FixtureInterface $fixture * @return array @@ -77,7 +89,7 @@ public function persist(FixtureInterface $fixture = null) } /** - * Prepare data + * Prepare data. * * @param array $data * @return array diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml new file mode 100644 index 0000000000000..2aa384eef89c8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockEdit" area="Adminhtml" mca="cms/block/edit" module="Magento_Cms"> + <block name="blockForm" class="Magento\Cms\Test\Block\Adminhtml\Block\Edit\BlockForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml new file mode 100644 index 0000000000000..f9b2d8c51e95c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockIndex" area="Adminhtml" mca="cms/block" module="Magento_Cms"> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsBlockGrid" class="Magento\Cms\Test\Block\Adminhtml\Block\CmsGrid" locator=".grid" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml new file mode 100644 index 0000000000000..65693e9a94246 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockNew" area="Adminhtml" mca="cms/block/new" module="Magento_Cms"> + <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsForm" class="Magento\Cms\Test\Block\Adminhtml\Block\Edit\CmsForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml new file mode 100644 index 0000000000000..d622c917217dc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsPageIndex" area="Adminhtml" mca="cms/page/index" module="Magento_Cms"> + <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsPageGridBlock" class="Magento\Cms\Test\Block\Adminhtml\Page\Grid" locator=".grid" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages .message" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml new file mode 100644 index 0000000000000..252dc039121b9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsPageNew" area="Adminhtml" mca="cms/page/new" module="Magento_Cms"> + <block name="pageForm" class="Magento\Cms\Test\Block\Adminhtml\Page\Edit\PageForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml index 661f784c0a33d..066779eb08b95 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml @@ -6,17 +6,17 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CmsIndex" mca="cms/index/index" module="Magento_Cms"> - <block name="searchBlock" class="Magento\Catalog\Test\Block\Search" locator="#search_mini_form" strategy="css selector"/> - <block name="topmenu" class="Magento\Theme\Test\Block\Html\Topmenu" locator="[role='navigation']" strategy="css selector"/> - <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector"/> - <block name="footerBlock" class="Magento\Theme\Test\Block\Html\Footer" locator="footer.page-footer" strategy="css selector"/> - <block name="linksBlock" class="Magento\Theme\Test\Block\Links" locator=".header .links" strategy="css selector"/> - <block name="storeSwitcherBlock" class="Magento\Store\Test\Block\Switcher" locator="[data-ui-id='language-switcher']" strategy="css selector"/> - <block name="cartSidebarBlock" class="Magento\Checkout\Test\Block\Cart\Sidebar" locator="[data-block='minicart']" strategy="css selector"/> - <block name="compareProductsBlock" class="Magento\Catalog\Test\Block\Product\Compare\Sidebar" locator=".sidebar.sidebar-additional" strategy="css selector"/> - <block name="currencyBlock" class="Magento\Directory\Test\Block\Currency\Switcher" locator=".switcher.currency" strategy="css selector"/> - <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector"/> - <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> - </page> + <page name="CmsIndex" mca="cms/index/index" module="Magento_Cms"> + <block name="searchBlock" class="Magento\Catalog\Test\Block\Search" locator="#search_mini_form" strategy="css selector" /> + <block name="topmenu" class="Magento\Theme\Test\Block\Html\Topmenu" locator="[role='navigation']" strategy="css selector" /> + <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector" /> + <block name="footerBlock" class="Magento\Theme\Test\Block\Html\Footer" locator="footer.page-footer" strategy="css selector" /> + <block name="linksBlock" class="Magento\Theme\Test\Block\Links" locator=".header .links" strategy="css selector" /> + <block name="storeSwitcherBlock" class="Magento\Store\Test\Block\Switcher" locator="[data-ui-id='language-switcher']" strategy="css selector" /> + <block name="cartSidebarBlock" class="Magento\Checkout\Test\Block\Cart\Sidebar" locator="[data-block='minicart']" strategy="css selector" /> + <block name="compareProductsBlock" class="Magento\Catalog\Test\Block\Product\Compare\Sidebar" locator=".sidebar.sidebar-additional" strategy="css selector" /> + <block name="currencyBlock" class="Magento\Directory\Test\Block\Currency\Switcher" locator=".switcher.currency" strategy="css selector" /> + <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector" /> + <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml index 1bbb59d71184e..f251d89bdbbfd 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CmsPage" mca="cms/page" module="Magento_Cms"> - <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector"/> - </page> + <page name="CmsPage" mca="cms/page" module="Magento_Cms"> + <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector" /> + </page> </config> 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 new file mode 100644 index 0000000000000..81f9f676fe986 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Cms\Test\Repository\CmsBlock"> + <dataset name="default"> + <field name="title" xsi:type="string">block_%isolation%</field> + <field name="identifier" xsi:type="string">identifier_%isolation%</field> + <field name="stores" xsi:type="array"> + <item name="dataSet" xsi:type="array"> + <item name="0" xsi:type="string">All Store Views</item> + </item> + </field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="string">description_%isolation%</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml new file mode 100644 index 0000000000000..46f5e119b6e77 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Cms\Test\Repository\CmsPage"> + <dataset name="default"> + <field name="title" xsi:type="string">page-%isolation%</field> + <field name="identifier" xsi:type="string">page-%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="content_heading" xsi:type="string">Heading-%isolation%</field> + <field name="page_layout" xsi:type="string">1 column</field> + </dataset> + + <dataset name="cms-page-duplicated"> + <field name="title" xsi:type="string">404 Not Found 1 Test%isolation%</field> + <field name="identifier" xsi:type="string">home</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="meta_keywords" xsi:type="string">Page keywords</field> + <field name="meta_description" xsi:type="string">Page description</field> + </dataset> + + <dataset name="3_column_template"> + <field name="title" xsi:type="string">page-compare-%isolation%</field> + <field name="identifier" xsi:type="string">page-compare-%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="page_layout" xsi:type="string">3 columns</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml new file mode 100644 index 0000000000000..5c562348e4fa2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\UrlRewrite\Test\Repository\UrlRewrite"> + <dataset name="cms_default_no_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + <field name="redirect_type" xsi:type="string">No</field> + <field name="store_id" xsi:type="string">Default Store View</field> + </dataset> + + <dataset name="cms_default_temporary_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="redirect_type" xsi:type="string">Temporary (302)</field> + <field name="store_id" xsi:type="string">Default Store View</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + </dataset> + + <dataset name="cms_default_permanent_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="redirect_type" xsi:type="string">Permanent (301)</field> + <field name="store_id" xsi:type="string">Default Store View</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php new file mode 100644 index 0000000000000..4d0aa70db985a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php @@ -0,0 +1,117 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Backend\Test\Page\Adminhtml\StoreDelete; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\StoreNew; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Parent class for CMS Block tests. + */ +abstract class AbstractCmsBlockEntityTest extends Injectable +{ + /** + * Page CmsBlockIndex. + * + * @var CmsBlockIndex + */ + protected $cmsBlockIndex; + + /** + * Page CmsBlockNew. + * + * @var CmsBlockNew + */ + protected $cmsBlockNew; + + /** + * Page StoreIndex. + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page StoreNew. + * + * @var StoreNew + */ + protected $storeNew; + + /** + * Page StoreDelete. + * + * @var StoreDelete + */ + protected $storeDelete; + + /** + * Store Name. + * + * @var array + */ + protected $storeName; + + /** + * Skipped stores for tearDown. + * + * @var array + */ + protected $skippedStores = [ + 'All Store Views', + 'Main Website/Main Website Store/Default Store View', + ]; + + /** + * Injection data. + * + * @param CmsBlockIndex $cmsBlockIndex + * @param CmsBlockNew $cmsBlockNew + * @param StoreIndex $storeIndex + * @param StoreNew $storeNew + * @param StoreDelete $storeDelete + * @return void + */ + public function __inject( + CmsBlockIndex $cmsBlockIndex, + CmsBlockNew $cmsBlockNew, + StoreIndex $storeIndex, + StoreNew $storeNew, + StoreDelete $storeDelete + ) { + $this->cmsBlockIndex = $cmsBlockIndex; + $this->cmsBlockNew = $cmsBlockNew; + $this->storeIndex = $storeIndex; + $this->storeNew = $storeNew; + $this->storeDelete = $storeDelete; + } + + /** + * Delete Store after test. + * + * @return void + */ + public function tearDown() + { + foreach ($this->storeName as $store) { + if (in_array($store, $this->skippedStores)) { + continue; + } + $tmp = explode("/", $store); + $filter['store_title'] = end($tmp); + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpen($filter); + $this->storeNew->getFormPageActions()->delete(); + $this->storeDelete->getStoreForm()->fillForm(['create_backup' => 'No']); + $this->storeDelete->getFormPageActions()->delete(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php new file mode 100644 index 0000000000000..bc0c24a28b5d0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; + +/** + * Preconditions: + * 1. Create store view. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Click "Add New Block" button. + * 4. Fill data according to dataset. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25578 + */ +class CreateCmsBlockEntityTest extends AbstractCmsBlockEntityTest +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Create CMS Block. + * + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $cmsBlock) + { + // Prepare data for tearDown + $this->storeName = $cmsBlock->getStores(); + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getGridPageActions()->addNew(); + $this->cmsBlockNew->getCmsForm()->fill($cmsBlock); + $this->cmsBlockNew->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml new file mode 100644 index 0000000000000..05164514a1335 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsBlockEntityTest"> + <variation name="CreateCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Enabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> + </variation> + <variation name="CreateCmsBlockEntityTestVariation2"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Disabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php new file mode 100644 index 0000000000000..35580f33bd3e5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage as CmsPageFixture; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Steps: + * 1. Log in to Backend. + * 2. Navigate to Content > Elements > Pages. + * 3. Start to create new CMS Page. + * 4. Fill out fields data according to data set. + * 5. Save CMS Page. + * 6. Verify created CMS Page. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25580 + */ +class CreateCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; + const STABLE = 'no'; + /* end tags */ + + /** + * CmsIndex page. + * + * @var CmsPageIndex + */ + protected $cmsIndex; + + /** + * CmsPageNew page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Inject pages. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function __inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew) + { + $this->cmsIndex = $cmsIndex; + $this->cmsPageNew = $cmsPageNew; + } + + /** + * Creating Cms page. + * + * @param CmsPageFixture $cms + * @return void + */ + public function test(CmsPageFixture $cms) + { + // Steps + $this->cmsIndex->open(); + $this->cmsIndex->getPageActionsBlock()->addNew(); + $this->cmsPageNew->getPageForm()->fill($cms); + $this->cmsPageNew->getPageMainActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml new file mode 100644 index 0000000000000..21c9773ef8a45 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsPageEntityTest"> + <variation name="CreateCmsPageEntityTestVariation1"> + <data name="description" xsi:type="string">MAGETWO-12399: Create CMS Content Page</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/identifier" xsi:type="string">identifier-%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">All Store Views</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation2"> + <data name="description" xsi:type="string">Create page for default store view</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34858</data> + <data name="description" xsi:type="string">Create page with widget and system variable</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="cms/data/content/widget/preset" xsi:type="string">default</data> + <data name="cms/data/content/variable" xsi:type="string">General Contact Name</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation4"> + <data name="description" xsi:type="string">Create disabled page</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/is_active" xsi:type="string">Disabled</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php new file mode 100644 index 0000000000000..5023d9a37f244 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions + * 1. Create CMS Page. + * + * Steps + * 1. Login to backend as Admin. + * 2. Go to the Marketing > SEO & Search > URL Rewrites. + * 3. Click "Add Url Rewrite" button. + * 4. Select "For CMS Page" in Create URL Rewrite dropdown. + * 5. Select CMS page from preconditions in grid. + * 6. Fill data according to data set. + * 7. Save Rewrite. + * 8. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-24847 + */ +class CreateCmsPageRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + } + + /** + * Create CMS page rewrites. + * + * @param UrlRewrite $urlRewrite + * @return array + */ + public function test(UrlRewrite $urlRewrite) + { + //Steps + $this->urlRewriteIndex->open(); + $this->urlRewriteIndex->getPageActionsBlock()->addNew(); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $cmsPage = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity(); + $filter = ['title' => $cmsPage->getTitle()]; + $this->urlRewriteEdit->getCmsGridBlock()->searchAndOpen($filter); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $this->urlRewriteEdit->getPageMainActions()->save(); + + return ['cmsPage' => $cmsPage]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml new file mode 100644 index 0000000000000..518a013681fd4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsPageRewriteEntityTest"> + <variation name="CreateCmsPageRewriteEntityTestVariation1"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> + <data name="urlRewrite/data/description" xsi:type="string">test_description_default</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation2"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.html</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Temporary (302)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_302</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation3"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.htm</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_301</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation4"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.aspx</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_%isolation%</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php new file mode 100644 index 0000000000000..07f8d2dea4488 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create CMS Block. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Open created CMS block. + * 4. Click "Delete Block". + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25698 + */ +class DeleteCmsBlockEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Page CmsBlockIndex. + * + * @var CmsBlockIndex + */ + protected $cmsBlockIndex; + + /** + * Page CmsBlockNew. + * + * @var CmsBlockNew + */ + protected $cmsBlockNew; + + /** + * Injection data. + * + * @param CmsBlockIndex $cmsBlockIndex + * @param CmsBlockNew $cmsBlockNew + * @return void + */ + public function __inject( + CmsBlockIndex $cmsBlockIndex, + CmsBlockNew $cmsBlockNew + ) { + $this->cmsBlockIndex = $cmsBlockIndex; + $this->cmsBlockNew = $cmsBlockNew; + } + + /** + * Delete CMS Block. + * + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $cmsBlock) + { + // Precondition + $cmsBlock->persist(); + $filter = ['identifier' => $cmsBlock->getIdentifier()]; + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getCmsBlockGrid()->searchAndOpen($filter, true, false); + $this->cmsBlockNew->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml new file mode 100644 index 0000000000000..622b867cab400 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsBlockEntityTest"> + <variation name="DeleteCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php new file mode 100644 index 0000000000000..5801ba85ea504 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. CMS Page is created. + * + * Steps: + * 1. Log in to Backend. + * 2. Navigate to CONTENT > Pages. + * 3. Click on CMS Page from grid. + * 4. Click "Delete Page" button. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-23291 + */ +class DeleteCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * CMS Index page. + * + * @var CmsPageIndex + */ + protected $cmsPageIndex; + + /** + * Edit CMS page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Inject pages. + * + * @param CmsPageIndex $cmsPageIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function __inject(CmsPageIndex $cmsPageIndex, CmsPageNew $cmsPageNew) + { + $this->cmsPageIndex = $cmsPageIndex; + $this->cmsPageNew = $cmsPageNew; + } + + /** + * Delete CMS Page. + * + * @param CmsPage $cmsPage + * @return void + */ + public function test(CmsPage $cmsPage) + { + // Preconditions + $cmsPage->persist(); + + // Steps + $this->cmsPageIndex->open(); + $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]); + $this->cmsPageNew->getPageMainActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml new file mode 100644 index 0000000000000..78dd465ad2b65 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsPageEntityTest"> + <variation name="DeleteCmsPageEntityTestVariation1"> + <data name="cmsPage/dataSet" xsi:type="string">default</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDeleteMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageNotInGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php new file mode 100644 index 0000000000000..7d5364c7c6fe4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create CMS Page. + * 2. Create CMS Page URL Redirect. + * + * Steps: + * 1. Login to backend as Admin. + * 2. Go to the Marketing > SEO & Search > URL Redirects. + * 3. Search and open created URL Redirect. + * 4. Delete Redirect. + * 5. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-25915 + */ +class DeleteCmsPageUrlRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + } + + /** + * Delete CMS page rewrites entity. + * + * @param UrlRewrite $urlRewrite + * @return void + */ + public function test(UrlRewrite $urlRewrite) + { + // Precondition + $urlRewrite->persist(); + + // Steps + $this->urlRewriteIndex->open(); + $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen(['request_path' => $urlRewrite->getRequestPath()]); + $this->urlRewriteEdit->getPageMainActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml new file mode 100644 index 0000000000000..86128fd3a6411 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsPageUrlRewriteEntityTest"> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation1"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_no_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation2"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_permanent_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation3"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_temporary_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..529810975dd2b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest18"> + <data name="menuItem" xsi:type="string">Content > Pages</data> + <data name="pageTitle" xsi:type="string">Pages</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest19"> + <data name="menuItem" xsi:type="string">Content > Blocks</data> + <data name="pageTitle" xsi:type="string">Blocks</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php new file mode 100644 index 0000000000000..7c2d579080f69 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; + +/** + * Preconditions: + * 1. Create store view. + * 2. Create CMS Block. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Open created CMS block. + * 4. Fill data according to dataset. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25941 + */ +class UpdateCmsBlockEntityTest extends AbstractCmsBlockEntityTest +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Run Update CMS Block test. + * + * @param CmsBlock $initialCmsBlock + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $initialCmsBlock, CmsBlock $cmsBlock) + { + // Prepare data for tearDown + $this->storeName = $cmsBlock->getStores(); + + // Precondition + $initialCmsBlock->persist(); + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getCmsBlockGrid()->searchAndOpen(['identifier' => $initialCmsBlock->getIdentifier()]); + $this->cmsBlockNew->getCmsForm()->fill($cmsBlock); + $this->cmsBlockNew->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml new file mode 100644 index 0000000000000..0b72bf77ef566 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsBlockEntityTest"> + <variation name="UpdateCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Enabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_updated_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> + </variation> + <variation name="UpdateCmsBlockEntityTestVariation2"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Disabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_updated_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php new file mode 100644 index 0000000000000..4c8f8d1cf29e7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. CMS Page is created. + * + * Steps: + * 1. Log in to Backend. + * 2. Navigate to Content > Elements > Pages. + * 3. Click on CMS Page from grid. + * 4. Edit test value(s) according to data set. + * 5. Click 'Save' CMS Page. + * 6. Perform asserts. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25186 + */ +class UpdateCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * CMS Index page. + * + * @var CmsPageIndex + */ + protected $cmsPageIndex; + + /** + * Edit CMS page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Fixture Factory. + * + * @var FixtureFactory + */ + protected $factory; + + /** + * Inject page. + * + * @param CmsPageIndex $cmsPageIndex + * @param CmsPageNew $cmsPageNew + * @param CmsPage $cmsOriginal + * @param FixtureFactory $factory + * @return array + */ + public function __inject( + CmsPageIndex $cmsPageIndex, + CmsPageNew $cmsPageNew, + CmsPage $cmsOriginal, + FixtureFactory $factory + ) { + $cmsOriginal->persist(); + $this->cmsPageIndex = $cmsPageIndex; + $this->cmsPageNew = $cmsPageNew; + $this->factory = $factory; + return ['cmsOriginal' => $cmsOriginal]; + } + + /** + * Update CMS Page. + * + * @param CmsPage $cms + * @param CmsPage $cmsOriginal + * @return array + */ + public function test(CmsPage $cms, CmsPage $cmsOriginal) + { + // Steps + $this->cmsPageIndex->open(); + $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]); + $this->cmsPageNew->getPageForm()->fill($cms); + $this->cmsPageNew->getPageMainActions()->save(); + + return [ + 'cms' => $this->factory->createByCode( + 'cmsPage', + ['data' => array_merge($cmsOriginal->getData(), $cms->getData())] + ) + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml new file mode 100644 index 0000000000000..d487f94272c8d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsPageEntityTest"> + <variation name="UpdateCmsPageEntityTestVariation1"> + <data name="cms/data/title" xsi:type="string">CmsPageEdited%isolation%</data> + <data name="cms/data/is_active" xsi:type="string">Disabled</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> + </variation> + <variation name="UpdateCmsPageEntityTestVariation2"> + <data name="cms/data/title" xsi:type="string">CmsPageEdited%isolation%</data> + <data name="cms/data/identifier" xsi:type="string">cms_page_url_edited_%isolation%</data> + <data name="cms/data/content_heading" xsi:type="string">Content Heading TexEdited</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php new file mode 100644 index 0000000000000..d1e65faea3d4e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Backend\Test\Page\Adminhtml\StoreDelete; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\StoreNew; +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create custom store view. + * 2. Create CMS Page. + * 3. Create CMS Page URL Redirect. + * + * Steps: + * 1. Login to backend as Admin. + * 2. Go to the Marketing-> SEO & Search->URL Redirects. + * 3. Search and open created URL Redirect. + * 4. Fill data according to data set. + * 5. Save Redirect. + * 6. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-26173 + */ +class UpdateCmsPageRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Page StoreIndex. + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page StoreNew. + * + * @var StoreNew + */ + protected $storeNew; + + /** + * Page StoreDelete. + * + * @var StoreDelete + */ + protected $storeDelete; + + /** + * Store Name. + * + * @var string + */ + protected $storeName; + + /** + * Skipped stores for tearDown. + * + * @var array + */ + protected $skippedStores = [ + 'Main Website/Main Website Store/Default Store View', + ]; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @param StoreIndex $storeIndex + * @param StoreNew $storeNew + * @param StoreDelete $storeDelete + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit, + StoreIndex $storeIndex, + StoreNew $storeNew, + StoreDelete $storeDelete + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + $this->storeIndex = $storeIndex; + $this->storeNew = $storeNew; + $this->storeDelete = $storeDelete; + } + + /** + * Update CMS page rewrites. + * + * @param UrlRewrite $urlRewrite + * @param UrlRewrite $cmsPageRewrite + * @return array + */ + public function test(UrlRewrite $urlRewrite, UrlRewrite $cmsPageRewrite) + { + // Preconditions + $cmsPageRewrite->persist(); + + // Steps + $this->urlRewriteIndex->open(); + $this->storeName = $urlRewrite->getStoreId(); + $filter = ['request_path' => $cmsPageRewrite->getRequestPath()]; + $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen($filter); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $this->urlRewriteEdit->getPageMainActions()->save(); + + return ['cmsPage' => $cmsPageRewrite->getDataFieldConfig('target_path')['source']->getEntity()]; + } + + /** + * Delete Store after test. + * + * @return void|null + */ + public function tearDown() + { + if (in_array($this->storeName, $this->skippedStores)) { + return; + } + $storeName = explode("/", $this->storeName); + $filter['store_title'] = end($storeName); + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpen($filter); + $this->storeNew->getFormPageActions()->delete(); + $this->storeDelete->getStoreForm()->fillForm(['create_backup' => 'No']); + $this->storeDelete->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml new file mode 100644 index 0000000000000..ebf6cc9116491 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsPageRewriteEntityTest"> + <variation name="UpdateCmsPageRewriteEntityTestVariation1"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_no_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/%default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> + <data name="urlRewrite/data/description" xsi:type="string">test_description_custom_store</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="UpdateCmsPageRewriteEntityTestVariation2"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_temporary_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.html</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Temporary (302)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_302</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="UpdateCmsPageRewriteEntityTestVariation3"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_permanent_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.htm</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_301</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml new file mode 100644 index 0000000000000..1827e66341e7b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="\Magento\Cms\Test\Handler\CmsPage\CmsPageInterface" type="\Magento\Cms\Test\Handler\CmsPage\Curl" /> + <preference for="\Magento\Cms\Test\Handler\CmsBlock\CmsBlockInterface" type="\Magento\Cms\Test\Handler\CmsBlock\Curl" /> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml new file mode 100644 index 0000000000000..8b297f22903f1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> +</config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php index e00f4e4e90f07..fe8b0dca7a593 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php @@ -715,6 +715,50 @@ class ConfigurableAttributesData implements FixtureInterface ], ], ], + + 'two_variations_with_fixed_price' => [ + 'attributes_data' => [ + 'attribute_key_0' => [ + 'options' => [ + 'option_key_0' => [ + 'label' => 'option_key_1_%isolation%', + 'pricing_value' => 1, + 'is_percent' => 'No', + 'include' => 'Yes', + ], + 'option_key_1' => [ + 'label' => 'option_2_%isolation%', + 'pricing_value' => 2, + 'is_percent' => 'No', + 'include' => 'Yes', + ], + ], + ], + ], + 'attributes' => [ + 'attribute_key_0' => 'catalogProductAttribute::attribute_type_dropdown_two_options', + ], + 'products' => [ + 'attribute_key_0:option_key_0' => 'catalogProductSimple::product_without_category', + 'attribute_key_0:option_key_1' => 'catalogProductSimple::product_without_category', + ], + 'matrix' => [ + 'attribute_key_0:option_key_0' => [ + 'display' => 'Yes', + 'quantity_and_stock_status' => [ + 'qty' => 100, + ], + 'weight' => 1, + ], + 'attribute_key_0:option_key_1' => [ + 'display' => 'Yes', + 'quantity_and_stock_status' => [ + 'qty' => 200, + ], + 'weight' => 1, + ], + ], + ], ]; /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 1e716ac2f3b16..fa36f1aef661a 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -275,6 +275,31 @@ </field> </dataset> + <dataset name="two_variations_with_fixed_price"> + <field name="name" xsi:type="string">Configurable product %isolation%</field> + <field name="url_key" xsi:type="string">test-configurable-product-%isolation%</field> + <field name="sku" xsi:type="string">sku_configurable_product_%isolation%</field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">10</item> + </field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="weight" xsi:type="string">1</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="configurable_attributes_data" xsi:type="array"> + <item name="preset" xsi:type="string">two_variations_with_fixed_price</item> + </field> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">custom_attribute_set</item> + </field> + <field name="checkout_data" xsi:type="array"> + <item name="preset" xsi:type="string">two_options_by_one_dollar</item> + </field> + </dataset> + <dataset name="filterable_two_options_with_zero_price"> <field name="name" xsi:type="string">Test configurable product %isolation%</field> <field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml index 5d9a0ef2c0981..1605e59d91b2e 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml @@ -5,156 +5,130 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest"> - <variation name="CreateConfigurableProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with category and two new options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="tag" xsi:type="string">Bug: MTA-1616</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with two options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_options</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with special price</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options_with_special_price</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">10</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with assigned products to options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_assigned_product</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_options_with_assigned_product</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12620: Create Configurable Product and Assign it to Category</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">Taxable Goods</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">1</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data> - <data name="product/data/url_key" xsi:type="string">-</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">-</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">no</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - </testCase> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest"> + <variation name="CreateConfigurableProductEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">Create product with category and two new options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create product with two options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">Create product with special price</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options_with_special_price</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/special_price" xsi:type="string">10</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34791</data> + <data name="description" xsi:type="string">Create product with assigned products to options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_assigned_product</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_options_with_assigned_product</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation5"> + <data name="description" xsi:type="string">MAGETWO-12620: Create Configurable Product and Assign it to Category</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_fixed_price</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/tax_class_id" xsi:type="string">Taxable Goods</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/weight" xsi:type="string">1</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/category_ids/new_category" xsi:type="string">no</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000..b5586d999f7e3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<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\DuplicateProductEntityTest"> + <variation name="DuplicateProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="productType" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductDuplicateForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductDuplicateForm" next="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml index c74b44ab0638b..943de11174926 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml @@ -50,7 +50,6 @@ <data name="updatedProduct/data/weight" xsi:type="string">3</data> <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> @@ -75,7 +74,6 @@ <data name="updatedProduct/data/weight" xsi:type="string">3</data> <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php index 5289324d5c837..7fe761407b715 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php @@ -72,7 +72,7 @@ public function __construct( CatalogProductEdit $catalogProductEdit, ConfigurableProduct $product, ConfigurableProduct $updatedProduct, - $attributeTypeAction + $attributeTypeAction = '' ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductEdit = $catalogProductEdit; diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..2cff21bd91adf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest20"> + <data name="menuItem" xsi:type="string">Stores > Currency Rates</data> + <data name="pageTitle" xsi:type="string">Currency Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest21"> + <data name="menuItem" xsi:type="string">Stores > Currency Symbols</data> + <data name="pageTitle" xsi:type="string">Currency Symbols</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php index 056a514f08295..0de0e9658a1e7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php @@ -19,7 +19,7 @@ class AddressesDefault extends Block * * @var string */ - protected $changeBillingAddressSelector = '.box-billing-address a'; + protected $changeBillingAddressSelector = '.box-address-billing a'; /** * Click on address book menu item diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml index 6cb8e9be7977d..d5afd5538951e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml @@ -10,6 +10,9 @@ <dataset name="default"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> + <field name="group_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">General</item> + </field> <field name="email" xsi:type="string">John.Doe%isolation%@example.com</field> <field name="password" xsi:type="string">123123q</field> <field name="password_confirmation" xsi:type="string">123123q</field> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index 7e8cfe0865fd6..b42c48cbb8013 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php @@ -31,7 +31,8 @@ class Curl extends AbstractCurl implements CustomerInterface */ protected $mappingData = [ 'country_id' => [ - 'United States' => 'US' + 'United States' => 'US', + 'United Kingdom' => 'GB' ], 'region_id' => [ 'California' => 12, @@ -57,6 +58,16 @@ class Curl extends AbstractCurl implements CustomerInterface ] ]; + /** + * Fields that have to be send using update curl. + * + * @var array + */ + protected $fieldsToUpdate = [ + 'address', + 'group_id', + ]; + /** * Post request for creating customer in frontend * @@ -91,8 +102,8 @@ public function persist(FixtureInterface $customer = null) if (!empty($address)) { $data['address'] = $address; - $this->addAddress($data); } + $this->updateCustomer($data); return $result; } @@ -130,16 +141,21 @@ protected function getCustomerGroup(FixtureInterface $customer) } /** - * Add addresses in to customer account + * Update customer fields that can not be added at creation step. + * - address + * - group_id * * @param array $data * @return void * @throws \Exception */ - protected function addAddress(array $data) + protected function updateCustomer(array $data) { + $result = array_intersect($this->fieldsToUpdate, array_keys($data)); + if (empty($result)) { + return; + } $curlData = []; - $url = $_ENV['app_backend_url'] . 'customer/index/save/id/' . $data['customer_id']; foreach ($data as $key => $value) { foreach ($this->curlMapping as $prefix => $prefixValues) { if (in_array($key, $prefixValues)) { @@ -151,15 +167,18 @@ protected function addAddress(array $data) unset($data['password'], $data['password_confirmation']); $curlData = $this->replaceMappingData(array_merge($curlData, $data)); - $curlData = $this->prepareAddressData($curlData); + if (!empty($data['address'])) { + $curlData = $this->prepareAddressData($curlData); + } + $url = $_ENV['app_backend_url'] . 'customer/index/save/id/' . $data['customer_id']; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $curlData); $response = $curl->read(); $curl->close(); if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception('Failed to assign an address to the customer!'); + throw new \Exception('Failed to update customer!'); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php index 225aa4a566026..90b432c8d47ac 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php @@ -26,7 +26,7 @@ class DefaultAddress extends Page * * @var string */ - protected $defaultAddressesSelector = '.block-addresses-default .box-billing-address'; + protected $defaultAddressesSelector = '.block-addresses-default'; /** * Get default addresses block diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 37b655390419d..3510a9b975029 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -149,6 +149,22 @@ <field name="fax" xsi:type="string">444-44-444-44</field> </dataset> + <dataset name="address_UK_default_billing_address"> + <field name="firstname" xsi:type="string">Jane</field> + <field name="lastname" xsi:type="string">Doe</field> + <field name="email" xsi:type="string">JaneDoe_%isolation%@example.com</field> + <field name="company" xsi:type="string">Magento %isolation%</field> + <field name="city" xsi:type="string">London</field> + <field name="street" xsi:type="string">172, Westminster Bridge Rd</field> + <field name="postcode" xsi:type="string">SE1 7RW</field> + <field name="country_id" xsi:type="string">United Kingdom</field> + <field name="region" xsi:type="string">London</field> + <field name="telephone" xsi:type="string">444-44-444-44</field> + <field name="fax" xsi:type="string">444-44-444-44</field> + <field name="default_billing" xsi:type="string">Yes</field> + <field name="default_shipping" xsi:type="string">Yes</field> + </dataset> + <dataset name="address_US_1"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml index 1649cb7b9e411..eeea09970da76 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml @@ -18,6 +18,17 @@ <field name="password_confirmation" xsi:type="string">123123q</field> </dataset> + <dataset name="customer_with_new_customer_group"> + <field name="firstname" xsi:type="string">John</field> + <field name="lastname" xsi:type="string">Doe</field> + <field name="group_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">customer_group_retail_customer</item> + </field> + <field name="email" xsi:type="string">JohnDoe_%isolation%@example.com</field> + <field name="password" xsi:type="string">123123q</field> + <field name="password_confirmation" xsi:type="string">123123q</field> + </dataset> + <dataset name="johndoe"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> @@ -183,5 +194,16 @@ <item name="presets" xsi:type="string">address_UK</item> </field> </dataset> + + <dataset name="customer_UK_1_default_billing_address"> + <field name="firstname" xsi:type="string">John</field> + <field name="lastname" xsi:type="string">Doe%isolation%</field> + <field name="email" xsi:type="string">John.Doe%isolation%@example.com</field> + <field name="password" xsi:type="string">123123q</field> + <field name="password_confirmation" xsi:type="string">123123q</field> + <field name="address" xsi:type="array"> + <item name="presets" xsi:type="string">address_UK_default_billing_address</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml index ed4fa8d8b49eb..0ac1bbdda5d59 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml @@ -43,5 +43,12 @@ <item name="dataSet" xsi:type="string">retail_customer</item> </field> </dataset> + + <dataset name="customer_group_retail_customer"> + <field name="customer_group_code" xsi:type="string">Customer_group_%isolation%</field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">retail_customer</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml index 39290c7f86b8a..a939641976d0a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml @@ -8,14 +8,14 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Customer\Test\TestCase\CreateCustomerGroupEntityTest"> <variation name="CreateCustomerGroupEntityTestVariation1"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">Retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm"/> </variation> <variation name="CreateCustomerGroupEntityTestVariation2"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">Retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">General</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupAlreadyExists"/> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php index 36cb46a29b4ee..a2fdc4922e7a1 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php @@ -13,21 +13,17 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for DeleteCustomerAddress - * - * Test Flow: - * * Preconditions: - * 1. Create customer - * 2. Add default address (NY) - * 3. Add one more address (CA) + * 1. Create customer. + * 2. Add default address (NY). + * 3. Add one more address (CA). * * Steps: - * 1. Open frontend - * 2. Login as customer - * 3. Go to 'Address Book' tab > Additional Address Entries - * 4. Delete second address - click 'Delete Address' button - * 5. Perform all assertions + * 1. Open frontend. + * 2. Login as customer. + * 3. Go to 'Address Book' tab > Additional Address Entries. + * 4. Delete second address - click 'Delete Address' button. + * 5. Perform all assertions. * * @group Customers_(CS) * @ZephyrId MAGETWO-28066 @@ -40,28 +36,28 @@ class DeleteCustomerAddressTest extends Injectable /* end tags */ /** - * Cms index page + * Cms index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Customer login page + * Customer login page. * * @var CustomerAccountLogin */ protected $customerAccountLogin; /** - * Customer index page + * Customer index page. * * @var CustomerAccountIndex */ protected $customerAccountIndex; /** - * Prepare pages for test + * Prepare pages for test. * * @param CustomerAccountLogin $customerAccountLogin * @param CmsIndex $cmsIndex @@ -79,13 +75,14 @@ public function __inject( } /** - * Runs Delete Customer Address test + * Runs Delete Customer Address test. * * @param Customer $customer * @return array */ public function test(Customer $customer) { + $this->markTestIncomplete('Bug: MAGETWO-34634'); // Precondition: $customer->persist(); $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1]; diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..a8b352b7514ee --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest22"> + <data name="menuItem" xsi:type="string">Customers > All Customers</data> + <data name="pageTitle" xsi:type="string">Customers</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest23"> + <data name="menuItem" xsi:type="string">Customers > Now Online</data> + <data name="pageTitle" xsi:type="string">Customers Now Online</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest24"> + <data name="menuItem" xsi:type="string">Stores > Customer Groups</data> + <data name="pageTitle" xsi:type="string">Customer Groups</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml index 84116576ab62e..198270813fc12 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Customer\Test\TestCase\UpdateCustomerGroupEntityTest"> <variation name="UpdateCustomerGroupEntityTestVariation1"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php index 745b576a528ab..b305528390cf0 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php @@ -61,7 +61,7 @@ public function __construct( public function run() { $this->cmsIndex->open(); - $this->cmsIndex->getLinksBlock()->waitWelcomeMessage(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php index 57fb8c5d9527d..8e3861485f447 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php @@ -39,6 +39,7 @@ public function __construct(CmsIndex $cmsIndex) public function run() { $this->cmsIndex->open(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php index a68a64dc05794..e620a4ca4ac6a 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php @@ -29,7 +29,7 @@ protected function getPreset($name) 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], ], @@ -43,11 +43,11 @@ protected function getPreset($name) 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], [ - 'label' => 'link_2', + 'label' => 'link_1', 'value' => 'Yes' ], ], @@ -75,7 +75,7 @@ protected function getPreset($name) 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], ], @@ -92,7 +92,7 @@ protected function getPreset($name) ], 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes' ] ], diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000..1409e9a0d2f08 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<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\DuplicateProductEntityTest"> + <variation name="DuplicateProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="productType" xsi:type="string">downloadableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" next="Magento\Downloadable\Test\Constraint\AssertDownloadableDuplicateForm" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableDuplicateForm" next="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..dccd3aa897208 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest29"> + <data name="menuItem" xsi:type="string">Marketing > Email Templates</data> + <data name="pageTitle" xsi:type="string">Email Templates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php index 4d111e4a6f603..a9a17c123c4c1 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php @@ -10,7 +10,7 @@ use Magento\Customer\Test\Page\CustomerAccountLogout; use Magento\GiftMessage\Test\Fixture\GiftMessage; use Magento\Sales\Test\Page\OrderHistory; -use Magento\Sales\Test\Page\SalesOrderView; +use Magento\Sales\Test\Page\CustomerOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** @@ -25,7 +25,7 @@ class AssertGiftMessageInFrontendOrderItems extends AbstractConstraint * @param GiftMessage $giftMessage * @param Customer $customer * @param OrderHistory $orderHistory - * @param SalesOrderView $salesOrderView + * @param CustomerOrderView $customerOrderView * @param CustomerAccountLogout $customerAccountLogout * @param string $orderId * @param array $products @@ -35,7 +35,7 @@ public function processAssert( GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, - SalesOrderView $salesOrderView, + CustomerOrderView $customerOrderView, CustomerAccountLogout $customerAccountLogout, $orderId, $products = [] @@ -64,7 +64,7 @@ public function processAssert( } \PHPUnit_Framework_Assert::assertEquals( $expectedData, - $salesOrderView->getGiftMessageForItemBlock()->getGiftMessage($product->getName()), + $customerOrderView->getGiftMessageForItemBlock()->getGiftMessage($product->getName()), 'Wrong gift message is displayed on "' . $product->getName() . '" item.' ); } diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml deleted file mode 100644 index 10cedb90faf83..0000000000000 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<scenarios xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Config/etc/scenario.xsd"> - <scenario name="CheckoutWithGiftMessagesTest" module="Magento_GiftMessage"> - <methods> - <method name="test"> - <steps> - <first>setupConfiguration</first> - <step name="setupConfiguration" module="Magento_Core"> - <arguments> - <item name="configData">cashondelivery, enable_gift_messages</item> - </arguments> - <next>createProducts</next> - </step> - <step name="createProducts" module="Magento_Catalog"> - <next>createCustomer</next> - </step> - <step name="createCustomer" module="Magento_Customer"> - <next>loginCustomerOnFrontend</next> - </step> - <step name="loginCustomerOnFrontend" module="Magento_Customer"> - <next>addProductsToTheCart</next> - </step> - <step name="addProductsToTheCart" module="Magento_Checkout"> - <next>proceedToCheckout</next> - </step> - <step name="proceedToCheckout" module="Magento_Checkout"> - <next>fillBillingInformation</next> - </step> - <step name="fillBillingInformation" module="Magento_Checkout"> - <next>fillShippingMethod</next> - </step> - <step name="addGiftMessage" module="Magento_GiftMessage"> - <next>fillShippingMethod</next> - </step> - <step name="fillShippingMethod" module="Magento_Checkout"> - <next>selectPaymentMethod</next> - </step> - <step name="selectPaymentMethod" module="Magento_Checkout"> - <next>placeOrder</next> - </step> - <step name="placeOrder" module="Magento_Checkout" /> - </steps> - </method> - </methods> - </scenario> - <scenario name="CreateGiftMessageOnBackendTest" module="Magento_GiftMessage"> - <methods> - <method name="test"> - <steps> - <first>setupConfiguration</first> - <step name="setupConfiguration" module="Magento_Core"> - <arguments> - <item name="configData">cashondelivery, enable_gift_messages</item> - </arguments> - <next>createProducts</next> - </step> - <step name="createProducts" module="Magento_Catalog"> - <next>createCustomer</next> - </step> - <step name="createCustomer" module="Magento_Customer"> - <arguments> - <items name="customer"> - <item name="dataSet">johndoe_with_addresses</item> - </items> - </arguments> - <next>openSalesOrders</next> - </step> - <step name="openSalesOrders" module="Magento_Sales"> - <next>createNewOrder</next> - </step> - <step name="createNewOrder" module="Magento_Sales"> - <next>selectCustomerOrder</next> - </step> - <step name="selectCustomerOrder" module="Magento_Sales"> - <next>selectStore</next> - </step> - <step name="selectStore" module="Magento_Sales"> - <next>addProducts</next> - </step> - <step name="addProducts" module="Magento_Sales"> - <next>addGiftMessageBackend</next> - </step> - <step name="addGiftMessageBackend" module="Magento_GiftMessage"> - <next>fillBillingAddress</next> - </step> - <step name="fillBillingAddress" module="Magento_Sales"> - <next>selectPaymentMethodForOrder</next> - </step> - <step name="selectPaymentMethodForOrder" module="Magento_Sales"> - <next>selectShippingMethodForOrder</next> - </step> - <step name="selectShippingMethodForOrder" module="Magento_Sales"> - <next>submitOrder</next> - </step> - <step name="submitOrder" module="Magento_Sales" /> - </steps> - </method> - </methods> - </scenario> -</scenarios> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml index 0678443518429..44be0fed9e25d 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml @@ -6,40 +6,40 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> - <scenario name="CheckoutWithGiftMessagesTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> - <item name="configData" value="cashondelivery, enableGiftMessages"/> - </step> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"/> - <step name="loginCustomerOnFrontend" module="Magento_Customer" next="addProductsToTheCart"/> - <step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout"/> - <step name="proceedToCheckout" module="Magento_Checkout" next="fillBillingInformation"/> - <step name="fillBillingInformation" module="Magento_Checkout" next="fillShippingMethod"/> - <step name="addGiftMessage" module="Magento_GiftMessage" next="fillShippingMethod"/> - <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod"/> - <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder"/> - <step name="placeOrder" module="Magento_Checkout"/> - </scenario> - <scenario name="CreateGiftMessageOnBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> - <item name="configData" value="cashondelivery, enableGiftMessages"/> - </step> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> - <item name="customer"> - <item name="dataSet" value="johndoe_with_addresses"/> - </item> - </step> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="addGiftMessageBackend"/> - <step name="addGiftMessageBackend" module="Magento_GiftMessage" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> + <scenario name="CheckoutWithGiftMessagesTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <item name="configData" value="cashondelivery, enable_gift_messages" /> + </step> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend" /> + <step name="loginCustomerOnFrontend" module="Magento_Customer" next="addProductsToTheCart" /> + <step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="fillBillingInformation" /> + <step name="fillBillingInformation" module="Magento_Checkout" next="addGiftMessage" /> + <step name="addGiftMessage" module="Magento_GiftMessage" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" /> + <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder" /> + <step name="placeOrder" module="Magento_Checkout" /> + </scenario> + <scenario name="CreateGiftMessageOnBackendTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <item name="configData" value="cashondelivery, enable_gift_messages" /> + </step> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> + <item name="customer"> + <item name="dataSet" value="johndoe_with_addresses" /> + </item> + </step> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="addGiftMessageBackend" /> + <step name="addGiftMessageBackend" module="Magento_GiftMessage" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..528dc68a50b1c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest33"> + <data name="menuItem" xsi:type="string">Products > Attributes</data> + <data name="pageTitle" xsi:type="string">Google Content Attributes</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest34"> + <data name="menuItem" xsi:type="string">Products > Items</data> + <data name="pageTitle" xsi:type="string">Google Content Items</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php index e7605924ad258..0a883fed4545d 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php @@ -12,10 +12,6 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Update GroupedProductEntity - * - * Test Flow: - * * Preconditions: * 1. Create Grouped Product. * @@ -38,21 +34,21 @@ class UpdateGroupedProductEntityTest extends Injectable /* end tags */ /** - * Page product on backend + * Page product on backend. * * @var CatalogProductIndex */ protected $catalogProductIndex; /** - * Edit page on backend + * Edit page on backend. * * @var CatalogProductEdit */ protected $catalogProductEdit; /** - * Filling objects of the class + * Filling objects of the class. * * @param CatalogProductIndex $catalogProductIndexNewPage * @param CatalogProductEdit $catalogProductEditPage @@ -67,7 +63,7 @@ public function __inject( } /** - * Test update grouped product + * Test update grouped product. * * @param GroupedProduct $product * @param GroupedProduct $originalProduct diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml index dd1f2144e4e3f..cc918d24c96e6 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml @@ -6,78 +6,59 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\GroupedProduct\Test\TestCase\UpdateGroupedProductEntityTest"> - <variation name="UpdateGroupedProductEntityTestVariation1"> - <data name="originalProduct/dataSet" xsi:type="string">grouped_product_out_of_stock</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/category_ids/presets" xsi:type="string">category_%isolation%</data> - <data name="product/data/associated/products" xsi:type="string">-</data> - <data name="product/data/associated/preset" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">This is edited description for grouped product</data> - <data name="product/data/short_description" xsi:type="string">This is edited short description for grouped product</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation2"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductVirtual::default,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/associated/preset" xsi:type="string">defaultVirtualProduct</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation3"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductSimple::default</data> - <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_without_qty</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductsDefaultQty"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation4"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::withSpecialPrice,catalogProductSimple::withSpecialPrice</data> - <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_with_specialPrice</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertSpecialPriceOnGroupedProductPage"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">-</data> - <data name="product/data/associated/preset" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - </testCase> + <testCase name="Magento\GroupedProduct\Test\TestCase\UpdateGroupedProductEntityTest"> + <variation name="UpdateGroupedProductEntityTestVariation1"> + <data name="originalProduct/dataSet" xsi:type="string">grouped_product_out_of_stock</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/category_ids/presets" xsi:type="string">category_%isolation%</data> + <data name="product/data/description" xsi:type="string">This is edited description for grouped product</data> + <data name="product/data/short_description" xsi:type="string">This is edited short description for grouped product</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation2"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductVirtual::default,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/associated/preset" xsi:type="string">defaultVirtualProduct</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation3"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductSimple::default</data> + <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_without_qty</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductsDefaultQty" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation4"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::withSpecialPrice,catalogProductSimple::withSpecialPrice</data> + <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_with_specialPrice</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertSpecialPriceOnGroupedProductPage" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation5"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..94a696047e1e9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest35"> + <data name="menuItem" xsi:type="string">System > Import</data> + <data name="pageTitle" xsi:type="string">Import</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest36"> + <data name="menuItem" xsi:type="string">System > Export</data> + <data name="pageTitle" xsi:type="string">Export</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..0a1afb249ef8f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest37"> + <data name="menuItem" xsi:type="string">System > Index Management</data> + <data name="pageTitle" xsi:type="string">Index Management</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..ab448ae81e249 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest38"> + <data name="menuItem" xsi:type="string">System > Integrations</data> + <data name="pageTitle" xsi:type="string">Integrations</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php index 23b69f7123443..a05c605294479 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php @@ -35,6 +35,7 @@ public function __construct(CheckoutCart $checkoutCart) */ public function run() { + $this->checkoutCart->open(); $this->checkoutCart->getMultipleAddressCheckoutBlock()->multipleAddressesCheckout(); } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php index 3de754dffa925..098fff98e7ec5 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php @@ -45,6 +45,9 @@ function () use ($browser, $selector) { ); $this->browser->switchToFrame(new Locator($this->iFrame)); - return $this->_rootElement->getText(); + $content = $this->_rootElement->getText(); + + $this->browser->switchToFrame(); + return $content; } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..b830ba8af1c5d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest46"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Template</data> + <data name="pageTitle" xsi:type="string">Newsletter Templates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest47"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Queue</data> + <data name="pageTitle" xsi:type="string">Newsletter Queue</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest48"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Subscribers</data> + <data name="pageTitle" xsi:type="string">Newsletter Subscribers</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest49"> + <data name="menuItem" xsi:type="string">Reports > Newsletter Problem Reports</data> + <data name="pageTitle" xsi:type="string">Newsletter Problems Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..46bb69f248a90 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest55"> + <data name="menuItem" xsi:type="string">Reports > Products in Cart</data> + <data name="pageTitle" xsi:type="string">Products in Carts</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest56"> + <data name="menuItem" xsi:type="string">Reports > Abandoned Carts</data> + <data name="pageTitle" xsi:type="string">Abandoned Carts</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest57"> + <data name="menuItem" xsi:type="string">Reports > Orders</data> + <data name="pageTitle" xsi:type="string">Sales Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest58"> + <data name="menuItem" xsi:type="string">Reports > Tax</data> + <data name="pageTitle" xsi:type="string">Tax Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest59"> + <data name="menuItem" xsi:type="string">Reports > Invoiced</data> + <data name="pageTitle" xsi:type="string">Invoice Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest60"> + <data name="menuItem" xsi:type="string">Reports > Coupons</data> + <data name="pageTitle" xsi:type="string">Coupons Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest61"> + <data name="menuItem" xsi:type="string">Reports > Order Total</data> + <data name="pageTitle" xsi:type="string">Order Total Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest62"> + <data name="menuItem" xsi:type="string">Reports > Order Count</data> + <data name="pageTitle" xsi:type="string">Order Count Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest63"> + <data name="menuItem" xsi:type="string">Reports > New</data> + <data name="pageTitle" xsi:type="string">New Accounts Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest64"> + <data name="menuItem" xsi:type="string">Reports > Views</data> + <data name="pageTitle" xsi:type="string">Product Views Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest65"> + <data name="menuItem" xsi:type="string">Reports > Bestsellers</data> + <data name="pageTitle" xsi:type="string">Best Sellers Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest66"> + <data name="menuItem" xsi:type="string">Reports > Low Stock</data> + <data name="pageTitle" xsi:type="string">Low Stock Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest67"> + <data name="menuItem" xsi:type="string">Reports > Ordered</data> + <data name="pageTitle" xsi:type="string">Ordered Products Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest68"> + <data name="menuItem" xsi:type="string">Reports > Downloads</data> + <data name="pageTitle" xsi:type="string">Downloads Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest69"> + <data name="menuItem" xsi:type="string">Reports > Refresh statistics</data> + <data name="pageTitle" xsi:type="string">Refresh Statistics</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php index f00195c836913..f71fd73490e3a 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php @@ -70,7 +70,7 @@ public function __inject(CustomerIndex $customerIndexPage, CustomerAccounts $cus */ public function test(Customer $customer, array $customersReport) { - $this->markTestIncomplete('MAGETWO-26663'); + $this->markTestIncomplete('Bug: MAGETWO-35037'); // Preconditions $this->customerIndexPage->open(); $this->customerIndexPage->getCustomerGridBlock()->massaction([], 'Delete', true, 'Select All'); diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php index a850585fabc19..b260e667b7fd1 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php @@ -65,7 +65,6 @@ class ViewedProductsReportEntityTest extends Injectable */ public function __prepare(CatalogProductIndex $catalogProductIndexPage) { - $this->markTestIncomplete('Bug: MAGETWO-33029'); $catalogProductIndexPage->open(); $catalogProductIndexPage->getProductGrid()->massaction([], 'Delete', true, 'Select All'); } diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml index 631230c2956a1..b0d0b350efa71 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml @@ -6,36 +6,36 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Reports\Test\TestCase\ViewedProductsReportEntityTest"> - <variation name="ViewedProductsReportEntityTestVariation1"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Year report</data> - <data name="total" xsi:type="string">2, 1</data> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> - <data name="viewsReport/period_type" xsi:type="string">Year</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y -1 year</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - <variation name="ViewedProductsReportEntityTestVariation2"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Month report</data> - <data name="total" xsi:type="string">1, 1</data> - <data name="products" xsi:type="string">downloadableProduct::default, bundleProduct::bundle_dynamic_product</data> - <data name="viewsReport/period_type" xsi:type="string">Month</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - <variation name="ViewedProductsReportEntityTestVariation3"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Day report</data> - <data name="total" xsi:type="string">1, 1</data> - <data name="products" xsi:type="string">configurableProduct::default, groupedProduct::default</data> - <data name="viewsReport/period_type" xsi:type="string">Day</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y -1 day</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y +1 day</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">Yes</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - </testCase> + <testCase name="Magento\Reports\Test\TestCase\ViewedProductsReportEntityTest"> + <variation name="ViewedProductsReportEntityTestVariation1"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Year report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="viewsReport/period_type" xsi:type="string">Year</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y -1 year</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + <variation name="ViewedProductsReportEntityTestVariation2"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Month report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">downloadableProduct::default, bundleProduct::bundle_dynamic_product</data> + <data name="viewsReport/period_type" xsi:type="string">Month</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y - 1 month</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + <variation name="ViewedProductsReportEntityTestVariation3"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Day report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">configurableProduct::default, groupedProduct::default</data> + <data name="viewsReport/period_type" xsi:type="string">Day</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y -1 day</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y +1 day</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">Yes</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php index 6d38c764c63b9..d2042d8a8370e 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php @@ -80,16 +80,6 @@ class CreateProductReviewBackendEntityTest extends Injectable */ protected $review; - /** - * Skip test due to a Magento bug. - * - * @return void - */ - public function __prepare() - { - $this->markTestIncomplete('Bug: MAGETWO-33912'); - } - /** * Inject pages into test * diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..2c68c7f55f969 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest70"> + <data name="menuItem" xsi:type="string">Marketing > Reviews</data> + <data name="pageTitle" xsi:type="string">Reviews</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest71"> + <data name="menuItem" xsi:type="string">Reports > By Customers</data> + <data name="pageTitle" xsi:type="string">Customer Reviews Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest72"> + <data name="menuItem" xsi:type="string">Reports > By Products</data> + <data name="pageTitle" xsi:type="string">Product Reviews Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest73"> + <data name="menuItem" xsi:type="string">Stores > Rating</data> + <data name="pageTitle" xsi:type="string">Ratings</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php index 09919efbd1dba..f402dd1f6273c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php @@ -10,48 +10,49 @@ use Magento\Mtf\Client\Locator; /** - * Class Grid - * Sales order grid + * Sales order grid. */ class Grid extends GridInterface { /** - * 'Add New' order button + * 'Add New' order button. * * @var string */ protected $addNewOrder = "../*[@class='page-actions']//*[@id='add']"; /** - * Purchase Point Filter selector + * Purchase Point Filter selector. * * @var string */ protected $purchasePointFilter = '//*[@data-ui-id="widget-grid-column-filter-store-0-filter-store-id"]'; /** - * Purchase Point Filter option group elements selector + * Purchase Point Filter option group elements selector. * * @var string */ protected $purchasePointOptGroup = '//*[@data-ui-id="widget-grid-column-filter-store-0-filter-store-id"]/optgroup'; /** - * Order Id td selector + * Order Id td selector. * * @var string */ protected $editLink = 'td[class*=col-action] a'; /** - * First row selector + * First row selector. * * @var string */ protected $firstRowSelector = '//tbody/tr[1]//a'; /** - * {@inheritdoc} + * Filters array mapping. + * + * @var array */ protected $filters = [ 'id' => [ @@ -64,7 +65,7 @@ class Grid extends GridInterface ]; /** - * Start to create new order + * Start to create new order. */ public function addNewOrder() { @@ -72,24 +73,20 @@ public function addNewOrder() } /** - * Get selected data from Purchase Point filter + * Get StoreGroup list of Purchase Point on filter. * - * @return string + * @return array */ - public function getPurchasePointFilterText() + public function getPurchasePointStoreGroups() { - return $this->_rootElement->find($this->purchasePointFilter, Locator::SELECTOR_XPATH)->getText(); - } + $storeGroupElements = $this->_rootElement->find($this->purchasePointFilter, Locator::SELECTOR_XPATH) + ->getElements('.//optgroup[./option]', Locator::SELECTOR_XPATH); + $result = []; - /** - * Assert the number of Purchase Point Filter option group elements by checking non-existing group - * - * @param $number - * @return bool - */ - public function assertNumberOfPurchasePointFilterOptionsGroup($number) - { - $selector = $this->purchasePointOptGroup . '[' . ($number + 1) . ']'; - return !$this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->isVisible(); + foreach ($storeGroupElements as $storeGroupElement) { + $result[] = trim($storeGroupElement->getAttribute('label'), ' '); + } + + return $result; } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php index 893bde7b41f36..fda4c7814591b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php @@ -36,8 +36,8 @@ public function processAssert( $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); \PHPUnit_Framework_Assert::assertEquals( - $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), $previousOrderStatus, + $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), 'Order status is incorrect on order page in backend.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..0278a74760af2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest77"> + <data name="menuItem" xsi:type="string">Sales > Orders</data> + <data name="pageTitle" xsi:type="string">Orders</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest78"> + <data name="menuItem" xsi:type="string">Sales > Invoices</data> + <data name="pageTitle" xsi:type="string">Invoices</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest79"> + <data name="menuItem" xsi:type="string">Sales > Shipments</data> + <data name="pageTitle" xsi:type="string">Shipments</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest80"> + <data name="menuItem" xsi:type="string">Sales > Credit Memos</data> + <data name="pageTitle" xsi:type="string">Credit Memos</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest81"> + <data name="menuItem" xsi:type="string">Sales > Transactions</data> + <data name="pageTitle" xsi:type="string">Transactions</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest82"> + <data name="menuItem" xsi:type="string">Stores > Order Status</data> + <data name="pageTitle" xsi:type="string">Order Status</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php index e873f8fc8e758..8deb7b0dbb028 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php @@ -42,7 +42,7 @@ class FillBillingAddressStep implements TestStepInterface * @param Address $billingAddress * @param string $saveAddress */ - public function __construct(OrderCreateIndex $orderCreateIndex, Address $billingAddress, $saveAddress) + public function __construct(OrderCreateIndex $orderCreateIndex, Address $billingAddress, $saveAddress = 'No') { $this->orderCreateIndex = $orderCreateIndex; $this->billingAddress = $billingAddress; diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index c80098f59e636..f42ed2705b6c7 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -6,72 +6,73 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> - <scenario name="ReorderOrderEntityTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createOrder"/> - <step name="createOrder" module="Magento_Sales" next="openOrder"/> - <step name="openOrder" module="Magento_Sales" next="reorder"/> - <step name="reorder" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> - <scenario name="CreateOrderBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"/> - <step name="createProducts" module="Magento_Catalog" next="createTaxRule"/> - <step name="createTaxRule" module="Magento_Tax" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"/> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="fillAccountInformation"/> - <step name="fillAccountInformation" module="Magento_Sales" next="updateProductsData"/> - <step name="updateProductsData" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> - <scenario name="MoveRecentlyViewedProductsOnOrderPageTest" firstStep="createProducts"> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"> - <item name="customer"> - <item name="dataSet" value="default"/> - </item> - </step> - <step name="loginCustomerOnFrontend" module="Magento_Customer" next="openProductsOnFrontend"/> - <step name="openProductsOnFrontend" module="Magento_Catalog" next="openCustomerOnBackend"/> - <step name="openCustomerOnBackend" module="Magento_Customer" next="createOrderFromCustomerAccount"/> - <step name="createOrderFromCustomerAccount" module="Magento_Customer" next="addRecentlyViewedProductsToCart"/> - <step name="addRecentlyViewedProductsToCart" module="Magento_Sales" next="configureProducts"/> - <step name="configureProducts" module="Magento_Sales"/> - </scenario> - <scenario name="PrintOrderFrontendGuestTest" firstStep="createProducts"> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> - <item name="customer"> - <item name="dataSet" value="johndoe_with_addresses"/> - </item> - </step> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"> - <item name="billingAddress"> - <item name="dataSet" value="customer_US"/> - </item> - </step> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"> - <item name="payment"> - <item name="method" value="checkmo"/> - </item> - </step> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales" next="openSalesOrderOnFrontendForGuest"/> - <step name="openSalesOrderOnFrontendForGuest" module="Magento_Sales" next="printOrderOnFrontend"/> - <step name="printOrderOnFrontend" module="Magento_Sales"/> - </scenario> + <scenario name="ReorderOrderEntityTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createOrder" /> + <step name="createOrder" module="Magento_Sales" next="openOrder" /> + <step name="openOrder" module="Magento_Sales" next="reorder" /> + <step name="reorder" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> + <scenario name="CreateOrderBackendTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts" /> + <step name="createProducts" module="Magento_Catalog" next="createTaxRule" /> + <step name="createTaxRule" module="Magento_Tax" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders" /> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="fillAccountInformation" /> + <step name="fillAccountInformation" module="Magento_Sales" next="updateProductsData" /> + <step name="updateProductsData" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> + <scenario name="MoveRecentlyViewedProductsOnOrderPageTest" firstStep="createProducts"> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"> + <item name="customer"> + <item name="dataSet" value="default" /> + </item> + </step> + <step name="loginCustomerOnFrontend" module="Magento_Customer" next="openProductsOnFrontend" /> + <step name="openProductsOnFrontend" module="Magento_Catalog" next="openCustomerOnBackend" /> + <step name="openCustomerOnBackend" module="Magento_Customer" next="createOrderFromCustomerAccount" /> + <step name="createOrderFromCustomerAccount" module="Magento_Customer" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addRecentlyViewedProductsToCart" /> + <step name="addRecentlyViewedProductsToCart" module="Magento_Sales" next="configureProducts" /> + <step name="configureProducts" module="Magento_Sales" /> + </scenario> + <scenario name="PrintOrderFrontendGuestTest" firstStep="createProducts"> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> + <item name="customer"> + <item name="dataSet" value="johndoe_with_addresses" /> + </item> + </step> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"> + <item name="billingAddress"> + <item name="dataSet" value="customer_US" /> + </item> + </step> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"> + <item name="payment"> + <item name="method" value="checkmo" /> + </item> + </step> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" next="openSalesOrderOnFrontendForGuest" /> + <step name="openSalesOrderOnFrontendForGuest" module="Magento_Sales" next="printOrderOnFrontend" /> + <step name="printOrderOnFrontend" module="Magento_Sales" /> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..14a87c13b7efc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest83"> + <data name="menuItem" xsi:type="string">Marketing > Cart Price Rules</data> + <data name="pageTitle" xsi:type="string">Cart Price Rules</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php index 670aca38ebfd3..c8b09124666bd 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php @@ -62,8 +62,7 @@ protected function getSitemapId(array $data) { //Sort data in grid to define sitemap id if more than 20 items in grid $url = 'admin/sitemap/index/sort/sitemap_id/dir/desc'; - $pattern = '/class=\" col\-id col\-sitemap_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['sitemap_filename'] . '/siu'; + $pattern = '/col-sitemap_id\W*(\d+)<.td><[^<>]*?>' . $data['sitemap_filename'] . '/siu'; $extractor = new Extractor($url, $pattern); $match = $extractor->getData(); diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..fbebdaee2d655 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest85"> + <data name="menuItem" xsi:type="string">Marketing > Site Map</data> + <data name="pageTitle" xsi:type="string">Site Map</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php index 3e796d62655d4..3e23c4cbfb1d7 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php @@ -34,6 +34,7 @@ class CreateStoreEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml index 1da9ff702e422..4ba86215b1c13 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml @@ -6,39 +6,52 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Store\Test\TestCase\CreateStoreEntityTest"> - <variation name="CreateStoreEntityTestVariation1"> - <data name="store/data/group_id/dataSet" xsi:type="string">default</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Enabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend"/> - </variation> - <variation name="CreateStoreEntityTestVariation2"> - <data name="store/data/group_id/dataSet" xsi:type="string">default</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Disabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreNotOnFrontend"/> - </variation> - <variation name="CreateStoreEntityTestVariation3"> - <data name="store/data/group_id/dataSet" xsi:type="string">custom</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Enabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend"/> - </variation> - </testCase> + <testCase name="Magento\Store\Test\TestCase\CreateStoreEntityTest"> + <variation name="CreateStoreEntityTestVariation1"> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation2"> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Disabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreNotOnFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation3"> + <data name="store/data/group_id/dataSet" xsi:type="string">custom</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation4"> + <data name="description" xsi:type="string">MAGETWO-12405: Create New Localized Store View</data> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">DE_%isolation%</data> + <data name="store/data/code" xsi:type="string">de_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <data name="locale" xsi:type="string">German (Germany)</data> + <data name="welcomeText" xsi:type="string">Den gesamten Shop durchsuchen</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Backend\Test\Constraint\AssertStoreCanBeLocalized" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php deleted file mode 100644 index ab189ce353019..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Store test - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Store\Test\TestCase; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\TestCase\Functional; - -class StoreTest extends Functional -{ - /* tags */ - const TEST_TYPE = 'acceptance_test'; - /* end tags */ - - /** - * Login into backend area before test - */ - protected function setUp() - { - Factory::getApp()->magentoBackendLoginUser(); - } - - /** - * @ZephyrId MAGETWO-12405 - */ - public function testCreateNewLocalizedStoreView() - { - $objectManager = Factory::getObjectManager(); - $storeFixture = $objectManager->create('Magento\Store\Test\Fixture\Store', ['dataSet' => 'german']); - - $storeListPage = Factory::getPageFactory()->getAdminSystemStore(); - $storeListPage->open(); - $storeListPage->getGridPageActions()->addStoreView(); - - $newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore(); - $newStorePage->getStoreForm()->fill($storeFixture); - $newStorePage->getFormPageActions()->save(); - $storeListPage->getMessagesBlock()->waitSuccessMessage(); - $this->assertContains( - 'The store view has been saved', - $storeListPage->getMessagesBlock()->getSuccessMessages() - ); - $this->assertTrue( - $storeListPage->getStoreGrid()->isStoreExists($storeFixture->getName()) - ); - - $cachePage = Factory::getPageFactory()->getAdminCache(); - $cachePage->open(); - $cachePage->getActionsBlock()->flushCacheStorage(); - $cachePage->getMessagesBlock()->waitSuccessMessage(); - - $configPage = Factory::getPageFactory()->getAdminSystemConfig(); - $configPage->open(); - $configPage->getPageActions()->selectStore($storeFixture->getGroupId() . "/" . $storeFixture->getName()); - $configGroup = $configPage->getForm()->getGroup('Locale Options'); - $configGroup->open(); - $configGroup->setValue('select-groups-locale-fields-code-value', 'German (Germany)'); - $configPage->getPageActions()->save(); - $configPage->getMessagesBlock()->waitSuccessMessage(); - - $homePage = Factory::getPageFactory()->getCmsIndexIndex(); - $homePage->open(); - - $homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName()); - $this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen')); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php index 4c5e2cabf1c61..b5631910c0d44 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php @@ -141,7 +141,9 @@ public function processAssert( $checkoutCart->open()->getCartBlock()->clearShoppingCart(); $browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCart(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); // Estimate Shipping and Tax + $checkoutCart->open(); $checkoutCart->getShippingBlock()->openEstimateShippingAndTax(); $checkoutCart->getShippingBlock()->fill($address); $checkoutCart->getShippingBlock()->clickGetQuote(); diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php index 997d0600cc759..b40b943db5786 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php @@ -6,8 +6,8 @@ namespace Magento\Tax\Test\Fixture\TaxRule; +use Magento\Mtf\Fixture\DataSource; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; /** * Class TaxClass @@ -15,23 +15,17 @@ * Data keys: * - dataSet */ -class TaxClass implements FixtureInterface +class TaxClass extends DataSource { /** - * Array with tax class names - * - * @var array - */ - protected $data; - - /** - * Array with tax class fixtures + * Array with tax class fixtures. * * @var array */ protected $fixture; /** + * @constructor * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data @@ -42,51 +36,16 @@ public function __construct(FixtureFactory $fixtureFactory, array $params, array if (isset($data['dataSet'])) { $dataSets = $data['dataSet']; foreach ($dataSets as $dataSet) { - if ($dataSet !== '-') { - /** @var \Magento\Tax\Test\Fixture\TaxClass $taxClass */ - $taxClass = $fixtureFactory->createByCode('taxClass', ['dataSet' => $dataSet]); - $this->fixture[] = $taxClass; - $this->data[] = $taxClass->getClassName(); - } + /** @var \Magento\Tax\Test\Fixture\TaxClass $taxClass */ + $taxClass = $fixtureFactory->createByCode('taxClass', ['dataSet' => $dataSet]); + $this->fixture[] = $taxClass; + $this->data[] = $taxClass->getClassName(); } } } /** - * Persist custom selections tax classes - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * Return tax class fixture + * Return tax class fixture. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php index aacc3a65e7ab9..238a754ee6048 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php @@ -6,8 +6,8 @@ namespace Magento\Tax\Test\Fixture\TaxRule; +use Magento\Mtf\Fixture\DataSource; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; /** * Class TaxRate @@ -15,23 +15,17 @@ * Data keys: * - dataSet */ -class TaxRate implements FixtureInterface +class TaxRate extends DataSource { /** - * Array with tax rates codes - * - * @var array - */ - protected $data; - - /** - * Array with tax rate fixtures + * Array with tax rate fixtures. * * @var array */ protected $fixture; /** + * @constructor * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data @@ -42,51 +36,16 @@ public function __construct(FixtureFactory $fixtureFactory, array $params, array if (isset($data['dataSet'])) { $dataSets = $data['dataSet']; foreach ($dataSets as $dataSet) { - if ($dataSet !== '-') { - /** @var \Magento\Tax\Test\Fixture\TaxRate $taxRate */ - $taxRate = $fixtureFactory->createByCode('taxRate', ['dataSet' => $dataSet]); - $this->fixture[] = $taxRate; - $this->data[] = $taxRate->getCode(); - } + /** @var \Magento\Tax\Test\Fixture\TaxRate $taxRate */ + $taxRate = $fixtureFactory->createByCode('taxRate', ['dataSet' => $dataSet]); + $this->fixture[] = $taxRate; + $this->data[] = $taxRate->getCode(); } } } /** - * Persist custom selections tax rates - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * Return tax rate fixtures + * Return tax rate fixtures. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php index a183fa5490125..28e77379db72e 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php @@ -14,13 +14,12 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating customer and product tax class + * Curl handler for creating customer and product tax class. */ class Curl extends AbstractCurl implements TaxClassInterface { /** - * Post request for creating tax class + * Post request for creating tax class. * * @param FixtureInterface $fixture [optional] * @return mixed|string @@ -29,7 +28,7 @@ public function persist(FixtureInterface $fixture = null) { $data = $fixture->getData(); - $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSAve/?isAjax=true'; + $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSave/?isAjax=true'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); @@ -40,7 +39,7 @@ public function persist(FixtureInterface $fixture = null) } /** - * Return saved class id if saved + * Return saved class id if saved. * * @param $response * @return int|null diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml index fe148b022e717..b8770c32386bd 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml @@ -6,82 +6,72 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\CreateTaxRuleEntityTest"> - <variation name="CreateTaxRuleEntityTestVariation1"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation2"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">1</data> - <data name="taxRule/data/position" xsi:type="string">1</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation3"> - <data name="description" xsi:type="string">Creating tax rule with new tax classes and tax rate</data> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">1</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation4"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/priority" xsi:type="string">1</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation5"> - <data name="description" xsi:type="string">MAGETWO-12438: Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class</data> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-*-Rate 1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">us_ny_rate_8_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">Retail Customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="tag" xsi:type="string">bamboo_plan:end_to_end,test_type:acceptance_test</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\CreateTaxRuleEntityTest"> + <variation name="CreateTaxRuleEntityTestVariation1"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation2"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/priority" xsi:type="string">1</data> + <data name="taxRule/data/position" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation3"> + <data name="description" xsi:type="string">Creating tax rule with new tax classes and tax rate</data> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/position" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation4"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/priority" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation5"> + <data name="description" xsi:type="string">MAGETWO-12438: Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class</data> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-*-Rate 1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">us_ny_rate_8_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="tag" xsi:type="string">bamboo_plan:end_to_end,test_type:acceptance_test</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php index 3c8e925589b39..bef4c799b43f3 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php @@ -6,26 +6,22 @@ namespace Magento\Tax\Test\TestCase; -use Magento\Customer\Test\Fixture\Address; use Magento\Tax\Test\Fixture\TaxRule; use Magento\Tax\Test\Page\Adminhtml\TaxRuleIndex; use Magento\Tax\Test\Page\Adminhtml\TaxRuleNew; -use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Delete TaxRuleEntity - * - * Test Flow: * Preconditions: - * 1. Tax Rule is created + * 1. Tax Rule is created. * * Steps: * 1. Log in as default admin user. - * 2. Go to Sales > Tax Rules - * 3. Select required tax rule from preconditions - * 4. Click on the "Delete Rule" button - * 5. Perform all assertions + * 2. Go to Sales > Tax Rules. + * 3. Select required tax rule from preconditions. + * 4. Click on the "Delete Rule" button. + * 5. Perform all assertions. * * @group Tax_(CS) * @ZephyrId MAGETWO-20924 @@ -38,35 +34,34 @@ class DeleteTaxRuleEntityTest extends Injectable /* end tags */ /** - * Tax Rule grid page + * Tax Rule grid page. * * @var TaxRuleIndex */ protected $taxRuleIndexPage; /** - * Tax Rule new and edit page + * Tax Rule new and edit page. * * @var TaxRuleNew */ protected $taxRuleNewPage; /** - * Preparing data + * Create customer. * - * @param FixtureFactory $fixtureFactory + * @param Customer $customer * @return array */ - public function __prepare(FixtureFactory $fixtureFactory) + public function __prepare(Customer $customer) { - $customer = $fixtureFactory->createByCode('customer', ['dataSet' => 'default']); $customer->persist(); return ['customer' => $customer]; } /** - * Injection data + * Inject pages. * * @param TaxRuleIndex $taxRuleIndexPage * @param TaxRuleNew $taxRuleNewPage @@ -80,28 +75,19 @@ public function __inject( } /** - * Delete Tax Rule Entity test + * Delete Tax Rule Entity test. * * @param TaxRule $taxRule - * @param Address $address - * @param array $shipping - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @return void */ - public function testDeleteTaxRule( - TaxRule $taxRule, - Address $address, - array $shipping - ) { + public function testDeleteTaxRule(TaxRule $taxRule) + { // Precondition $taxRule->persist(); // Steps - $filters = [ - 'code' => $taxRule->getCode(), - ]; $this->taxRuleIndexPage->open(); - $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen($filters); + $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen(['code' => $taxRule->getCode()]); $this->taxRuleNewPage->getFormPageActions()->delete(); } } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml index 86c84ac32a392..8c8aa1e3888b4 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml @@ -6,18 +6,18 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\DeleteTaxRuleEntityTest"> - <variation name="DeleteTaxRuleEntityTestVariation1"> - <data name="taxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">California</data> - <data name="address/data/postcode" xsi:type="string">90001</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessDeleteMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleNotInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\DeleteTaxRuleEntityTest"> + <variation name="DeleteTaxRuleEntityTestVariation1"> + <data name="taxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">90001</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessDeleteMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleNotInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..2b07ad78838c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest87"> + <data name="menuItem" xsi:type="string">Stores > Tax Rules</data> + <data name="pageTitle" xsi:type="string">Tax Rules</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest88"> + <data name="menuItem" xsi:type="string">Stores > Tax Zones and Rates</data> + <data name="pageTitle" xsi:type="string">Tax Zones and Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest89"> + <data name="menuItem" xsi:type="string">System > Import/Export Tax Rates</data> + <data name="pageTitle" xsi:type="string">Import and Export Tax Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml index 48c142a660842..1cc98aeb5bf1a 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml @@ -6,84 +6,63 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\UpdateTaxRuleEntityTest"> - <variation name="UpdateTaxRuleEntityTestVariation1"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_default</data> - <data name="address/data/country_id" xsi:type="string">-</data> - <data name="address/data/region_id" xsi:type="string">-</data> - <data name="address/data/postcode" xsi:type="string">-</data> - <data name="shipping/carrier" xsi:type="string">-</data> - <data name="shipping/method" xsi:type="string">-</data> - <data name="shipping/price" xsi:type="string">-</data> - <data name="taxRule/data/code" xsi:type="string">New Tax Rule name%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/priority" xsi:type="string">2</data> - <data name="taxRule/data/position" xsi:type="string">2</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation2"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">-</data> - <data name="address/data/region_id" xsi:type="string">-</data> - <data name="address/data/postcode" xsi:type="string">-</data> - <data name="shipping/carrier" xsi:type="string">-</data> - <data name="shipping/method" xsi:type="string">-</data> - <data name="shipping/price" xsi:type="string">-</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">taxable_goods</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation3"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">Utah</data> - <data name="address/data/postcode" xsi:type="string">84001</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">us_ut_fixed_zip_rate_20</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsApplied"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation4"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">Idaho</data> - <data name="address/data/postcode" xsi:type="string">83201</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withFixedZip</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\UpdateTaxRuleEntityTest"> + <variation name="UpdateTaxRuleEntityTestVariation1"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_default</data> + <data name="taxRule/data/code" xsi:type="string">New Tax Rule name%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/priority" xsi:type="string">2</data> + <data name="taxRule/data/position" xsi:type="string">2</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation2"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">taxable_goods</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation3"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">Utah</data> + <data name="address/data/postcode" xsi:type="string">84001</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">us_ut_fixed_zip_rate_20</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsApplied" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation4"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">Idaho</data> + <data name="address/data/postcode" xsi:type="string">83201</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withFixedZip</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php index dd7936803646c..027b1ca6ec7ff 100644 --- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php @@ -57,6 +57,24 @@ public function isLinkVisible($linkTitle) return $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH)->isVisible(); } + /** + * Wait for link is visible. + * + * @param string $linkTitle + * @return void + */ + public function waitLinkIsVisible($linkTitle) + { + $browser = $this->_rootElement; + $selector = sprintf($this->link, $linkTitle); + $browser->waitUntil( + function () use ($browser, $selector) { + $element = $browser->find($selector, Locator::SELECTOR_XPATH); + return $element->isVisible() ? true : null; + } + ); + } + /** * Get the number of products added to compare list. * diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..4fb8159fe9870 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest90"> + <data name="menuItem" xsi:type="string">Content > Themes</data> + <data name="pageTitle" xsi:type="string">Themes</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php index dcae5848887be..373c6c4cabd7c 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php @@ -12,13 +12,12 @@ use Magento\Mtf\Fixture\FixtureInterface; /** - * Class UrlRewriteForm - * Catalog URL rewrite edit form + * Catalog URL rewrite edit form. */ class UrlRewriteForm extends Form { /** - * Fill the root form + * Fill the root form. * * @param FixtureInterface $fixture * @param SimpleElement|null $element diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php index 8b176051fc183..9dc49ec06a9ba 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php @@ -29,7 +29,7 @@ public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, { $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath()); $entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity(); - $title = $entity->hasData('name') ? $entity->getName() : $entity->getTitle(); + $title = $entity->hasData('name') ? $entity->getName() : $entity->getContentHeading(); $pageTitle = $cmsIndex->getTitleBlock()->getTitle(); \PHPUnit_Framework_Assert::assertEquals( $pageTitle, diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..3423afc8018e0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest91"> + <data name="menuItem" xsi:type="string">Marketing > URL Rewrites</data> + <data name="pageTitle" xsi:type="string">URL Rewrites</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php index 8c034e549edfa..3127b4b3f195a 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\Constraint; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\Constraint\AbstractConstraint; @@ -19,14 +19,14 @@ class AssertRoleInGrid extends AbstractConstraint * Asserts that saved role is present in Role Grid. * * @param UserRoleIndex $rolePage - * @param AdminUserRole $role - * @param AdminUserRole $roleInit + * @param Role $role + * @param Role $roleInit * @return void */ public function processAssert( UserRoleIndex $rolePage, - AdminUserRole $role, - AdminUserRole $roleInit = null + Role $role, + Role $roleInit = null ) { $filter = ['rolename' => $role->hasData('rolename') ? $role->getRoleName() : $roleInit->getRoleName()]; $rolePage->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php index 9615318c08384..2eb134bb51309 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\Constraint; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\Constraint\AbstractConstraint; @@ -19,12 +19,12 @@ class AssertRoleNotInGrid extends AbstractConstraint * Asserts that role is not present in Role Grid. * * @param UserRoleIndex $rolePage - * @param AdminUserRole $role + * @param Role $role * @return void */ public function processAssert( UserRoleIndex $rolePage, - AdminUserRole $role + Role $role ) { $filter = ['rolename' => $role->getRoleName()]; $rolePage->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php index 4e409ccc9f3b4..2761f88026453 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php @@ -11,7 +11,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertUserInGrid + * Asserts that user is present in User Grid. */ class AssertUserInGrid extends AbstractConstraint { @@ -20,20 +20,16 @@ class AssertUserInGrid extends AbstractConstraint * * @param UserIndex $userIndex * @param User $user - * @param User $customAdmin * @return void */ - public function processAssert( - UserIndex $userIndex, - User $user, - User $customAdmin = null - ) { - $adminUser = ($user->hasData('password') || $user->hasData('username')) ? $user : $customAdmin; - $filter = ['username' => $adminUser->getUsername()]; + public function processAssert(UserIndex $userIndex, User $user) + { + $filter = ['username' => $user->getUsername()]; + $userIndex->open(); \PHPUnit_Framework_Assert::assertTrue( $userIndex->getUserGrid()->isRowVisible($filter), - 'User with name \'' . $adminUser->getUsername() . '\' is absent in User grid.' + 'User with name \'' . $user->getUsername() . '\' is absent in User grid.' ); } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php new file mode 100644 index 0000000000000..3cc808867742e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\Constraint; + +use Magento\Backend\Test\Page\Adminhtml\Dashboard; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\User\Test\Fixture\User; + +/** + * Asserts that user has only related permissions. + */ +class AssertUserRoleRestrictedAccess extends AbstractConstraint +{ + const DENIED_ACCESS = 'Access denied'; + + /** + * Asserts that user has only related permissions. + * + * @param BrowserInterface $browser + * @param Dashboard $dashboard + * @param User $user + * @param array $restrictedAccess + * @param string $denyUrl + * @return void + */ + public function processAssert( + BrowserInterface $browser, + Dashboard $dashboard, + User $user, + array $restrictedAccess, + $denyUrl + ) { + $this->objectManager->create('Magento\User\Test\TestStep\LoginUserOnBackendStep', ['user' => $user])->run(); + + $menuItems = $dashboard->getMenuBlock()->getTopMenuItems(); + \PHPUnit_Framework_Assert::assertEquals($menuItems, $restrictedAccess, 'Wrong display menu.'); + + $browser->open($_ENV['app_backend_url'] . $denyUrl); + $deniedMessage = $dashboard->getAccessDeniedBlock()->getTextFromAccessDeniedBlock(); + \PHPUnit_Framework_Assert::assertEquals(self::DENIED_ACCESS, $deniedMessage, 'Possible access to denied page.'); + } + + /** + * Returns success message if assert true. + * + * @return string + */ + public function toString() + { + return 'Sales item is present in Menu block.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php deleted file mode 100644 index 7d1f1e298a4e6..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Constraint; - -use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Page\Adminhtml\UserIndex; -use Magento\Mtf\Constraint\AbstractConstraint; - -/** - * Class AssertUserRoleSalesRestrictedAccess - */ -class AssertUserRoleSalesRestrictedAccess extends AbstractConstraint -{ - const ROLE_RESOURCE = 'sales'; - const DENIED_ACCESS = 'Access denied'; - - /** - * Asserts that user has only Sales-related permissions - * - * @param Dashboard $dashboard - * @param UserIndex $userIndex - * @return void - */ - public function processAssert( - Dashboard $dashboard, - UserIndex $userIndex - ) { - $menuItems = $dashboard->getMenuBlock()->getTopMenuItems(); - $userIndex->open(); - $deniedMessage = $userIndex->getAccessDeniedBlock()->getTextFromAccessDeniedBlock(); - $isMenuItemSingle = (count($menuItems) == 1); - $hasSales = in_array(self::ROLE_RESOURCE, $menuItems); - \PHPUnit_Framework_Assert::assertTrue( - $hasSales && $isMenuItemSingle && (self::DENIED_ACCESS == $deniedMessage), - 'Sales item is absent in Menu block or possible access to another page, not related to Sales.' - ); - } - - /** - * Returns success message if assert true. - * - * @return string - */ - public function toString() - { - return 'Sales item is present in Menu block.'; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php index c1214de922e8d..ef60f6f470385 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php @@ -6,40 +6,25 @@ namespace Magento\User\Test\Constraint; -use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; use Magento\User\Test\Fixture\User; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertUserSuccessLogin + * Verify whether customer has logged in to the Backend. */ class AssertUserSuccessLogin extends AbstractConstraint { /** - * Verify whether customer has logged in to the Backend + * Verify whether customer has logged in to the Backend. * * @param User $user - * @param AdminAuthLogin $adminAuth * @param Dashboard $dashboard - * @param User $customAdmin - * @internal param null|string $userToLoginInAssert * @return void */ - public function processAssert( - User $user, - AdminAuthLogin $adminAuth, - Dashboard $dashboard, - User $customAdmin = null - ) { - $adminAuth->open(); - $adminUser = $customAdmin === null ? $user : $customAdmin; - if ($dashboard->getAdminPanelHeader()->isVisible()) { - $dashboard->getAdminPanelHeader()->logOut(); - } - $adminAuth->getLoginBlock()->fill($adminUser); - $adminAuth->getLoginBlock()->submit(); - + public function processAssert(User $user, Dashboard $dashboard) + { + $this->objectManager->create('Magento\User\Test\TestStep\LoginUserOnBackendStep', ['user' => $user])->run(); \PHPUnit_Framework_Assert::assertTrue( $dashboard->getAdminPanelHeader()->isLoggedIn(), 'Admin user was not logged in.' @@ -47,7 +32,7 @@ public function processAssert( } /** - * Returns success message if equals to expected message + * Returns success message if equals to expected message. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php deleted file mode 100644 index 669ab32c19e25..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Fixture\DataFixture; -use Magento\Mtf\ObjectManager; -use Magento\Mtf\Config; - -/** - * Fixture with all necessary data for user creation on backend - * - */ -class AdminUser extends DataFixture -{ - /** - * @param Config $configuration - * @param array $placeholders - */ - public function __construct(Config $configuration, $placeholders = []) - { - $placeholders['password'] = isset($placeholders['password']) ? $placeholders['password'] : '123123q'; - parent::__construct($configuration, $placeholders); - $this->_placeholders['sales_all_scopes'] = [$this, 'roleProvider']; - } - - /** - * Retrieve specify data from role.trieve specify data from role. - * - * @param $roleName - * @return mixed - */ - protected function roleProvider($roleName) - { - $role = Factory::getFixtureFactory()->getMagentoUserRole(); - $role->switchData($roleName); - $data = $role->persist(); - return $data['id']; - } - - /** - * initialize data - */ - protected function _initData() - { - /** @var \Magento\Mtf\Config $systemConfig */ - $systemConfig = ObjectManager::getInstance()->create('Magento\Mtf\Config'); - $superAdminPassword = $systemConfig->get('application/backendPassword'); - $this->_data = [ - 'fields' => [ - 'email' => [ - 'value' => 'email%isolation%@example.com', - ], - 'firstname' => [ - 'value' => 'firstname%isolation%', - ], - 'lastname' => [ - 'value' => 'lastname%isolation%', - ], - 'password' => [ - 'value' => '%password%', - ], - 'password_confirmation' => [ - 'value' => '%password%', - ], - 'roles' => [ - 'value' => ['1'], - ], - 'username' => [ - 'value' => 'admin%isolation%', - ], - 'current_password' => [ - 'value' => $superAdminPassword, - ], - ], - ]; - } - - /** - * @return string - */ - public function getEmail() - { - return $this->getData('fields/email/value'); - } - - /** - * @return string - */ - public function getPassword() - { - return $this->getData('fields/password/value'); - } - - /** - * @return string - */ - public function getUsername() - { - return $this->getData('fields/username/value'); - } - - /** - * Create user - */ - public function persist() - { - Factory::getApp()->magentoUserCreateUser($this); - } - - /** - * Set password for user - * - * @param string $password - */ - public function setPassword($password) - { - $this->_data['fields']['password']['value'] = $password; - $this->_data['fields']['password_confirmation']['value'] = $password; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml deleted file mode 100644 index 3cdab7dfc0b11..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="adminUserRole" module="Magento_User" type="flat" entity_type="authorization_role" collection="Magento\User\Model\Resource\Role\User\Collection" repository_class="Magento\User\Test\Repository\AdminUserRole" handler_interface="Magento\User\Test\Handler\AdminUserRole\AdminUserRoleInterface" class="Magento\User\Test\Fixture\AdminUserRole"> - <dataset name="default"> - <field name="rolename" xsi:type="string">AdminRole%isolation%</field> - <field name="resource_access" xsi:type="string">All</field> - </dataset> - <field name="role_id" is_required="1"> - <default_value xsi:type="null"/> - </field> - <field name="parent_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="tree_level" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="sort_order" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="role_type" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="user_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="rolename" is_required="" group="role-info"> - <default_value xsi:type="string">AdminRole%isolation%</default_value> - </field> - <field name="user_type" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="resource_access" group="role-resources"> - <default_value xsi:type="string">All</default_value> - </field> - <field name="roles_resources" group="role-resources"/> - <field name="in_role_users" group="in_role_users" source="Magento\User\Test\Fixture\AdminUserRole\InRoleUsers"/> - </fixture> -</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php deleted file mode 100644 index 89e81d3e7b73d..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Fixture\DataFixture; - -/** - * ACL resources fixture - * - */ -class Resource extends DataFixture -{ - /** - * resources from the three in array - * key is resource id, value is parent id - * - * @var array - */ - protected $resources = [ - 'Magento_Backend::dashboard' => null, - 'Magento_Sales::sales' => null, - 'Magento_Sales::sales_operation' => 'Magento_Sales::sales', - 'Magento_Sales::sales_order' => 'Magento_Sales::sales_operation', - 'Magento_Sales::actions' => 'Magento_Sales::sales_order', - 'Magento_Sales::create' => 'Magento_Sales::actions', - 'Magento_Sales::actions_view' => 'Magento_Sales::actions', - 'Magento_Sales::email' => 'Magento_Sales::actions', - 'Magento_Sales::reorder' => 'Magento_Sales::actions', - 'Magento_Sales::actions_edit' => 'Magento_Sales::actions', - 'Magento_Sales::cancel' => 'Magento_Sales::actions', - 'Magento_Sales::review_payment' => 'Magento_Sales::actions', - 'Magento_Sales::capture' => 'Magento_Sales::actions', - 'Magento_Sales::invoice' => 'Magento_Sales::actions', - 'Magento_Sales::creditmemo' => 'Magento_Sales::actions', - 'Magento_Sales::hold' => 'Magento_Sales::actions', - 'Magento_Sales::unhold' => 'Magento_Sales::actions', - 'Magento_Sales::ship' => 'Magento_Sales::actions', - 'Magento_Sales::comment' => 'Magento_Sales::actions', - 'Magento_Sales::emails' => 'Magento_Sales::actions', - 'Magento_Sales::sales_invoice' => 'Magento_Sales::sales_operation', - 'Magento_Sales::shipment' => 'Magento_Sales::sales_operation', - 'Magento_Sales::sales_creditmemo' => 'Magento_Sales::sales_operation', - 'Magento_Paypal::billing_agreement' => 'Magento_Sales::sales_operation', - 'Magento_Paypal::billing_agreement_actions' => 'Magento_Paypal::billing_agreement', - 'Magento_Paypal::billing_agreement_actions_view' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Paypal::actions_manage' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Paypal::use' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Sales::transactions' => 'Magento_Sales::sales_operation', - 'Magento_Sales::transactions_fetch' => 'Magento_Sales::transactions', - ]; - - /** - * {@inheritdoc} - */ - protected function _initData() - { - } - - /** - * Just a stub of inherited method - * - * @throws \BadMethodCallException - */ - public function persist() - { - throw new \BadMethodCallException('This method is not applicable here. It is data provider for role fixture'); - } - - /** - * Return requested resource, all it's children and parents - * - * @param string $resourceId - * @throws \InvalidArgumentException - * @return array - */ - public function get($resourceId = null) - { - if (!array_key_exists($resourceId, $this->resources)) { - throw new \InvalidArgumentException('No resource "' . $resourceId . '" found'); - } - $withParents = $this->getParents($resourceId); - $withParents[] = $resourceId; - return array_merge($withParents, $this->getChildren($resourceId)); - } - - /** - * Get all direct parents - * - * @param string $resourceId - * @return array - */ - protected function getParents($resourceId) - { - if (is_null($this->resources[$resourceId])) { - return []; - } - - $parents = []; - $current = $this->resources[$resourceId]; - - while (!is_null($this->resources[$current])) { - $parents[] = $current; - $current = $this->resources[$current]; - } - $parents[] = $current; - - return $parents; - } - - /** - * Get all child resources - * - * @param string $resourceId - * @return array - */ - protected function getChildren($resourceId) - { - $children = array_keys($this->resources, $resourceId); - $result = $children; - foreach ($children as $child) { - $result = array_merge($result, $this->getChildren($child)); - } - return $result; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php deleted file mode 100644 index acb266f5d6c69..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Fixture\DataFixture; - -/** - * Class Role - * - */ -class Role extends DataFixture -{ - /** - * {@inheritdoc} - */ - public function persist() - { - return Factory::getApp()->magentoUserCreateRole($this); - } - - /** - * {@inheritdoc} - */ - protected function _initData() - { - $this->_repository = Factory::getRepositoryFactory() - ->getMagentoUserRole($this->_dataConfig, $this->_data); - } - - /** - * Set custom ACL resource array to role - * - * @param array $resource - */ - public function setResource(array $resource) - { - $this->_data['fields']['resource']['value'] = $resource; - } - - /** - * Merge resource array with existing values - * - * @param array $resource - */ - public function addResource(array $resource) - { - $this->_data['fields']['resource']['value'] = array_merge_recursive( - $this->_data['fields']['resource']['value'], - $resource - ); - } - - /** - * Set websites of stores if current data set works with them - * - * @param array $items - * @throws \InvalidArgumentException - */ - public function setScopeItems(array $items) - { - if (array_key_exists('gws_store_groups', $this->_data['fields'])) { - $scope = 'gws_store_groups'; - } elseif (array_key_exists('gws_websites', $this->_data['fields'])) { - $scope = 'gws_websites'; - } else { - throw new \InvalidArgumentException('Current data set doesn\'t work with stores and websites'); - } - $this->_data['fields'][$scope]['value'] = $items; - } - - /** - * Convert data from canonical array to repository native format - * - * @param array $data - * @return array - */ - protected function convertData(array $data) - { - $result = []; - foreach ($data as $key => $value) { - $result['fields'][$key]['value'] = $value; - } - return $result; - } - - /** - * Save custom data set to repository - * - * @param string $name - * @param array $data - * @param bool $convert convert data from canonical array to repository native format - */ - public function save($name, array $data, $convert = true) - { - if ($convert) { - $data = $this->convertData($data); - } - $this->_repository->set($name, $data); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml new file mode 100644 index 0000000000000..671556ced6002 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="role" module="Magento_User" type="flat" entity_type="authorization_role" collection="Magento\User\Model\Resource\Role\User\Collection" repository_class="Magento\User\Test\Repository\Role" handler_interface="Magento\User\Test\Handler\Role\RoleInterface" class="Magento\User\Test\Fixture\Role"> + <dataset name="default"> + <field name="rolename" xsi:type="string">AdminRole%isolation%</field> + <field name="resource_access" xsi:type="string">All</field> + </dataset> + <field name="role_id" is_required="1"> + <default_value xsi:type="null"/> + </field> + <field name="parent_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="tree_level" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="role_type" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="user_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="rolename" is_required="" group="role-info"> + <default_value xsi:type="string">AdminRole%isolation%</default_value> + </field> + <field name="user_type" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="resource_access" group="role-resources"> + <default_value xsi:type="string">All</default_value> + </field> + <field name="roles_resources" group="role-resources"/> + <field name="in_role_users" group="in_role_users" source="Magento\User\Test\Fixture\Role\InRoleUsers"/> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php similarity index 97% rename from dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php rename to dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php index eb1f27ccdc821..bd716bbeabb47 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\User\Test\Fixture\AdminUserRole; +namespace Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\Mtf\Fixture\FixtureFactory; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php index 6ee9c5eb5ed81..93e9e336080fe 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php @@ -6,12 +6,12 @@ namespace Magento\User\Test\Fixture\User; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\FixtureInterface; /** - * Class RoleId + * Source for Role of User. * * Data keys: * - dataSet @@ -20,14 +20,14 @@ class RoleId implements FixtureInterface { /** - * Admin User Role + * Admin User Role. * - * @var AdminUserRole + * @var Role */ protected $role; /** - * User role name + * User role name. * * @var string */ @@ -43,20 +43,23 @@ public function __construct(FixtureFactory $fixtureFactory, array $params, array { $this->params = $params; if (isset($data['dataSet']) && $data['dataSet'] !== '-') { - $this->role = $fixtureFactory->createByCode('adminUserRole', ['dataSet' => $data['dataSet']]); + list($fixtureCode, $dataSet) = explode('::', $data['dataSet']); + $this->role = $fixtureFactory->createByCode($fixtureCode, ['dataSet' => $dataSet]); if (!$this->role->hasData('role_id')) { $this->role->persist(); } $this->data = $this->role->getRoleName(); } - if (isset($data['role']) && $data['role'] instanceof AdminUserRole) { + if (isset($data['role']) && $data['role'] instanceof Role) { $this->role = $data['role']; $this->data = $data['role']->getRoleName(); + } elseif (isset($data['value'])) { + $this->data = $data['value']; } } /** - * Persist user role + * Persist user role. * * @return void */ @@ -66,7 +69,7 @@ public function persist() } /** - * Return prepared data set + * Return prepared data set. * * @param string $key [optional] * @return string|null @@ -79,7 +82,7 @@ public function getData($key = null) } /** - * Return data set configuration settings + * Return data set configuration settings. * * @return array */ @@ -89,9 +92,9 @@ public function getDataConfig() } /** - * Return role fixture + * Return role fixture. * - * @return AdminUserRole + * @return Role */ public function getRole() { diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php deleted file mode 100644 index faec3b0798ed3..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\AdminUserRole; - -use Magento\Backend\Test\Handler\Extractor; -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl as AbstractCurl; -use Magento\Mtf\Config; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Class Curl - * Creates Admin User role - */ -class Curl extends AbstractCurl implements AdminUserRoleInterface -{ - /** - * Curl creation of Admin User Role - * - * @param FixtureInterface $fixture - * @return array|mixed - * @throws \Exception - * - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function persist(FixtureInterface $fixture = null) - { - $data = $fixture->getData(); - $data['all'] = ($data['resource_access'] == 'All') ? 1 : 0; - if (isset($data['roles_resources'])) { - foreach ((array)$data['roles_resources'] as $resource) { - $data['resource'][] = $resource; - } - } - unset($data['roles_resources']); - $data['gws_is_all'] = (isset($data['gws_is_all'])) ? $data['gws_is_all'] : '1'; - if ($fixture->hasData('in_role_user')) { - $adminUsers = $fixture->getDataFieldConfig('in_role_user')['source']->getAdminUsers(); - $userIds = []; - foreach ($adminUsers as $adminUser) { - $userIds[] = $adminUser->getUserId() . "=true"; - } - $data['in_role_user'] = implode('&', $userIds); - } - $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/active_tab/info/'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception("Role creating by curl handler was not successful! Response: $response"); - } - - $url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/'; - $regExpPattern = '/class=\"\scol\-id col\-role_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['rolename'] . '/siu'; - - $extractor = new Extractor($url, $regExpPattern); - - return ['role_id' => $extractor->getData()[1]]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php deleted file mode 100644 index 8c5e8cde4eb08..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\Curl; - -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl; -use Magento\Mtf\Config; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Class CreateCategory. - * Curl handler for creating category. - * - */ -class CreateRole extends Curl -{ - /** - * Convert array from canonical to UI format - * - * @param array $fields - * @return array - */ - protected function _preparePostData(array $fields) - { - $data = []; - foreach ($fields as $key => $value) { - $data[$key] = $value['value']; - } - return $data; - } - - /** - * Look for role id on grid - * - * @param string $name - * @param string $page - * @return bool|string - */ - protected function findRoleOnPage($name, $page) - { - $dom = new \DOMDocument(); - $dom->loadHTML($page); - $xpath = new \DOMXPath($dom); - $row = '//tr[td[@data-column="role_name" and contains(text(),"' . $name . '")]]'; - $nodes = $xpath->query($row . '/td[@data-column="role_id"]'); - if ($nodes->length == 0) { - return false; - } - $node = $nodes->item(0); - $id = trim($node->nodeValue); - return $id; - } - - /** - * Send POST request with encoded filter parameters in URL - * - * @param $name - * @return string - */ - protected function filterByName($name) - { - $filter = base64_encode('role_name=' . $name); - $url = $_ENV['app_backend_url'] . 'admin/user_role/roleGrid/filter/' . $filter . '/'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->write(CurlInterface::POST, $url, '1.0', [], []); - $response = $curl->read(); - $curl->close(); - return $response; - } - - /** - * Look for needed role name and define id by name, - * if the role is absent on the page, filtering is performed - * - * @param string $name - * @param string $response - * @return bool|string - * @throws \UnderflowException - * @throws \Exception - */ - protected function findIdWithFilter($name, $response) - { - preg_match('/<table[\ \w\"\=]+id\="roleGrid_table">.*?<\/table>/siu', $response, $matches); - if (empty($matches)) { - throw new \Exception('Cannot find grid in response'); - } - $gridHtml = $matches[0]; - - $id = $this->findRoleOnPage($name, $gridHtml); - - // maybe, role is on another page, let's filter - if (false === $id) { - $newPage = $this->filterByName($name); - $id = $this->findRoleOnPage($name, $newPage); - } - - // still not found?? It's very suspicious. - if (false === $id) { - throw new \UnderflowException('Role with name "' . $name . '" not found'); - } - - return $id; - } - - /** - * Execute handler - * - * @param FixtureInterface|null $fixture [optional] - * @throws \UnexpectedValueException - * @throws \UnderflowException from findIdWithFilter - * @throws \Exception from findIdWithFilter - * @return mixed - */ - public function persist(FixtureInterface $fixture = null) - { - $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/'; - $data = $this->_preparePostData($fixture->getData('fields')); - - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \UnexpectedValueException('Success confirmation not found'); - } - - $data['id'] = $this->findIdWithFilter($data['rolename'], $response); - return $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php deleted file mode 100644 index ed2c2f0a2e039..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\Curl; - -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Curl handler for persisting Magento user - * - */ -class CreateUser extends Curl -{ - /** - * Prepare data for using in the execute method - * - * @param array $fields - * @return array - */ - protected function _prepareData(array $fields) - { - $data = []; - foreach ($fields as $key => $value) { - $data[$key] = $value['value']; - } - return $data; - } - - /** - * Get id for newly created user - * - * @param $data - * @return mixed - * @throws \Exception - */ - protected function _getUserId($data) - { - //Sort data in grid to define user id if more than 20 items in grid - $url = $_ENV['app_backend_url'] . 'admin/user/roleGrid/sort/user_id/dir/desc'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0'); - $response = $curl->read(); - $curl->close(); - preg_match( - '/class=\"\scol\-id col\-user_id\W*>\W*(\d+)\W*<\/td>\W*<td[\w\s\"=\-]*?>\W*?' . $data['username'] . '/siu', - $response, - $matches - ); - if (empty($matches)) { - throw new \Exception('Cannot find user id'); - } - return $matches[1]; - } - - /** - * Post request for creating user in backend - * - * @param FixtureInterface $fixture - * @return array|mixed - * @throws \Exception - */ - public function persist(FixtureInterface $fixture = null) - { - $url = $_ENV['app_backend_url'] . 'admin/user/save'; - $data = $this->_prepareData($fixture->getData('fields')); - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception("User creation by curl handler was not successful! Response: $response"); - } - //Sort data in grid to define user id if more than 20 items in grid - $url = $_ENV['app_backend_url'] . 'admin/user/roleGrid/sort/user_id/dir/desc'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $curl->read(); - $curl->close(); - $data['id'] = $this->_getUserId($data); - return $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php new file mode 100644 index 0000000000000..ad63a648f0bd1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php @@ -0,0 +1,142 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\Handler\Role; + +use Magento\Backend\Test\Handler\Extractor; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Handler\Curl as AbstractCurl; +use Magento\Mtf\Config; +use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Creates Admin User role. + */ +class Curl extends AbstractCurl implements RoleInterface +{ + /** + * Additional mapping values for data. + * + * @var array + */ + protected $additionalMappingData = []; + + /** + * @constructor + * @param Config $configuration + */ + public function __construct(Config $configuration) + { + $this->mappingData = array_merge( + (null !== $this->mappingData) ? $this->mappingData : [], + $this->additionalMappingData + ); + parent::__construct($configuration); + } + + /** + * Curl creation of Admin User Role. + * + * @param FixtureInterface $fixture + * @return array|mixed + * @throws \Exception + */ + public function persist(FixtureInterface $fixture = null) + { + $data = $this->prepareData($fixture); + $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/active_tab/info/'; + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + $curl->addOption(CURLOPT_HEADER, 1); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + $curl->close(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Role creating by curl handler was not successful! Response: $response"); + } + + $url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/'; + $regExpPattern = '/col\-role_id\W*(\d+)<.td><[^<>]*?>' . $data['rolename'] . '/siu'; + + $extractor = new Extractor($url, $regExpPattern); + + return ['role_id' => $extractor->getData()[1]]; + } + + /** + * Prepare fixture data before send. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture = null) + { + $data = $fixture->getData(); + $data = $this->prepareResourceAccess($data); + $data = array_merge($data, $this->prepareAssignedUsers($fixture)); + $data = array_merge($data, $this->prepareAdminScope($data)); + + return $this->replaceMappingData($data); + } + + /** + * Prepare role resources data. + * + * @param array $data + * @return array + */ + protected function prepareResourceAccess(array $data) + { + $data['all'] = ($data['resource_access'] == 'All') ? 1 : 0; + if (isset($data['roles_resources'])) { + foreach ((array)$data['roles_resources'] as $resource) { + $data['resource'][] = $resource; + } + } + + return $data; + } + + /** + * Assign users to the role. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareAssignedUsers(FixtureInterface $fixture) + { + if (!$fixture->hasData('in_role_user')) { + return []; + } + $adminUsers = $fixture->getDataFieldConfig('in_role_user')['source']->getAdminUsers(); + $userIds = []; + foreach ($adminUsers as $adminUser) { + $userIds[] = $adminUser->getUserId() . "=true"; + } + + return ['in_role_user' => implode('&', $userIds)]; + } + + // TODO: Method should be removed in scope of MAGETWO-31563 + /** + * Prepare admin gws option. + * + * @param array $data + * @return array + */ + protected function prepareAdminScope(array $data) + { + if (isset($data['gws_is_all'])) { + $data['gws_is_all'] = 'All' == $data['gws_is_all'] ? 1 : 0; + } else { + $data['gws_is_all'] = 1; + } + + return $data; + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php similarity index 53% rename from dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php rename to dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php index a7d0408abdba7..904bf57a01ca5 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php @@ -4,14 +4,14 @@ * See COPYING.txt for license details. */ -namespace Magento\User\Test\Handler\AdminUserRole; +namespace Magento\User\Test\Handler\Role; use Magento\Mtf\Handler\HandlerInterface; /** - * Interface AdminUserRoleInterface + * Interface RoleInterface */ -interface AdminUserRoleInterface extends HandlerInterface +interface RoleInterface extends HandlerInterface { // } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php index 2ba46490546be..a79b2ec796f6c 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php @@ -47,8 +47,7 @@ public function persist(FixtureInterface $fixture = null) } $url = 'admin/user/roleGrid/sort/user_id/dir/desc'; - $regExpPattern = '/class=\"\scol\-id col\-user_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['username'] . '/siu'; + $regExpPattern = '/col-user_id\W*(\d+)<.td><[^<>]*?>' . $data['username'] . '/siu'; $extractor = new Extractor($url, $regExpPattern); return ['user_id' => $extractor->getData()[1]]; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml index 93868a2d47a88..35e58ff38d2fa 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml @@ -6,10 +6,9 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="UserIndex" area="Adminhtml" mca="admin/user" module="Magento_User"> - <block name="pageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="userGrid" class="Magento\User\Test\Block\Adminhtml\UserGrid" locator="#permissionsUserGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> - <block name="accessDeniedBlock" class="Magento\Backend\Test\Block\Denied" locator="#anchor-content" strategy="css selector"/> - </page> + <page name="UserIndex" area="Adminhtml" mca="admin/user" module="Magento_User"> + <block name="pageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> + <block name="userGrid" class="Magento\User\Test\Block\Adminhtml\UserGrid" locator="#permissionsUserGrid" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php deleted file mode 100644 index 9046699e1a452..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Repository; - -use Magento\Mtf\Repository\AbstractRepository; - -/** - * Class Admin User Repository - * - */ -class AdminUser extends AbstractRepository -{ - /** - * {@inheritdoc} - */ - public function __construct(array $defaultConfig = [], array $defaultData = []) - { - $this->_data['admin_default'] = [ - 'config' => $defaultConfig, - 'data' => $defaultData, - ]; - $this->_data['user_with_sales_resource'] = $this->_getUserWithRole('sales_all_scopes'); - } - - /** - * Build data for user - * - * @param string $roleName - * @return array - */ - protected function _getUserWithRole($roleName) - { - $role = [ - 'data' => [ - 'fields' => [ - 'roles' => [ - 'value' => ["%$roleName%"], - ], - ], - ], - ]; - - return array_replace_recursive($this->_data['admin_default'], $role); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php deleted file mode 100644 index 08eb926a06a3e..0000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Repository; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Repository\AbstractRepository; - -/** - * Class Abstract Repository - * - */ -class Role extends AbstractRepository -{ - /** - * {@inheritdoc} - */ - public function __construct(array $defaultConfig = [], array $defaultData = []) - { - $this->_data['default'] = [ - 'config' => $defaultConfig, - 'data' => $defaultData, - ]; - - $this->initRoleTemplates(); - $this->initCustomRoles(); - } - - /** - * Role templates with different scopes for custom filling with resources, sites or stores - */ - protected function initRoleTemplates() - { - $dataTemplate = [ - 'fields' => [ - 'all' => [ - 'value' => 0, - ], - 'gws_is_all' => [ - 'value' => 0, - ], - 'rolename' => [ - 'value' => 'auto%isolation%', - ], - ], - ]; - - $this->_data['all_permissions_all_scopes']['data'] = $this->setPermissions( - 'all', - $this->setScope('all', $dataTemplate) - ); - - $this->_data['all_permissions_website_scope']['data'] = $this->setPermissions( - 'all', - $this->setScope('website', $dataTemplate) - ); - - $this->_data['all_permissions_store_scope']['data'] = $this->setPermissions( - 'all', - $this->setScope('store', $dataTemplate) - ); - - $this->_data['custom_permissions_all_scopes']['data'] = $this->setPermissions( - 'custom', - $this->setScope('all', $dataTemplate) - ); - - $this->_data['custom_permissions_website_scope']['data'] = $this->setPermissions( - 'custom', - $this->setScope('website', $dataTemplate) - ); - - $this->_data['custom_permissions_store_scope']['data'] = $this->setPermissions( - 'custom', - $this->setScope('store', $dataTemplate) - ); - } - - /** - * Init most popular custom roles - */ - protected function initCustomRoles() - { - $resourceFixture = Factory::getFixtureFactory()->getMagentoUserResource(); - $salesAllScopes = $this->_data['custom_permissions_all_scopes']['data']; - $salesAllScopes['fields']['resource']['value'] = $resourceFixture->get('Magento_Sales::sales'); - $this->_data['sales_all_scopes']['data'] = $salesAllScopes; - } - - /** - * Add role permission values to data array - * - * @param $permissions string. Possible values 'custom' or 'all' - * @param array $data - * @return array - * @throws \InvalidArgumentException - */ - protected function setPermissions($permissions, $data = []) - { - if ('all' == $permissions) { - $data['fields']['all']['value'] = 1; - } elseif ('custom' == $permissions) { - $data['fields']['all']['value'] = 0; - $data['fields']['resource']['value'] = []; - } else { - throw new \InvalidArgumentException('Invalid permissions "' . $permissions . '"'); - } - return $data; - } - - /** - * Set role scope: all, website or store - * - * @param string $scope possible values 'all', 'website', 'store' - * @param array $data - * @return array - * @throws \InvalidArgumentException - */ - protected function setScope($scope, $data = []) - { - switch ($scope) { - case 'all': - $data['fields']['gws_is_all']['value'] = 1; - break; - case 'website': - $data['fields']['gws_is_all']['value'] = 0; - $data['fields']['gws_websites']['value'] = []; - break; - case 'store': - $data['fields']['gws_is_all']['value'] = 0; - $data['fields']['gws_store_groups']['value'] = []; - break; - default: - throw new \InvalidArgumentException('Invalid role scope "' . $scope . '"'); - } - return $data; - } - - /** - * Save custom data set to repository - * - * @param string $dataSetName - * @param array $data - */ - public function set($dataSetName, array $data) - { - $this->_data[$dataSetName]['data'] = $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml rename to dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml index 153c99a4b9436..0413aad55c01e 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\User\Test\Repository\AdminUserRole"> + <repository class="Magento\User\Test\Repository\Role"> <dataset name="default"> <field name="rolename" xsi:type="string">RoleName%isolation%</field> <field name="resource_access" xsi:type="string">All</field> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml index e16fae4b2fc76..ab4fdba7cb44f 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml @@ -36,7 +36,7 @@ <field name="password" xsi:type="string">123123q</field> <field name="password_confirmation" xsi:type="string">123123q</field> <field name="role_id" xsi:type="array"> - <item name="dataSet" xsi:type="string">default</item> + <item name="dataSet" xsi:type="string">role::default</item> </field> <field name="current_password" xsi:type="string">%current_password%</field> <field name="is_active" xsi:type="string">Active</field> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml index 39f5dee8caa4b..c71d32fb5b91f 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml @@ -6,93 +6,89 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\CreateAdminUserEntityTest"> - <variation name="CreateAdminUserEntityTestVariation1"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation2"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Inactive</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation3"> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">username</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation4"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">email</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation5"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation6"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.cim</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailMessage"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\CreateAdminUserEntityTest"> + <variation name="CreateAdminUserEntityTestVariation1"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation2"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Inactive</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation3"> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">username</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation4"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">email</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation5"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation6"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.cim</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailMessage"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php index 57ae388e1a34c..f37fc9ab0694a 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\TestCase; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\TestCase\Injectable; @@ -59,9 +59,9 @@ public function __inject( /** * Runs Create Admin User Role Entity test. * - * @param AdminUserRole $role + * @param Role $role */ - public function testCreateUserRole(AdminUserRole $role) + public function testCreateUserRole(Role $role) { //Steps $this->userRoleIndex->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml index 0113079846524..aa70d5ad8bf4e 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml @@ -6,20 +6,19 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\CreateAdminUserRoleEntityTest"> - <variation name="CreateAdminUserRoleEntityTestVariation1"> - <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">Custom</data> - <data name="role/data/roles_resources" xsi:type="string">Sales</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - </variation> - <variation name="CreateAdminUserRoleEntityTestVariation2"> - <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">All</data> - <data name="role/data/roles_resources" xsi:type="string">-</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\CreateAdminUserRoleEntityTest"> + <variation name="CreateAdminUserRoleEntityTestVariation1"> + <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">Custom</data> + <data name="role/data/roles_resources" xsi:type="string">Sales</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + </variation> + <variation name="CreateAdminUserRoleEntityTestVariation2"> + <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">All</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml index 49cf5bf2094e7..0a8c1deb857b4 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml @@ -6,15 +6,16 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\DeleteAdminUserEntityTest"> - <variation name="DeleteAdminUserEntityTestVariation1"> - <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnAccount"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - </variation> - <variation name="DeleteAdminUserEntityTestVariation2"> - <data name="isDefaultUser" xsi:type="string">1</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessDeleteMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserNotInGrid"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\DeleteAdminUserEntityTest"> + <variation name="DeleteAdminUserEntityTestVariation1"> + <data name="isDefaultUser" xsi:type="string">0</data> + <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnAccount" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + </variation> + <variation name="DeleteAdminUserEntityTestVariation2"> + <data name="isDefaultUser" xsi:type="string">1</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessDeleteMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserNotInGrid" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php index 161917c3b5461..b4cf004d50b01 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php @@ -8,7 +8,7 @@ use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; @@ -100,13 +100,13 @@ public function __inject( /** * Runs Delete User Role Entity test. * - * @param AdminUserRole $role + * @param Role $role * @param User $adminUser * @param string $isDefaultUser * @return void */ public function testDeleteAdminUserRole( - AdminUserRole $role, + Role $role, User $adminUser, $isDefaultUser ) { diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml index 5a3817a86bf89..51c92524b1b0c 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml @@ -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\User\Test\TestCase\DeleteUserRoleEntityTest"> <variation name="DeleteUserRoleEntityTestVariation1"> + <data name="isDefaultUser" xsi:type="string">0</data> <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnRole"/> <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> </variation> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..692af412394d2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest92"> + <data name="menuItem" xsi:type="string">System > All Users</data> + <data name="pageTitle" xsi:type="string">Users</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest93"> + <data name="menuItem" xsi:type="string">System > User Roles</data> + <data name="pageTitle" xsi:type="string">Roles</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php index cad7c857bfb47..66c76db855a19 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php @@ -15,9 +15,6 @@ use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for UpdateAdminUserEntity - * - * Test Flow: * Preconditions: * 1. Admin user with assigned full access role is created. * 2. Custom role with restricted permission: Sales is created @@ -38,35 +35,46 @@ class UpdateAdminUserEntityTest extends Injectable /* tags */ const MVP = 'no'; const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; /* end tags */ /** + * User list page on backend. + * * @var UserIndex */ protected $userIndex; /** + * User edit page on backend. + * * @var UserEdit */ protected $userEdit; /** + * Dashboard page on backend. + * * @var Dashboard */ protected $dashboard; /** + * Authorization page on backend. + * * @var AdminAuthLogin */ protected $adminAuth; /** + * Fixture factory. + * * @var FixtureFactory */ protected $fixtureFactory; /** - * Setup necessary data for test + * Setup necessary data for test. * * @param UserIndex $userIndex * @param UserEdit $userEdit @@ -90,16 +98,17 @@ public function __inject( } /** - * Runs Update Admin User test + * Runs Update Admin User test. * - * @param User $user * @param User $initialUser + * @param User $user * @param string $loginAsDefaultAdmin * @return array + * @throws \Exception */ public function testUpdateAdminUser( - User $user, User $initialUser, + User $user, $loginAsDefaultAdmin ) { // Precondition @@ -117,20 +126,18 @@ public function testUpdateAdminUser( $this->userEdit->getUserForm()->fill($user); $this->userEdit->getPageActions()->save(); - return ['customAdmin' => $this->mergeUsers($user, $initialUser)]; + return ['user' => $this->mergeUsers($initialUser, $user)]; } /** - * Merging user data and returns custom user + * Merging user data and returns custom user. * - * @param User $user * @param User $initialUser + * @param User $user * @return User */ - protected function mergeUsers( - User $user, - User $initialUser - ) { + protected function mergeUsers(User $initialUser, User $user) + { $data = array_merge($initialUser->getData(), $user->getData()); if (isset($data['role_id'])) { $data['role_id'] = [ @@ -144,7 +151,7 @@ protected function mergeUsers( } /** - * Logout Admin User from account + * Logout Admin User from account. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml index dd0f2c27818ef..c002a9df38696 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml @@ -7,55 +7,59 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\User\Test\TestCase\UpdateAdminUserEntityTest"> - <variation name="UpdateAdminUserEntityTestVariation1"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">NewAdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">NewFirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">NewLastName%isolation%</data> - <data name="user/data/email" xsi:type="string">NewEmail%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123qa</data> - <data name="user/data/password_confirmation" xsi:type="string">123123qa</data> - <data name="user/data/is_active" xsi:type="string">-</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="UpdateAdminUserEntityTestVariation2"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">-</data> - <data name="user/data/lastname" xsi:type="string">-</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">-</data> - <data name="user/data/password_confirmation" xsi:type="string">-</data> - <data name="user/data/is_active" xsi:type="string">-</data> - <data name="user/data/role_id/dataSet" xsi:type="string">role_sales</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - <constraint name="Magento\User\Test\Constraint\AssertUserRoleSalesRestrictedAccess"/> - </variation> - <variation name="UpdateAdminUserEntityTestVariation3"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">-</data> - <data name="user/data/lastname" xsi:type="string">-</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">-</data> - <data name="user/data/password_confirmation" xsi:type="string">-</data> - <data name="user/data/is_active" xsi:type="string">Inactive</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="loginAsDefaultAdmin" xsi:type="string">1</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> + <variation name="UpdateAdminUserEntityTestVariation1"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/username" xsi:type="string">NewAdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">NewFirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">NewLastName%isolation%</data> + <data name="user/data/email" xsi:type="string">NewEmail%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123qa</data> + <data name="user/data/password_confirmation" xsi:type="string">123123qa</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">0</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation2"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">0</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">admin/user</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation3"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/is_active" xsi:type="string">Inactive</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">1</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation4"> + <data name="description" xsi:type="string">MAGETWO-12375: Use ACL Role with Full GWS Scope (without Using Secret Key to URLs)</data> + <data name="loginAsDefaultAdmin" xsi:type="string">1</data> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">catalog/product</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php index 06a396c982cba..5908a7ffd7b91 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php @@ -8,7 +8,7 @@ use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; @@ -81,14 +81,14 @@ public function __inject( /** * Runs Update Admin User Roles Entity test * - * @param AdminUserRole $roleInit - * @param AdminUserRole $role + * @param Role $roleInit + * @param Role $role * @param User $user * @return array */ public function testUpdateAdminUserRolesEntity( - AdminUserRole $roleInit, - AdminUserRole $role, + Role $roleInit, + Role $role, User $user ) { // Preconditions @@ -108,7 +108,7 @@ public function testUpdateAdminUserRolesEntity( $this->userRoleEditRole->getPageActions()->save(); return [ - 'customAdmin' => $role->hasData('in_role_users') + 'user' => $role->hasData('in_role_users') ? $role->getDataFieldConfig('in_role_users')['source']->getAdminUsers()[0] : $user, ]; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml index b4ce41cdb8545..e64b21124c8b1 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml @@ -6,29 +6,33 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\UpdateAdminUserRoleEntityTest"> - <variation name="UpdateAdminUserRoleEntityTestVariation1"> - <data name="user/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="role/data/rolename" xsi:type="string">NewAdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">-</data> - <data name="role/data/roles_resources" xsi:type="string">-</data> - <data name="role/data/in_role_users/dataSet" xsi:type="string">-</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="UpdateAdminUserRoleEntityTestVariation2"> - <data name="user/dataSet" xsi:type="string">default</data> - <data name="role/data/rolename" xsi:type="string">-</data> - <data name="role/data/resource_access" xsi:type="string">Custom</data> - <data name="role/data/roles_resources" xsi:type="string">Sales</data> - <data name="role/data/in_role_users/dataSet" xsi:type="string">custom_admin</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - <constraint name="Magento\User\Test\Constraint\AssertUserRoleSalesRestrictedAccess"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\UpdateAdminUserRoleEntityTest"> + <variation name="UpdateAdminUserRoleEntityTestVariation1"> + <data name="user/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="role/data/rolename" xsi:type="string">NewAdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">-</data> + <data name="role/data/roles_resources" xsi:type="string">-</data> + <data name="role/data/in_role_users/dataSet" xsi:type="string">-</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + </variation> + <variation name="UpdateAdminUserRoleEntityTestVariation2"> + <data name="user/dataSet" xsi:type="string">default</data> + <data name="role/data/rolename" xsi:type="string">-</data> + <data name="role/data/resource_access" xsi:type="string">Custom</data> + <data name="role/data/roles_resources" xsi:type="string">Sales</data> + <data name="role/data/in_role_users/dataSet" xsi:type="string">custom_admin</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">catalog/product</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php index 003e6640bdfe7..b67ceaa5b97e3 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php @@ -7,7 +7,7 @@ namespace Magento\User\Test\TestCase; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserEdit; use Magento\User\Test\Page\Adminhtml\UserIndex; @@ -122,14 +122,14 @@ public function __inject( } /** - * @param AdminUserRole $role - * @param AdminUserRole $updatedRole + * @param Role $role + * @param Role $updatedRole * @param User $user * @return void */ public function testLoginAfterChangingPermissions( - AdminUserRole $role, - AdminUserRole $updatedRole, + Role $role, + Role $updatedRole, User $user ) { /** Create role and a new user with this role */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php new file mode 100644 index 0000000000000..de73873c4950e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\TestStep; + +use Magento\Backend\Test\Page\AdminAuthLogin; +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\User\Test\Fixture\User; + +/** + * Login user on backend. + */ +class LoginUserOnBackendStep implements TestStepInterface +{ + /** + * Logout user on backend step. + * + * @var LogoutUserOnBackendStep + */ + protected $logoutUserOnBackendStep; + + /** + * Authorization backend page. + * + * @var AdminAuthLogin + */ + protected $adminAuth; + + /** + * Fixture User. + * + * @var User + */ + protected $user; + + /** + * @constructor + * @param LogoutUserOnBackendStep $logoutUserOnBackendStep + * @param AdminAuthLogin $adminAuth + * @param User $user + */ + public function __construct( + LogoutUserOnBackendStep $logoutUserOnBackendStep, + AdminAuthLogin $adminAuth, + User $user + ) { + $this->logoutUserOnBackendStep = $logoutUserOnBackendStep; + $this->adminAuth = $adminAuth; + $this->user = $user; + } + + /** + * Run step flow. + * + * @return void + */ + public function run() + { + $this->logoutUserOnBackendStep->run(); + + $this->adminAuth->open(); + $this->adminAuth->getLoginBlock()->fill($this->user); + $this->adminAuth->getLoginBlock()->submit(); + $this->adminAuth->getLoginBlock()->waitFormNotVisible(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php new file mode 100644 index 0000000000000..cf3227fafecba --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\TestStep; + +use Magento\Backend\Test\Page\AdminAuthLogin; +use Magento\Backend\Test\Page\Adminhtml\Dashboard; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Logout user on backend. + */ +class LogoutUserOnBackendStep implements TestStepInterface +{ + /** + * Authorization backend page. + * + * @var AdminAuthLogin + */ + protected $adminAuth; + + /** + * Dashboard backend page. + * + * @var Dashboard + */ + protected $dashboard; + + /** + * @construct + * @param AdminAuthLogin $adminAuth + * @param Dashboard $dashboard + */ + public function __construct(AdminAuthLogin $adminAuth, Dashboard $dashboard) + { + $this->adminAuth = $adminAuth; + $this->dashboard = $dashboard; + } + + /** + * Run step flow. + * + * @return void + */ + public function run() + { + $this->adminAuth->open(); + if ($this->dashboard->getAdminPanelHeader()->isVisible()) { + $this->dashboard->getAdminPanelHeader()->logOut(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml index e5d8c6b54b072..7801b2d8fc637 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <preference for="Magento\User\Test\Handler\AdminUserRole\AdminUserRoleInterface" type="\Magento\User\Test\Handler\AdminUserRole\Curl" /> + <preference for="Magento\User\Test\Handler\Role\RoleInterface" type="\Magento\User\Test\Handler\Role\Curl" /> <preference for="Magento\User\Test\Handler\User\UserInterface" type="\Magento\User\Test\Handler\User\Curl" /> </config> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..7a832e8763322 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest94"> + <data name="menuItem" xsi:type="string">System > Custom Variables</data> + <data name="pageTitle" xsi:type="string">Custom Variables</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php new file mode 100644 index 0000000000000..bce4e8a44da81 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php @@ -0,0 +1,143 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml\Widget; + +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Widget Chosen Option. + */ +class ChosenOption extends SimpleElement +{ + /** + * Select page button selector. + * + * @var string + */ + protected $selectButton = '//ancestor::body//button[contains(@class,"btn-chooser")]'; + + /** + * Magento varienLoader.js loader. + * + * @var string + */ + protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]'; + + // @codingStandardsIgnoreStart + /** + * Select block selector. + * + * @var string + */ + protected $selectBlock = "//ancestor::body//div[contains(@style,'display: block')]//*[contains(@id,'responseCntoptions')]"; + // @codingStandardsIgnoreEnd + + /** + * Page widget chooser block class. + * + * @var string + */ + protected $pageWidgetChooserBlockClass = 'Magento\Cms\Test\Block\Adminhtml\Page\Widget\Chooser'; + + /** + * Category widget chooser block class. + * + * @var string + */ + protected $categoryWidgetChooserBlockClass = '\Magento\Catalog\Test\Block\Adminhtml\Category\Widget\Chooser'; + + /** + * Product widget chooser block class. + * + * @var string + */ + protected $productWidgetChooserBlockClass = '\Magento\Catalog\Test\Block\Adminhtml\Product\Widget\Chooser'; + + /** + * Entity chooser block class mapping. + * + * @var array + */ + protected $chooserClasses = [ + 'page' => 'Magento\Cms\Test\Block\Adminhtml\Page\Widget\Chooser', + 'category' => 'Magento\Catalog\Test\Block\Adminhtml\Category\Widget\Chooser', + 'product' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Widget\Chooser', + ]; + + /** + * Select widget options. + * + * @param string $value + * @return void + */ + public function setValue($value) + { + $this->clickSelectButton(); + if (isset($value['filter_url_key'])) { + $this->getClassBlock($this->chooserClasses['page']) + ->searchAndOpen(['chooser_identifier' => $value['filter_url_key']]); + } + if (isset($value['filter_identifier'])) { + $this->getClassBlock($this->chooserClasses['page']) + ->searchAndOpen(['chooser_identifier' => $value['filter_identifier']]); + } + if (isset($value['category_path'])) { + if (isset($value['filter_sku'])) { + $this->getClassBlock($this->chooserClasses['category']) + ->selectCategoryByName($value['category_path']); + $this->getClassBlock($this->chooserClasses['product']) + ->searchAndOpen(['chooser_sku' => $value['filter_sku']]); + } else { + $this->getClassBlock($this->chooserClasses['category']) + ->selectCategoryByName($value['category_path']); + } + } + } + + /** + * Clicking to select button. + * + * @return void + */ + protected function clickSelectButton() + { + $this->find($this->selectButton, Locator::SELECTOR_XPATH)->click(); + $this->waitLoader(); + } + + /** + * Waiting loader. + * + * @return void + */ + protected function waitLoader() + { + $browser = $this; + $loaderSelector = $this->loaderOld; + $this->waitUntil( + function () use ($browser, $loaderSelector) { + $loader = $browser->find($loaderSelector); + return $loader->isVisible() == false ? true : null; + } + ); + } + + /** + * Get block by class. + * + * @param string $class + * @return mixed + */ + protected function getClassBlock($class) + { + return \Magento\Mtf\ObjectManager::getInstance()->create( + $class, + ['element' => $this->find($this->selectBlock, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php new file mode 100644 index 0000000000000..570f597f47de9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml\Widget; + +use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; + +/** + * Widget grid on the Widget Instance Index page. + */ +class WidgetGrid extends AbstractGrid +{ + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'tbody tr td.col-title'; + + /** + * First row selector. + * + * @var string + */ + protected $firstRowSelector = '//tr[./td[contains(@class, "col-title")]][1]/td'; + + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'title' => [ + 'selector' => 'input[name="title"]', + ], + ]; +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php new file mode 100644 index 0000000000000..27cdefabd160d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml; + +use Magento\Mtf\Block\Form; +use Magento\Mtf\Client\Locator; + +/** + * Backend add widget block form. + */ +class WidgetForm extends Form +{ + /** + * Widget type selector. + * + * @var string + */ + protected $widgetType = '[name="widget_type"]'; + + /** + * Insert widget button selector. + * + * @var string + */ + protected $insertButton = '#insert_button'; + + /** + * Magento varienLoader.js loader. + * + * @var string + */ + protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]'; + + /** + * Add widgets. + * + * @param array $widget + * @return void + */ + public function addWidget($widget) + { + $this->selectWidgetType($widget['widget_type']); + $mapping = $this->dataMapping($widget); + $this->_fill($mapping); + $this->insertWidget(); + } + + /** + * Select widget type. + * + * @param string $type + * @return void + */ + protected function selectWidgetType($type) + { + $this->_rootElement->find($this->widgetType, Locator::SELECTOR_CSS, 'select')->setValue($type); + $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH); + } + + /** + * Click Insert Widget button. + * + * @return void + */ + protected function insertWidget() + { + $this->_rootElement->find($this->insertButton)->click(); + $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml new file mode 100644 index 0000000000000..5f089a8e4ff00 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <wrapper>parameters</wrapper> + <fields> + <widget_type> + <selector>#select_widget_type</selector> + <input>select</input> + </widget_type> + <anchor_text/> + <title/> + <template> + <input>select</input> + </template> + <chosen_option> + <selector>.control button</selector> + <class>\Magento\Widget\Test\Block\Adminhtml\Widget\ChosenOption</class> + </chosen_option> + <display_type> + <input>select</input> + </display_type> + <show_pager> + <input>select</input> + </show_pager> + <products_count/> + <cache_lifetime/> + <page_size/> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000..d66ba7af5f9c1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest96"> + <data name="menuItem" xsi:type="string">Content > Frontend Apps</data> + <data name="pageTitle" xsi:type="string">Frontend Apps</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php new file mode 100644 index 0000000000000..bb60457362c20 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Wishlist\Test\Constraint; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Wishlist\Test\Page\WishlistIndex; +use Magento\Mtf\Constraint\AbstractAssertForm; + +/** + * Assert that the correct option details are displayed on the "View Details" tool tip. + */ +abstract class AbstractAssertWishlistProductDetails extends AbstractAssertForm +{ + /** + * Assert product details. + * + * @param WishlistIndex $wishlistIndex + * @param InjectableFixture $product + * @param FixtureFactory $fixtureFactory + * @return void + */ + protected function assertProductDetails( + WishlistIndex $wishlistIndex, + InjectableFixture $product, + FixtureFactory $fixtureFactory + ) { + $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions(); + $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); + $expectedOptions = $cartFixture->getItems()[0]->getData()['options']; + + $errors = $this->verifyData( + $this->sortDataByPath($expectedOptions, '::title'), + $this->sortDataByPath($actualOptions, '::title') + ); + \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php index a3a6c805a6fce..405852f2ee186 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php @@ -13,13 +13,12 @@ use Magento\Mtf\Fixture\InjectableFixture; /** - * Class AssertBundleProductDetailsInWishlist - * Assert that the correct option details are displayed on the "View Details" tool tip + * Assert that the correct option details are displayed on the "View Details" tool tip. */ -class AssertProductDetailsInWishlist extends AbstractAssertForm +class AssertProductDetailsInWishlist extends AbstractAssertWishlistProductDetails { /** - * Assert that the correct option details are displayed on the "View Details" tool tip + * Assert that the correct option details are displayed on the "View Details" tool tip. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex @@ -34,19 +33,11 @@ public function processAssert( FixtureFactory $fixtureFactory ) { $cmsIndex->getLinksBlock()->openLink('My Wish List'); - $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions(); - $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); - $expectedOptions = $cartFixture->getItems()[0]->getData()['options']; - - $errors = $this->verifyData( - $this->sortDataByPath($expectedOptions, '::title'), - $this->sortDataByPath($actualOptions, '::title') - ); - \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + $this->assertProductDetails($wishlistIndex, $fixtureFactory, $product); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php index b83ca2292615d..5c1d741634498 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php @@ -43,6 +43,7 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli */ public function test(Customer $customer, $products, $qty) { + $this->markTestIncomplete('Bug: MAGETWO-34757'); // Preconditions $customer->persist(); $this->loginCustomer($customer); diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php index b358e5c134402..233640f3eb490 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php @@ -44,6 +44,7 @@ class ConfigureProductInCustomerWishlistOnBackendTest extends AbstractWishlistTe */ public function __prepare(Customer $customer) { + $this->markTestIncomplete('Bug: MAGETWO-31868'); $customer->persist(); return ['customer' => $customer]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml index 65a635664b919..c1ff8db58e314 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml @@ -6,31 +6,33 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnFrontendTest"> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation2" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation3" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation4" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation5" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnFrontendTest"> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation2"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> + <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> + <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation5"> + <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php index 7083e3e70ace5..d325e868b4e70 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php @@ -12,8 +12,6 @@ use Magento\Mtf\Fixture\FixtureInterface; /** - * Test Flow: - * * Preconditions: * 1. Test products are created. * @@ -68,6 +66,7 @@ public function test( // Steps: $this->addToCart($product); $assertAddedProductToCartSuccessMessage->processAssert($checkoutCart, $product); + $checkoutCart->open(); $checkoutCart->getCartBlock()->getCartItem($product)->moveToWishlist(); return ['product' => $product]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php index 881161d8d5166..47ffc259d718d 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php @@ -165,7 +165,9 @@ public function test( $this->loginCustomer($customer); $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $this->catalogProductView->getViewBlock()->clickAddToWishlist(); + $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage(); $this->wishlistIndex->getWishlistBlock()->clickShareWishList(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo); $this->wishlistShare->getSharingInfoForm()->shareWishlist(); } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml index ee8bb12399779..1282b05826c50 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml @@ -16,10 +16,12 @@ <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid"/> </variation> <variation name="ViewProductInCustomerWishlistOnBackendTestVariation3" firstConstraint="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid"/> </variation> <variation name="ViewProductInCustomerWishlistOnBackendTestVariation4" firstConstraint="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34633</data> <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid"/> </variation>