Skip to content

Commit 133c332

Browse files
author
Oleksandr Manchenko
committed
MTA-1899: Re-factor existing tests for MAP
- Fixed logical and code style errors
1 parent a976f4b commit 133c332

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpInShoppingCart.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function processAssert(
5050
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
5151

5252
$checkoutCart->open();
53-
sleep(3);
5453
$productPrice = $product->hasData('checkout_data')
5554
? $product->getCheckoutData()['cartItem']['price']
5655
: $product->getPrice();
@@ -62,7 +61,6 @@ public function processAssert(
6261
* Return string representation of object.
6362
*
6463
* @return string
65-
* @return string
6664
*/
6765
public function toString()
6866
{

dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnCategoryPage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ public function processAssert(
3737
$productBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product);
3838
\PHPUnit_Framework_Assert::assertTrue(
3939
$productBlock->isVisible(),
40-
'Product is invisible on Category page'
40+
'Product is invisible on Category page.'
4141
);
4242

4343
$priceBlock = $productBlock->getPriceBlock();
4444
\PHPUnit_Framework_Assert::assertEquals(
4545
$product->getMsrp(),
4646
$priceBlock->getOldPrice(),
47-
'Displayed on Category page MAP is incorrect'
47+
'Displayed on Category page MAP is incorrect.'
4848
);
4949
\PHPUnit_Framework_Assert::assertFalse(
5050
$priceBlock->isRegularPriceVisible(),
@@ -56,12 +56,12 @@ public function processAssert(
5656
\PHPUnit_Framework_Assert::assertContains(
5757
$product->getMsrp(),
5858
$mapBlock->getMapOldPrice(),
59-
'Displayed on Category page MAP is incorrect'
59+
'Displayed on Category page MAP is incorrect.'
6060
);
6161
\PHPUnit_Framework_Assert::assertEquals(
6262
$product->getPrice(),
6363
$mapBlock->getActualPrice(),
64-
'Displayed on Category page price is incorrect'
64+
'Displayed on Category page price is incorrect.'
6565
);
6666
}
6767

dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnProductView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ public function processAssert(
5454
\PHPUnit_Framework_Assert::assertContains(
5555
$product->getMsrp(),
5656
$mapBlock->getMapOldPrice(),
57-
'Displayed on Product view page MAP is incorrect'
57+
'Displayed on Product view page MAP is incorrect.'
5858
);
5959
\PHPUnit_Framework_Assert::assertEquals(
6060
$product->getPrice(),
6161
$mapBlock->getActualPrice(),
62-
'Displayed on Product view page price is incorrect'
62+
'Displayed on Product view page price is incorrect.'
6363
);
6464
}
6565

dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/CatalogProductSimple.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
99
<repository class="Magento\Catalog\Test\Repository\CatalogProductSimple">
10-
<dataset name="with_msrp">
10+
<dataset name="msrp_before_order_confirmation">
1111
<field name="attribute_set_id" xsi:type="array">
1212
<item name="dataSet" xsi:type="string">default</item>
1313
</field>
@@ -36,7 +36,7 @@
3636
<field name="msrp_display_actual_price_type" xsi:type="string">Before Order Confirmation</field>
3737
</dataset>
3838

39-
<dataset name="simple_with_map">
39+
<dataset name="msrp_on_gesture">
4040
<field name="name" xsi:type="string">Simple Product with msrp %isolation%</field>
4141
<field name="url_key" xsi:type="string">simple-product-with-msrp-%isolation%</field>
4242
<field name="sku" xsi:type="string">sku_simple_product_with_msrp_%isolation%</field>

dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigData.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@
99
<repository class="Magento\Config\Test\Repository\ConfigData">
1010
<dataset name="msrp">
1111
<field path="sales/msrp/enabled" scope="sales" scope_id="1" label="Yes" xsi:type="string">1</field>
12-
<field path="sales/msrp/display_price_type" scope="sales" scope_id="1" label="Before Order Confirmation" xsi:type="string">3</field>
1312
</dataset>
1413

1514
<dataset name="msrp_rollback">
1615
<field path="sales/msrp/enabled" scope="sales" scope_id="1" label="No" xsi:type="string">0</field>
16+
</dataset>
17+
18+
<dataset name="msrp_before_order_confirmation">
19+
<field path="sales/msrp/enabled" scope="sales" scope_id="1" label="Yes" xsi:type="string">1</field>
20+
<field path="sales/msrp/display_price_type" scope="sales" scope_id="1" label="Before Order Confirmation" xsi:type="string">3</field>
21+
</dataset>
22+
23+
<dataset name="msrp_before_order_confirmation_rollback">
24+
<field path="sales/msrp/enabled" scope="sales" scope_id="1" label="No" xsi:type="string">0</field>
1725
<field path="sales/msrp/display_price_type" scope="sales" scope_id="1" label="On Gesture" xsi:type="string">1</field>
1826
</dataset>
1927
</repository>

dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
use Magento\Mtf\TestCase\Injectable;
1010

1111
/**
12-
* Preconditions:
13-
* 1. Create product
14-
*
1512
* Steps:
16-
* 1. Perform all assertions
13+
* 1. Create product.
14+
* 2. Perform all assertions.
1715
*
1816
* @group MAP_(MX)
1917
* @ZephyrId MAGETWO-12430, MAGETWO-12847
2018
*/
2119
class ApplyMapTest extends Injectable
2220
{
2321
/* tags */
22+
const DOMAIN = 'MX';
23+
const MVP = 'yes';
2424
const TEST_TYPE = 'acceptance_test';
2525
/* end tags */
2626

@@ -40,9 +40,9 @@ public function test($product)
4040
$product = $this->objectManager->create(
4141
'Magento\Catalog\Test\TestStep\CreateProductStep',
4242
['product' => $product]
43-
)->run()['product'];
43+
)->run();
4444

45-
return ['product' => $product];
45+
return $product;
4646
}
4747

4848
/**

dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
<testCase name="Magento\Msrp\Test\TestCase\ApplyMapTest">
1010
<variation name="ApplyMapTestVariation1">
1111
<data name="description" xsi:type="string">MAGETWO-12430: Apply Minimum Advertised Price Setting to Simple Product</data>
12-
<data name="product" xsi:type="string">catalogProductSimple::simple_with_map</data>
13-
<data name="tag" xsi:type="string">test_type:acceptance_test</data>
14-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage"/>
15-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView"/>
16-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart"/>
12+
<data name="product" xsi:type="string">catalogProductSimple::msrp_on_gesture</data>
13+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage" />
14+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView" />
15+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart" />
1716
</variation>
1817
<variation name="ApplyMapTestVariation2">
1918
<data name="description" xsi:type="string">MAGETWO-12847: Apply Minimum Advertised Price to the Configurable Product</data>
2019
<data name="product" xsi:type="string">configurableProduct::msrp_on_gesture_one_variation</data>
2120
<data name="tag" xsi:type="string">test_type:acceptance_test</data>
22-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage"/>
23-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView"/>
24-
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart"/>
21+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage" />
22+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView" />
23+
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart" />
2524
</variation>
2625
</testCase>
2726
</config>

0 commit comments

Comments
 (0)