Skip to content

Commit c37c5ff

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

File tree

8 files changed

+91
-15
lines changed

8 files changed

+91
-15
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTypeOrderOnCreate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function processAssert(CatalogProductIndex $catalogProductIndex, array $m
3939
*/
4040
public function toString()
4141
{
42-
return 'Order and filling of types on product page equals to incoming data.';
42+
return 'Order and types of product on product page equals to incoming data.';
4343
}
4444
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
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/Magento/Mtf/Repository/etc/repository.xsd">
9+
<repository class="Magento\Config\Test\Repository\ConfigData">
10+
<dataset name="product_flat">
11+
<field name="catalog/frontend/flat_catalog_product" xsi:type="array">
12+
<item name="scope" xsi:type="string">default</item>
13+
<item name="scope_id" xsi:type="number">0</item>
14+
<item name="label" xsi:type="string">Yes</item>
15+
<item name="value" xsi:type="number">1</item>
16+
</field>
17+
</dataset>
18+
<dataset name="product_flat_rollback">
19+
<field name="catalog/frontend/flat_catalog_product" xsi:type="array">
20+
<item name="scope" xsi:type="string">default</item>
21+
<item name="scope_id" xsi:type="number">0</item>
22+
<item name="label" xsi:type="string">No</item>
23+
<item name="value" xsi:type="number">0</item>
24+
</field>
25+
</dataset>
26+
</repository>
27+
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ class UpdateSimpleProductEntityTest extends Injectable
5252
*/
5353
protected $editProductPage;
5454

55+
/**
56+
* Configuration data.
57+
*
58+
* @var string
59+
*/
60+
protected $configData;
61+
5562
/**
5663
* Injection data
5764
*
@@ -72,10 +79,12 @@ public function __inject(
7279
*
7380
* @param CatalogProductSimple $initialProduct
7481
* @param CatalogProductSimple $product
82+
* @param string $configData
7583
* @return array
7684
*/
77-
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
85+
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
7886
{
87+
$this->configData = $configData;
7988
// Preconditions
8089
$initialProduct->persist();
8190
$initialCategory = $initialProduct->hasData('category_ids')
@@ -84,6 +93,12 @@ public function test(CatalogProductSimple $initialProduct, CatalogProductSimple
8493
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0]
8594
? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]
8695
: $initialCategory;
96+
if ($configData) {
97+
$this->objectManager->create(
98+
'Magento\Config\Test\TestStep\SetupConfigurationStep',
99+
['configData' => $configData]
100+
)->run();
101+
}
87102

88103
// Steps
89104
$filter = ['sku' => $initialProduct->getSku()];
@@ -95,4 +110,19 @@ public function test(CatalogProductSimple $initialProduct, CatalogProductSimple
95110

96111
return ['category' => $category];
97112
}
113+
114+
/**
115+
* Clear data after test
116+
*
117+
* @return void
118+
*/
119+
public function tearDown()
120+
{
121+
if ($this->configData) {
122+
$this->objectManager->create(
123+
'Magento\Config\Test\TestStep\SetupConfigurationStep',
124+
['configData' => $this->configData, 'rollback' => true]
125+
)->run();
126+
}
127+
}
98128
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,17 @@
138138
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
139139
<constraint name="Magento\Catalog\Test\Constraint\AssertProductNotVisibleInCategory" />
140140
</variation>
141+
<variation name="EditSimpleProductTestVariation10">
142+
<data name="description" xsi:type="string">Edit product with enabled flat</data>
143+
<data name="configData" xsi:type="string">product_flat</data>
144+
<data name="initialProduct/dataSet" xsi:type="string">simple_10_dollar</data>
145+
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
146+
<data name="product/data/sku" xsi:type="string">sku_simple_product_%isolation%</data>
147+
<data name="product/data/price/value" xsi:type="string">1.99</data>
148+
<data name="product/data/price/preset" xsi:type="string">-</data>
149+
<data name="product/data/attribute_set_id/dataSet" xsi:type="string">default</data>
150+
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" />
151+
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" />
152+
</variation>
141153
</testCase>
142154
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* 2. Navigate to PRODUCTS -> Catalog.
1616
*
1717
* @group Products_(MX)
18+
* @ZephyrId MAGETWO-37146
1819
*/
1920
class ValidateOrderOfProductTypeTest extends Injectable
2021
{

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerForgotPasswordSuccessMessage.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Magento\Customer\Test\Fixture\Customer;
1010
use Magento\Mtf\Constraint\AbstractConstraint;
1111
use Magento\Customer\Test\Page\CustomerAccountLogin;
12-
use Magento\Customer\Test\Page\CustomerAccountForgotPassword;
1312

1413
/**
1514
* Assert that customer forgot password message is present on customer account forgot password page.
@@ -23,18 +22,13 @@ class AssertCustomerForgotPasswordSuccessMessage extends AbstractConstraint
2322
* Assert that customer forgot password message is present on customer account forgot password page.
2423
*
2524
* @param CustomerAccountLogin $customerLogin
26-
* @param CustomerAccountForgotPassword $forgotPassword
2725
* @param Customer $customer
2826
* @return void
2927
*/
3028
public function processAssert(
3129
CustomerAccountLogin $customerLogin,
32-
CustomerAccountForgotPassword $forgotPassword,
3330
Customer $customer
3431
) {
35-
$forgotPassword->open();
36-
$forgotPassword->getForgotPasswordForm()->resetForgotPassword($customer);
37-
3832
$message = sprintf(
3933
self::SUCCESS_MESSAGE_FIRST_PART . self::SUCCESS_MESSAGE_SECOND_PART,
4034
$customer->getEmail()

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88

99
use Magento\Mtf\TestCase\Injectable;
1010
use Magento\Customer\Test\Fixture\Customer;
11+
use Magento\Customer\Test\Page\CustomerAccountForgotPassword;
1112

1213
/**
1314
* Precondition:
1415
* 1. Customer is created.
1516
*
17+
* Steps:
18+
* 1. Open forgot password page.
19+
* 2. Fill e-mail.
20+
* 3. Click forgot password button.
21+
*
1622
* @group Customer_(CS)
23+
* @ZephyrId MAGETWO-37145
1724
*/
1825
class ForgotPasswordOnFrontendTest extends Injectable
1926
{
@@ -26,11 +33,16 @@ class ForgotPasswordOnFrontendTest extends Injectable
2633
* Create customer.
2734
*
2835
* @param Customer $customer
36+
* @param CustomerAccountForgotPassword $forgotPassword
2937
* @return void
3038
*/
31-
public function test(Customer $customer)
39+
public function test(Customer $customer, CustomerAccountForgotPassword $forgotPassword)
3240
{
3341
// Precondition
3442
$customer->persist();
43+
44+
// Steps
45+
$forgotPassword->open();
46+
$forgotPassword->getForgotPasswordForm()->resetForgotPassword($customer);
3547
}
3648
}

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9-
<testCase name="Magento\Customer\Test\TestCase\ForgotPasswordOnFrontendTest">
10-
<variation name="ForgotPasswordOnFrontendTestVariation1">
11-
<data name="customer/dataSet" xsi:type="string">customer_US_1</data>
12-
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerForgotPasswordSuccessMessage"/>
13-
</variation>
14-
</testCase>
9+
<testCase name="Magento\Customer\Test\TestCase\ForgotPasswordOnFrontendTest">
10+
<variation name="ForgotPasswordOnFrontendTestVariation1">
11+
<data name="customer/dataSet" xsi:type="string">customer_US_1</data>
12+
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerForgotPasswordSuccessMessage" />
13+
</variation>
14+
</testCase>
1515
</config>

0 commit comments

Comments
 (0)