diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php index 213d0adac7d5a0b98414942faf2ef30860bed9ad..4ac95b73d7f67bd1f5bcc75c8f7d58e3c4bc3fb2 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php @@ -6,28 +6,13 @@ namespace Magento\Backend\Test\Block; -use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Global messages block. + * Backend Messages block. */ -class Messages extends Block +class Messages extends \Magento\Ui\Test\Block\Messages { - /** - * Success message selector. - * - * @var string - */ - protected $successMessage = '[data-ui-id$=message-success]'; - - /** - * Last success message selector. - * - * @var string - */ - protected $lastSuccessMessage = '[data-ui-id$=message-success]:last-child'; - /** * Message link. * @@ -35,115 +20,6 @@ class Messages extends Block */ protected $messageLink = "//a[contains(.,'%s')]"; - /** - * Error message selector. - * - * @var string - */ - protected $errorMessage = '[data-ui-id$=message-error]'; - - /** - * Notice message selector. - * - * @var string - */ - protected $noticeMessage = '[data-ui-id$=message-notice]'; - - /** - * Warning message selector. - * - * @var string - */ - protected $warningMessage = '[data-ui-id$=message-warning]'; - - /** - * Wait for success message. - * - * @return bool - */ - public function waitSuccessMessage() - { - return $this->waitForElementVisible($this->successMessage, Locator::SELECTOR_CSS); - } - - /** - * Get all success messages which are present on the page. - * - * @return array - */ - public function getSuccessMessages() - { - $this->waitForElementVisible($this->successMessage); - $elements = $this->_rootElement->getElements($this->successMessage); - - $messages = []; - foreach ($elements as $element) { - $messages[] = $element->getText(); - } - - return $messages; - } - - /** - * Get all notice messages which are present on the page. - * - * @return array - */ - public function getNoticeMessages() - { - $this->waitForElementVisible($this->noticeMessage); - $elements = $this->_rootElement->getElements($this->noticeMessage); - - $messages = []; - foreach ($elements as $element) { - $messages[] = $element->getText(); - } - - return $messages; - } - - /** - * Get last success message which is present on the page. - * - * @return string - */ - public function getSuccessMessage() - { - $this->waitForElementVisible($this->successMessage); - - return $this->_rootElement->find($this->lastSuccessMessage)->getText(); - } - - /** - * Wait for element is visible in the page. - * - * @param string $selector - * @param string $strategy - * @return bool|null - */ - public function waitForElementVisible($selector, $strategy = Locator::SELECTOR_CSS) - { - $browser = $this->browser; - return $browser->waitUntil( - function () use ($browser, $selector, $strategy) { - $message = $browser->find($selector, $strategy); - return $message->isVisible() ? true : null; - } - ); - } - - /** - * Get all error message which is present on the page. - * - * @return string - */ - public function getErrorMessage() - { - return $this->_rootElement - ->find($this->errorMessage, Locator::SELECTOR_CSS) - ->getText(); - } - /** * Click on link in the message which is present on the page. * @@ -193,26 +69,4 @@ class Messages extends Block { return $this->waitForElementVisible($this->noticeMessage, Locator::SELECTOR_CSS); } - - /** - * Get notice message which is present on the page. - * - * @return string - */ - public function getNoticeMessage() - { - $this->waitForElementVisible($this->noticeMessage); - return $this->_rootElement->find($this->noticeMessage)->getText(); - } - - /** - * Get warning message which is present on the page. - * - * @return string - */ - public function getWarningMessage() - { - $this->waitForElementVisible($this->warningMessage); - return $this->_rootElement->find($this->warningMessage)->getText(); - } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php index 91e241c8281c91442df5712f9058bd2a8c9304bc..930758c50316a66eef00f3a5bea8c812ce519902 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php @@ -92,7 +92,7 @@ class AssertBundleItemsOnProductPage extends AbstractAssertForm * @param int $key * @return bool */ - public function isInStock(BundleProduct $product, int $key) + private function isInStock(BundleProduct $product, $key) { $assignedProducts = $product->getBundleSelections()['products'][0]; $status = $assignedProducts[$key]->getData()['quantity_and_stock_status']['is_in_stock']; diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml index edc930d4d2561f85087fa514487c26083f4d6744..8c7180da376d361c16ba279416b91c6bcd868da4 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml @@ -15,6 +15,6 @@ <block name="listProductBlock" class="Magento\Catalog\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/> <block name="topToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\TopToolbar" locator=".//*[contains(@class,'toolbar-products')][1]" strategy="xpath"/> <block name="bottomToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\BottomToolbar" locator=".//*[contains(@class,'toolbar-products')][2]" strategy="xpath"/> - <block name="messagesBlock" class="Magento\Catalog\Test\Block\Messages" locator=".page.messages" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Cms\Test\Block\Messages" locator=".page.messages" strategy="css selector" /> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Messages.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Messages.php new file mode 100644 index 0000000000000000000000000000000000000000..d5133e594c59cfa14e45ca5e2c1fafbf0bf1b3fa --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Messages.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block; + +/** + * Messages block. + */ +class Messages extends \Magento\Ui\Test\Block\Messages +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Messages.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Messages.php similarity index 63% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Messages.php rename to dev/tests/functional/tests/app/Magento/Ui/Test/Block/Messages.php index fccf840475a55c07e78c9b42de652b2739c73ab2..66ac6b7058ddd103e2aec49ca81311c5cf7ef84b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Messages.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Messages.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Catalog\Test\Block; +namespace Magento\Ui\Test\Block; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; @@ -28,13 +28,6 @@ class Messages extends Block */ protected $lastSuccessMessage = '[data-ui-id$=message-success]:last-child'; - /** - * Message link. - * - * @var string - */ - protected $messageLink = "//a[contains(.,'%s')]"; - /** * Error message selector. * @@ -49,13 +42,6 @@ class Messages extends Block */ protected $noticeMessage = '[data-ui-id$=message-notice]'; - /** - * Warning message selector. - * - * @var string - */ - protected $warningMessage = '[data-ui-id$=message-warning]'; - /** * Wait for success message. * @@ -144,56 +130,6 @@ class Messages extends Block ->getText(); } - /** - * Click on link in the message which is present on the page. - * - * @param string $messageType - * @param string $linkText - * @return void - */ - public function clickLinkInMessage($messageType, $linkText) - { - if ($this->isVisibleMessage($messageType)) { - $this->_rootElement - ->find($this->{$messageType . 'Message'}, Locator::SELECTOR_CSS) - ->find(sprintf($this->messageLink, $linkText), Locator::SELECTOR_XPATH) - ->click(); - } - } - - /** - * Check is visible messages. - * - * @param string $messageType - * @return bool - */ - public function isVisibleMessage($messageType) - { - return $this->_rootElement - ->find($this->{$messageType . 'Message'}, Locator::SELECTOR_CSS) - ->isVisible(); - } - - /** - * Check for error message. - * - * @return bool - */ - public function assertErrorMessage() - { - return $this->waitForElementVisible($this->errorMessage, Locator::SELECTOR_CSS); - } - - /** - * Check for notice message. - * - * @return bool - */ - public function assertNoticeMessage() - { - return $this->waitForElementVisible($this->noticeMessage, Locator::SELECTOR_CSS); - } - /** * Get notice message which is present on the page. * @@ -204,15 +140,4 @@ class Messages extends Block $this->waitForElementVisible($this->noticeMessage); return $this->_rootElement->find($this->noticeMessage)->getText(); } - - /** - * Get warning message which is present on the page. - * - * @return string - */ - public function getWarningMessage() - { - $this->waitForElementVisible($this->warningMessage); - return $this->_rootElement->find($this->warningMessage)->getText(); - } } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php index 854d7e8bc62a963d8fb6d171c95a20add61977ba..27c38a27df12f1203ee19fb2b1d3bc3ef79efe62 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php @@ -91,10 +91,10 @@ class CreateAdminUserEntityTest extends Injectable * @param string $isDuplicated * @return array */ - public function test(User $user, User $adminUser, $isDuplicated) + public function test(User $user, User $adminUser, $isDuplicated = null) { // Prepare data - if ($isDuplicated != 'No') { + if ($isDuplicated !== null) { $data = $user->getData(); $data[$isDuplicated] = $adminUser->getData($isDuplicated); $data['role_id'] = ['role' => $user->getDataFieldConfig('role_id')['source']->getRole()]; 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 c14d14dc01b377adfdf9087257aa60eafa7308c0..b6c346fea8dfbd66803cf7b1098fe85cce65c43e 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 @@ -17,7 +17,6 @@ <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">No</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" /> @@ -33,7 +32,6 @@ <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">No</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" /> @@ -72,7 +70,6 @@ <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">No</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" /> @@ -87,7 +84,6 @@ <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">No</data> <data name="user/data/current_password" xsi:type="string">%current_password%</data> <constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailHostnameMessage" /> </variation> @@ -98,7 +94,6 @@ <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="isDuplicated" xsi:type="string">No</data> <data name="user/data/current_password" xsi:type="string">incorrect-password</data> <constraint name="Magento\User\Test\Constraint\AssertIncorrectUserPassword" /> </variation>