Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 6c530aa

Browse files
committed
MAGETWO-80093: Create Functional Test to verify OOS Configuration product option not showing in Layered Navigation
- Fixed code styles and annotations
1 parent fde3cc0 commit 6c530aa

File tree

4 files changed

+8
-52
lines changed

4 files changed

+8
-52
lines changed

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

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,14 @@
1919
*/
2020
class AssertConfigurableProductAttributeOptionInLayeredNavigation extends AbstractConstraint
2121
{
22-
23-
/**
24-
* Get product attribute
25-
*
26-
* @param InjectableFixture $product
27-
* @return mixed
28-
29-
private function getAttribute(InjectableFixture $product)
30-
{
31-
$attributes = $product->getDataFieldConfig('configurable_attributes_data')['source']->getAttributes();
32-
if (is_array($attributes)) {
33-
$attribute = current($attributes);
34-
}
35-
return isset($attribute) ? $attribute : null;
36-
}
37-
*/
38-
39-
/**
40-
* @param InjectableFixture $product
41-
*/
42-
/**
43-
private function getOptions(InjectableFixture $product) {
44-
45-
46-
$attributesData = $product->hasData('configurable_attributes_data')
47-
? $product->getConfigurableAttributesData()['attributes_data']
48-
: [];
49-
foreach($attributesData as $option) {
50-
$optionValue = $option[0]['view'];
51-
}
52-
53-
}
54-
*/
55-
5622
/**
5723
* Check whether the attribute filter is displayed on the frontend in Layered navigation.
5824
*
5925
* @param CatalogCategoryView $catalogCategoryView
6026
* @param InjectableFixture $product
61-
* @param CatalogProductAttribute $attribute
6227
* @param CmsIndex $cmsIndex
6328
* @param FixtureFactory $fixtureFactory
29+
* @param $outOfStockOption
6430
* @return void
6531
*/
6632
public function processAssert(
@@ -84,14 +50,6 @@ public function processAssert(
8450
)->persist();
8551

8652
$cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
87-
/*$label = $attribute->hasData('manage_frontend_label')
88-
? $attribute->getManageFrontendLabel()
89-
: $attribute->getFrontendLabel();
90-
$attributeValue = $this->getAttribute($product);
91-
if($attributeValue)
92-
$label = $attributeValue->getOptions()[0]['view'];
93-
*/
94-
9553
$filters = $catalogCategoryView->getLayeredNavigationBlock()->getFilterContents();
9654

9755
\PHPUnit_Framework_Assert::assertFalse(

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/VerifyConfigurableProductLayeredNavigationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
* Steps:
1818
* 1. Log in to Admin.
1919
* 2. Open Products -> Catalog.
20-
* 3. Search and open child of configurable product from preconditions.
20+
* 3. Create a configurable product with three variations.
21+
* 4. Search and open child of configurable product from preconditions.
2122
* 4. Fill in data according to dataset.
2223
* 5. Save product.
2324
* 6. Perform all assertions.
2425
*
2526
* @group Configurable_Product
26-
* @ZephyrId MAGETWO-60196, MAGETWO-60206, MAGETWO-60236, MAGETWO-60296, MAGETWO-60297, MAGETWO-60325, MAGETWO-60328,
27-
* MAGETWO-60329, MAGETWO-60330
27+
* @ZephyrId MAGETWO-72439
2828
*/
2929
class VerifyConfigurableProductLayeredNavigationTest extends Scenario
3030
{

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/VerifyConfigurableProductLayeredNavigationTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
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\ConfigurableProduct\Test\TestCase\VerifyConfigurableProductLayeredNavigationTest" summary="Verify price for configurable product">
10-
<variation name="VerifyConfigurableProductEntityPriceTestVariation2" summary="Set child product Out of stock" ticketId="MAGETWO-60206">
9+
<testCase name="Magento\ConfigurableProduct\Test\TestCase\VerifyConfigurableProductLayeredNavigationTest" summary="Verify OOS option configurable product in Layered Navigation on storefront">
10+
<variation name="VerifyConfigurableProductEntityPriceTestVariation2" summary="Verify the out of stock configurable attribute option doesn't show in Layered navigation" ticketId="MAGETWO-72439">
1111
<data name="product" xsi:type="string">configurableProduct::product_with_3_sizes</data>
1212
<data name="productUpdate/childProductUpdate" xsi:type="array">
1313
<item name="data" xsi:type="array">

dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Block/Navigation.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Navigation extends Block
3737
protected $optionTitle = './/div[@class="filter-options-title" and contains(text(),"%s")]';
3838

3939
/**
40-
* Locator value for correspondent Attribute filter option content.
40+
* Locator value for corresponding filtered attribute option content.
4141
*
4242
* @var string
4343
*/
@@ -109,9 +109,7 @@ public function getFilters()
109109
public function getFilterContents()
110110
{
111111
$this->waitForElementVisible($this->loadedNarrowByList);
112-
113-
// $optionContents = $this->_rootElement->getElements(sprintf($this->optionContent, ''), Locator::SELECTOR_XPATH);
114-
$optionContents = $this->_rootElement->find($this->optionContent,Locator::SELECTOR_XPATH);
112+
$optionContents = $this->_rootElement->find($this->optionContent, Locator::SELECTOR_XPATH);
115113
$data =[];
116114
foreach ($optionContents as $optionContent) {
117115
$data[] = trim(strtoupper($optionContent->getText()));

0 commit comments

Comments
 (0)