Skip to content

Commit 25e030f

Browse files
committed
MTA-1594: Re-factor Functional tests which are not end-to-end
- Re-factored ValidateOrderOfProductType
1 parent e2c33da commit 25e030f

File tree

8 files changed

+152
-0
lines changed

8 files changed

+152
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/4" xsi:type="string">Bundle Product</data>
12+
</variation>
13+
</testCase>
14+
</config>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
* Assert that order and filling of types on product page equals to incoming data.
14+
*/
15+
class AssertMenuProductType extends AbstractConstraint
16+
{
17+
/**
18+
* Assert that order and filling of types on product page equals to incoming data.
19+
*
20+
* @param CatalogProductIndex $catalogProductIndex
21+
* @param array $menu
22+
* @return void
23+
*/
24+
public function processAssert(CatalogProductIndex $catalogProductIndex, $menu = [])
25+
{
26+
$catalogProductIndex->open();
27+
ksort($menu);
28+
\PHPUnit_Framework_Assert::assertEquals(
29+
implode("\n", $menu),
30+
$catalogProductIndex->getGridPageActionBlock()->getTypeList(),
31+
'Order and filling of types on product page not equals to incoming data.'
32+
);
33+
}
34+
35+
/**
36+
* Success message is displayed.
37+
*
38+
* @return string
39+
*/
40+
public function toString()
41+
{
42+
return 'Order and filling of types on product page equals to incoming data.';
43+
}
44+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\TestCase\Product;
8+
9+
use Magento\Mtf\TestCase\Injectable;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11+
12+
/**
13+
* Steps:
14+
* 1. Login to backend.
15+
* 2. Navigate to PRODUCTS -> Catalog.
16+
*
17+
* @group Products_(MX)
18+
*/
19+
class ValidateOrderOfProductTypeTest extends Injectable
20+
{
21+
/**
22+
* Open catalog product index page.
23+
*
24+
* @param CatalogProductIndex $catalogProductIndex
25+
* @return void
26+
*/
27+
public function test(CatalogProductIndex $catalogProductIndex)
28+
{
29+
$catalogProductIndex->open();
30+
}
31+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/0" xsi:type="string">Simple Product</data>
12+
<data name="menu/3" xsi:type="string">Virtual Product</data>
13+
<constraint name="Magento\Catalog\Test\Constraint\AssertMenuProductType" />
14+
</variation>
15+
</testCase>
16+
</config>

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
@@ -141,4 +141,9 @@
141141
<argument name="severity" xsi:type="string">high</argument>
142142
</arguments>
143143
</type>
144+
<type name="Magento\Catalog\Test\Constraint\AssertMenuProductType">
145+
<arguments>
146+
<argument name="severity" xsi:type="string">high</argument>
147+
</arguments>
148+
</type>
144149
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/1" xsi:type="string">Configurable Product</data>
12+
</variation>
13+
</testCase>
14+
</config>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/5" xsi:type="string">Downloadable Product</data>
12+
</variation>
13+
</testCase>
14+
</config>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/2" xsi:type="string">Grouped Product</data>
12+
</variation>
13+
</testCase>
14+
</config>

0 commit comments

Comments
 (0)