Skip to content

Commit 71b965e

Browse files
author
Vadim Zubovich
committed
MTO-92: [Variation] Check Shipping Amount if not base currency
- Reorganized inheritance hierarchy of Messages classes.
1 parent e6c22fc commit 71b965e

File tree

7 files changed

+22
-233
lines changed

7 files changed

+22
-233
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php

Lines changed: 2 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -6,144 +6,20 @@
66

77
namespace Magento\Backend\Test\Block;
88

9-
use Magento\Mtf\Block\Block;
109
use Magento\Mtf\Client\Locator;
1110

1211
/**
13-
* Global messages block.
12+
* Backend Messages block.
1413
*/
15-
class Messages extends Block
14+
class Messages extends \Magento\Ui\Test\Block\Messages
1615
{
17-
/**
18-
* Success message selector.
19-
*
20-
* @var string
21-
*/
22-
protected $successMessage = '[data-ui-id$=message-success]';
23-
24-
/**
25-
* Last success message selector.
26-
*
27-
* @var string
28-
*/
29-
protected $lastSuccessMessage = '[data-ui-id$=message-success]:last-child';
30-
3116
/**
3217
* Message link.
3318
*
3419
* @var string
3520
*/
3621
protected $messageLink = "//a[contains(.,'%s')]";
3722

38-
/**
39-
* Error message selector.
40-
*
41-
* @var string
42-
*/
43-
protected $errorMessage = '[data-ui-id$=message-error]';
44-
45-
/**
46-
* Notice message selector.
47-
*
48-
* @var string
49-
*/
50-
protected $noticeMessage = '[data-ui-id$=message-notice]';
51-
52-
/**
53-
* Warning message selector.
54-
*
55-
* @var string
56-
*/
57-
protected $warningMessage = '[data-ui-id$=message-warning]';
58-
59-
/**
60-
* Wait for success message.
61-
*
62-
* @return bool
63-
*/
64-
public function waitSuccessMessage()
65-
{
66-
return $this->waitForElementVisible($this->successMessage, Locator::SELECTOR_CSS);
67-
}
68-
69-
/**
70-
* Get all success messages which are present on the page.
71-
*
72-
* @return array
73-
*/
74-
public function getSuccessMessages()
75-
{
76-
$this->waitForElementVisible($this->successMessage);
77-
$elements = $this->_rootElement->getElements($this->successMessage);
78-
79-
$messages = [];
80-
foreach ($elements as $element) {
81-
$messages[] = $element->getText();
82-
}
83-
84-
return $messages;
85-
}
86-
87-
/**
88-
* Get all notice messages which are present on the page.
89-
*
90-
* @return array
91-
*/
92-
public function getNoticeMessages()
93-
{
94-
$this->waitForElementVisible($this->noticeMessage);
95-
$elements = $this->_rootElement->getElements($this->noticeMessage);
96-
97-
$messages = [];
98-
foreach ($elements as $element) {
99-
$messages[] = $element->getText();
100-
}
101-
102-
return $messages;
103-
}
104-
105-
/**
106-
* Get last success message which is present on the page.
107-
*
108-
* @return string
109-
*/
110-
public function getSuccessMessage()
111-
{
112-
$this->waitForElementVisible($this->successMessage);
113-
114-
return $this->_rootElement->find($this->lastSuccessMessage)->getText();
115-
}
116-
117-
/**
118-
* Wait for element is visible in the page.
119-
*
120-
* @param string $selector
121-
* @param string $strategy
122-
* @return bool|null
123-
*/
124-
public function waitForElementVisible($selector, $strategy = Locator::SELECTOR_CSS)
125-
{
126-
$browser = $this->browser;
127-
return $browser->waitUntil(
128-
function () use ($browser, $selector, $strategy) {
129-
$message = $browser->find($selector, $strategy);
130-
return $message->isVisible() ? true : null;
131-
}
132-
);
133-
}
134-
135-
/**
136-
* Get all error message which is present on the page.
137-
*
138-
* @return string
139-
*/
140-
public function getErrorMessage()
141-
{
142-
return $this->_rootElement
143-
->find($this->errorMessage, Locator::SELECTOR_CSS)
144-
->getText();
145-
}
146-
14723
/**
14824
* Click on link in the message which is present on the page.
14925
*
@@ -193,26 +69,4 @@ public function assertNoticeMessage()
19369
{
19470
return $this->waitForElementVisible($this->noticeMessage, Locator::SELECTOR_CSS);
19571
}
196-
197-
/**
198-
* Get notice message which is present on the page.
199-
*
200-
* @return string
201-
*/
202-
public function getNoticeMessage()
203-
{
204-
$this->waitForElementVisible($this->noticeMessage);
205-
return $this->_rootElement->find($this->noticeMessage)->getText();
206-
}
207-
208-
/**
209-
* Get warning message which is present on the page.
210-
*
211-
* @return string
212-
*/
213-
public function getWarningMessage()
214-
{
215-
$this->waitForElementVisible($this->warningMessage);
216-
return $this->_rootElement->find($this->warningMessage)->getText();
217-
}
21872
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function prepareBundleOptions(BundleProduct $product)
9292
* @param int $key
9393
* @return bool
9494
*/
95-
public function isInStock(BundleProduct $product, int $key)
95+
private function isInStock(BundleProduct $product, $key)
9696
{
9797
$assignedProducts = $product->getBundleSelections()['products'][0];
9898
$status = $assignedProducts[$key]->getData()['quantity_and_stock_status']['is_in_stock'];

dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
<block name="listProductBlock" class="Magento\Catalog\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/>
1616
<block name="topToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\TopToolbar" locator=".//*[contains(@class,'toolbar-products')][1]" strategy="xpath"/>
1717
<block name="bottomToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\BottomToolbar" locator=".//*[contains(@class,'toolbar-products')][2]" strategy="xpath"/>
18-
<block name="messagesBlock" class="Magento\Catalog\Test\Block\Messages" locator=".page.messages" strategy="css selector" />
18+
<block name="messagesBlock" class="Magento\Cms\Test\Block\Messages" locator=".page.messages" strategy="css selector" />
1919
</page>
2020
</config>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cms\Test\Block;
8+
9+
/**
10+
* Messages block.
11+
*/
12+
class Messages extends \Magento\Ui\Test\Block\Messages
13+
{
14+
//
15+
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Messages.php renamed to dev/tests/functional/tests/app/Magento/Ui/Test/Block/Messages.php

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\Catalog\Test\Block;
7+
namespace Magento\Ui\Test\Block;
88

99
use Magento\Mtf\Block\Block;
1010
use Magento\Mtf\Client\Locator;
@@ -28,13 +28,6 @@ class Messages extends Block
2828
*/
2929
protected $lastSuccessMessage = '[data-ui-id$=message-success]:last-child';
3030

31-
/**
32-
* Message link.
33-
*
34-
* @var string
35-
*/
36-
protected $messageLink = "//a[contains(.,'%s')]";
37-
3831
/**
3932
* Error message selector.
4033
*
@@ -49,13 +42,6 @@ class Messages extends Block
4942
*/
5043
protected $noticeMessage = '[data-ui-id$=message-notice]';
5144

52-
/**
53-
* Warning message selector.
54-
*
55-
* @var string
56-
*/
57-
protected $warningMessage = '[data-ui-id$=message-warning]';
58-
5945
/**
6046
* Wait for success message.
6147
*
@@ -144,56 +130,6 @@ public function getErrorMessage()
144130
->getText();
145131
}
146132

147-
/**
148-
* Click on link in the message which is present on the page.
149-
*
150-
* @param string $messageType
151-
* @param string $linkText
152-
* @return void
153-
*/
154-
public function clickLinkInMessage($messageType, $linkText)
155-
{
156-
if ($this->isVisibleMessage($messageType)) {
157-
$this->_rootElement
158-
->find($this->{$messageType . 'Message'}, Locator::SELECTOR_CSS)
159-
->find(sprintf($this->messageLink, $linkText), Locator::SELECTOR_XPATH)
160-
->click();
161-
}
162-
}
163-
164-
/**
165-
* Check is visible messages.
166-
*
167-
* @param string $messageType
168-
* @return bool
169-
*/
170-
public function isVisibleMessage($messageType)
171-
{
172-
return $this->_rootElement
173-
->find($this->{$messageType . 'Message'}, Locator::SELECTOR_CSS)
174-
->isVisible();
175-
}
176-
177-
/**
178-
* Check for error message.
179-
*
180-
* @return bool
181-
*/
182-
public function assertErrorMessage()
183-
{
184-
return $this->waitForElementVisible($this->errorMessage, Locator::SELECTOR_CSS);
185-
}
186-
187-
/**
188-
* Check for notice message.
189-
*
190-
* @return bool
191-
*/
192-
public function assertNoticeMessage()
193-
{
194-
return $this->waitForElementVisible($this->noticeMessage, Locator::SELECTOR_CSS);
195-
}
196-
197133
/**
198134
* Get notice message which is present on the page.
199135
*
@@ -204,15 +140,4 @@ public function getNoticeMessage()
204140
$this->waitForElementVisible($this->noticeMessage);
205141
return $this->_rootElement->find($this->noticeMessage)->getText();
206142
}
207-
208-
/**
209-
* Get warning message which is present on the page.
210-
*
211-
* @return string
212-
*/
213-
public function getWarningMessage()
214-
{
215-
$this->waitForElementVisible($this->warningMessage);
216-
return $this->_rootElement->find($this->warningMessage)->getText();
217-
}
218143
}

dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ public function __inject(
9191
* @param string $isDuplicated
9292
* @return array
9393
*/
94-
public function test(User $user, User $adminUser, $isDuplicated)
94+
public function test(User $user, User $adminUser, $isDuplicated = null)
9595
{
9696
// Prepare data
97-
if ($isDuplicated != 'No') {
97+
if ($isDuplicated !== null) {
9898
$data = $user->getData();
9999
$data[$isDuplicated] = $adminUser->getData($isDuplicated);
100100
$data['role_id'] = ['role' => $user->getDataFieldConfig('role_id')['source']->getRole()];

dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<data name="user/data/password_confirmation" xsi:type="string">123123q</data>
1818
<data name="user/data/is_active" xsi:type="string">Active</data>
1919
<data name="user/data/role_id/dataset" xsi:type="string">role::Administrators</data>
20-
<data name="isDuplicated" xsi:type="string">No</data>
2120
<data name="user/data/current_password" xsi:type="string">%current_password%</data>
2221
<constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" />
2322
<constraint name="Magento\User\Test\Constraint\AssertUserInGrid" />
@@ -33,7 +32,6 @@
3332
<data name="user/data/password_confirmation" xsi:type="string">123123q</data>
3433
<data name="user/data/is_active" xsi:type="string">Inactive</data>
3534
<data name="user/data/role_id/dataset" xsi:type="string">role::Administrators</data>
36-
<data name="isDuplicated" xsi:type="string">No</data>
3735
<data name="user/data/current_password" xsi:type="string">123123q</data>
3836
<constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" />
3937
<constraint name="Magento\User\Test\Constraint\AssertUserInGrid" />
@@ -72,7 +70,6 @@
7270
<data name="user/data/password" xsi:type="string">123123q</data>
7371
<data name="user/data/password_confirmation" xsi:type="string">123123q</data>
7472
<data name="user/data/is_active" xsi:type="string">Active</data>
75-
<data name="isDuplicated" xsi:type="string">No</data>
7673
<data name="user/data/current_password" xsi:type="string">%current_password%</data>
7774
<constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" />
7875
<constraint name="Magento\User\Test\Constraint\AssertUserInGrid" />
@@ -87,7 +84,6 @@
8784
<data name="user/data/password" xsi:type="string">123123q</data>
8885
<data name="user/data/password_confirmation" xsi:type="string">123123q</data>
8986
<data name="user/data/is_active" xsi:type="string">Active</data>
90-
<data name="isDuplicated" xsi:type="string">No</data>
9187
<data name="user/data/current_password" xsi:type="string">%current_password%</data>
9288
<constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailHostnameMessage" />
9389
</variation>
@@ -98,7 +94,6 @@
9894
<data name="user/data/email" xsi:type="string">email%isolation%@example.com</data>
9995
<data name="user/data/password" xsi:type="string">123123q</data>
10096
<data name="user/data/password_confirmation" xsi:type="string">123123q</data>
101-
<data name="isDuplicated" xsi:type="string">No</data>
10297
<data name="user/data/current_password" xsi:type="string">incorrect-password</data>
10398
<constraint name="Magento\User\Test\Constraint\AssertIncorrectUserPassword" />
10499
</variation>

0 commit comments

Comments
 (0)