Skip to content

Commit 85fd01f

Browse files
vital-pantsialeyeunikshostko
authored andcommitted
MAGETWO-63054: [Catalog] MSRP field is not displayed for bundle products with fixed price
- Added variation to functional test
1 parent 432c458 commit 85fd01f

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Mtf\Client\Element\SimpleElement;
1111
use Magento\Ui\Test\Block\Adminhtml\Section;
1212
use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\Options\AbstractOptions;
13+
use Magento\Mtf\Client\Locator;
1314

1415
/**
1516
* Product advanced pricing section.
@@ -37,6 +38,20 @@ class AdvancedPricing extends Section
3738
*/
3839
protected $doneButton = '.action-primary[data-role="action"]';
3940

41+
/**
42+
* Selector for field.
43+
*
44+
* @var string
45+
*/
46+
private $fieldByName = '//*[contains(text(),"%s")]/preceding::div[2]/ancestor::div[1]';
47+
48+
/**
49+
* Selector for previous field.
50+
*
51+
* @var string
52+
*/
53+
private $previousField = '//*[contains(text(),"%s")]/preceding::div[2]//label';
54+
4055
/**
4156
* Fill 'Advanced price' product form on tab.
4257
*
@@ -104,4 +119,27 @@ public function getTierPriceForm(SimpleElement $element = null)
104119
['element' => $element]
105120
);
106121
}
122+
123+
/**
124+
* Check if the field is displayed correctly.
125+
*
126+
* @param string $fieldName
127+
* @param string|null $previousFieldName
128+
* @return bool
129+
*/
130+
public function checkField($fieldName, $previousFieldName = null)
131+
{
132+
$field = $this->_rootElement->find(sprintf($this->fieldByName, $fieldName), Locator::SELECTOR_XPATH);
133+
if ($field->isVisible()) {
134+
if ($previousFieldName) {
135+
return $this->_rootElement->find(
136+
sprintf($this->previousField, $fieldName),
137+
Locator::SELECTOR_XPATH
138+
)->getText() == $previousFieldName;
139+
} else {
140+
return $field->isVisible();
141+
}
142+
}
143+
return false;
144+
}
107145
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Msrp\Test\Constraint;
8+
9+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
use Magento\Mtf\Fixture\FixtureInterface;
12+
13+
/**
14+
* Check "Manufacturer's Suggested Retail Price" field on "Advanced pricing" page.
15+
*/
16+
class AssertProductEditPageAdvancedPricingFields extends AbstractConstraint
17+
{
18+
/**
19+
* Title of "Price View".
20+
*
21+
* @var string
22+
*/
23+
private $priceFieldTitle = 'Price View';
24+
25+
/**
26+
* Title of "Manufacturer's Suggested Retail Price" field.
27+
*
28+
* @var string
29+
*/
30+
private $manufacturerFieldTitle = 'Manufacturer\'s Suggested Retail Price';
31+
32+
/**
33+
* @param CatalogProductEdit $catalogProductEdit
34+
* @param FixtureInterface $product
35+
* @return void
36+
*/
37+
public function processAssert(CatalogProductEdit $catalogProductEdit, FixtureInterface $product)
38+
{
39+
$catalogProductEdit->open(['id' => $product->getId()]);
40+
$catalogProductEdit->getProductForm()->openSection('advanced-pricing');
41+
$advancedPricing = $catalogProductEdit->getProductForm()->getSection('advanced-pricing');
42+
43+
\PHPUnit_Framework_Assert::assertTrue(
44+
$advancedPricing->checkField($this->manufacturerFieldTitle, $this->priceFieldTitle),
45+
'"Manufacturer\'s Suggested Retail Price" field is not correct.'
46+
);
47+
}
48+
49+
/**
50+
* Returns a string representation of the object.
51+
*
52+
* @return string
53+
*/
54+
public function toString()
55+
{
56+
return '"Manufacturer\'s Suggested Retail Price" field is correct.';
57+
}
58+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@
4646
<constraint name="Magento\Msrp\Test\Constraint\AssertMapOnProductView" />
4747
<constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart" />
4848
</variation>
49+
<variation name="ApplyMapTestVariation6" summary="[Catalog] MSRP field is not displayed for bundle products with fixed price" ticketId="MAGETWO-63054">
50+
<data name="product" xsi:type="string">bundleProduct::bundle_fixed_product</data>
51+
<constraint name="Magento\Msrp\Test\Constraint\AssertProductEditPageAdvancedPricingFields" />
52+
</variation>
4953
</testCase>
5054
</config>

0 commit comments

Comments
 (0)