Skip to content

Commit 3c8c1a1

Browse files
author
Oleksii Kolesnyk
committed
MTA-2729: Functional test maintenance. Part 4
1 parent 9c1711b commit 3c8c1a1

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ protected function verifyPrice()
4242
{
4343
$priceBlock = $this->productView->getPriceBlock();
4444
$formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice();
45-
$priceData = $this->product->getDataFieldConfig('price')['source']->getPriceData();
46-
$fixturePrice = number_format($priceData['category_price'], 2, '.', '');
45+
$fixturePrice = $this->getLowestConfigurablePrice();
4746

4847
if ($fixturePrice != $formPrice) {
4948
return "Displayed product price on product page(front-end) not equals passed from fixture. "
@@ -97,4 +96,23 @@ protected function verifyAttributes()
9796
$errors = $this->verifyData($configurableOptions, $formOptions, true, false);
9897
return empty($errors) ? null : $this->prepareErrors($errors, 'Error configurable options:');
9998
}
99+
100+
/**
101+
* Returns lowest possible price of configurable product.
102+
*
103+
* @return string
104+
*/
105+
protected function getLowestConfigurablePrice() {
106+
$price = null;
107+
$configurableOptions = $this->product->getConfigurableAttributesData();
108+
109+
foreach ($configurableOptions['matrix'] as $option) {
110+
$price = $price === null ? $option['price'] : $price;
111+
if ($price > $option['price']) {
112+
$price = $option['price'];
113+
}
114+
}
115+
116+
return $price;
117+
}
100118
}

dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ public function selectItems(array $items, $isSortable = true)
297297
$this->waitLoader();
298298
$selectItem = $this->getRow($item)->find($this->selectItem);
299299
do {
300-
if ($selectItem->isVisible() && !$selectItem->isSelected()) {
301-
$selectItem->click();
300+
if ($selectItem->isVisible()) {
301+
if (!$selectItem->isSelected()) {
302+
$selectItem->click();
303+
}
302304
break;
303305
}
304306
} while ($this->nextPage());

0 commit comments

Comments
 (0)