Skip to content

Commit fc40ede

Browse files
committed
MTA-1594: Re-factor Functional tests which are not end-to-end
- CR Changes
1 parent 67b14bb commit fc40ede

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Constraint;
8+
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11+
12+
/**
13+
* Check mass update success message.
14+
*/
15+
class AssertMassProductUpdateSuccessMessage extends AbstractConstraint
16+
{
17+
/**
18+
* Text value to be checked.
19+
*/
20+
const SUCCESS_MESSAGE = 'A total of 1 record(s) were updated.';
21+
22+
/**
23+
* Assert that after mass update successful message appears.
24+
*
25+
* @param CatalogProductIndex $productGrid
26+
* @return void
27+
*/
28+
public function processAssert(CatalogProductIndex $productGrid)
29+
{
30+
$actualMessage = $productGrid->getMessagesBlock()->getSuccessMessages();
31+
\PHPUnit_Framework_Assert::assertEquals(
32+
self::SUCCESS_MESSAGE,
33+
$actualMessage,
34+
'Wrong success message is displayed.'
35+
);
36+
}
37+
38+
/**
39+
* Returns a string representation of the object.
40+
*
41+
* @return string
42+
*/
43+
public function toString()
44+
{
45+
return 'Mass update success message is present.';
46+
}
47+
}

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<data name="configData" xsi:type="string">product_flat</data>
1212
<data name="initialProduct/dataSet" xsi:type="string">simple_10_dollar</data>
1313
<data name="product/data/price/value" xsi:type="string">1.99</data>
14+
<constraint name="Magento\Catalog\Test\Constraint\AssertMassProductUpdateSuccessMessage" />
1415
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" />
1516
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" />
1617
</variation>

dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,9 @@
146146
<argument name="severity" xsi:type="string">high</argument>
147147
</arguments>
148148
</type>
149+
<type name="Magento\Catalog\Test\Constraint\AssertMassProductUpdateSuccessMessage">
150+
<arguments>
151+
<argument name="severity" xsi:type="string">high</argument>
152+
</arguments>
153+
</type>
149154
</config>

0 commit comments

Comments
 (0)