Skip to content

Commit f0b932f

Browse files
committed
MAGETWO-60575: Implement Functional Test for Bundle Options on Catalog Profuct Page
- MAGETWO-55729 [Customer] Optimize performance for bundled products with lots of product options
1 parent bfd14f5 commit f0b932f

File tree

5 files changed

+24
-52
lines changed

5 files changed

+24
-52
lines changed

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ public function getBundleSummaryBlock()
7878
);
7979
}
8080

81-
/**
82-
* Get Bundle customized Price block.
83-
*
84-
* @return \Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice
85-
*/
86-
public function getCustomizedPriceBlock()
87-
{
88-
return $this->blockFactory->create(
89-
\Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice::class,
90-
['element' => $this->_rootElement->find($this->customizedBundlePriceSelector)]
91-
);
92-
}
93-
9481
/**
9582
* Click "Customize and add to cart button".
9683
*

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Summary.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class Summary extends \Magento\Catalog\Test\Block\Product\View
2020
*/
2121
private $configuredPriceBlockSelector = '.price-configured_price';
2222

23+
/**
24+
* Summary items selector.
25+
*
26+
* @var string
27+
*/
28+
private $summaryItemsSelector = '.bundle li div div';
29+
2330
/**
2431
* Get configured price block.
2532
*
@@ -32,4 +39,14 @@ public function getConfiguredPriceBlock()
3239
['element' => $this->_rootElement->find($this->configuredPriceBlockSelector)]
3340
);
3441
}
42+
43+
/**
44+
* Get Bundle Summary row items.
45+
*
46+
* @return \Magento\Mtf\Client\ElementInterface[]
47+
*/
48+
public function getSummaryItems()
49+
{
50+
return $this->_rootElement->getElements($this->summaryItemsSelector);
51+
}
3552
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ public function processAssert(
3333

3434
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
3535
$bundleOptions = $product->getData()['bundle_selections']['bundle_options'];
36-
$optionsBlock = $catalogProductView->getBundleViewBlock();
37-
$customizedPriceBlock = $optionsBlock->getCustomizedPriceBlock();
36+
$bundleViewBlock = $catalogProductView->getBundleViewBlock();
37+
$configuredPriceBlock = $bundleViewBlock->getBundleSummaryBlock()->getConfiguredPriceBlock();
3838
foreach ($bundleOptions as $bundleOption) {
3939
foreach ($bundleOption['assigned_products'] as $assignedProduct) {
40-
$optionsBlock->fillOptionsWithCustomData([
40+
$bundleViewBlock->fillOptionsWithCustomData([
4141
[
4242
'title' => $bundleOption['title'],
4343
'type' => $bundleOption['type'],
44+
'frontend_type' => $bundleOption['type'],
4445
'value' => [
4546
'name' => $assignedProduct['search_data']['name']
4647
]
@@ -49,11 +50,11 @@ public function processAssert(
4950
$assignedProductPrice = (double)$assignedProduct['data']['selection_price_value'];
5051
$assignedProductQty = (double)$assignedProduct['data']['selection_qty'];
5152

52-
foreach ($optionsBlock->getBundleSummary() as $bundleSummaryItem) {
53+
foreach ($bundleViewBlock->getBundleSummaryBlock()->getSummaryItems() as $bundleSummaryItem) {
5354
$bundleSummaryItemText = $bundleSummaryItem->getText();
5455
if (strpos($bundleSummaryItemText, $assignedProduct['search_data']['name']) !== false) {
5556
$optionData = $this->getBundleOptionData($bundleSummaryItemText);
56-
$optionData['price'] = (double)$customizedPriceBlock->getFinalPrice();
57+
$optionData['price'] = (double)$configuredPriceBlock->getPrice();
5758
$actualResult[] = $optionData;
5859
}
5960
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@
628628
<item name="0" xsi:type="array">
629629
<item name="title" xsi:type="string">Drop-down Option</item>
630630
<item name="type" xsi:type="string">Drop-down</item>
631+
<item name="frontend_type" xsi:type="string">Drop-down</item>
631632
<item name="required" xsi:type="string">Yes</item>
632633
<item name="assigned_products" xsi:type="array">
633634
<item name="0" xsi:type="array">

0 commit comments

Comments
 (0)