Skip to content

Commit 12c04d6

Browse files
committed
MAGETWO-97212: Enable skipped test - Move Anchored Category with Products (cron is ON, "Update on Save")
1 parent 6b69fa1 commit 12c04d6

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,31 @@
179179
<item name="dataset" xsi:type="string">catalogProductSimple::default</item>
180180
</field>
181181
</dataset>
182+
<dataset name="default_subcategory_with_anchored_parent_with_product">
183+
<field name="name" xsi:type="string">DefaultSubcategory%isolation%</field>
184+
<field name="url_key" xsi:type="string">default-subcategory-%isolation%</field>
185+
<field name="parent_id" xsi:type="array">
186+
<item name="dataset" xsi:type="string">default_anchored_category_with_product</item>
187+
</field>
188+
<field name="is_active" xsi:type="string">Yes</field>
189+
<field name="include_in_menu" xsi:type="string">Yes</field>
190+
<field name="is_anchor" xsi:type="string">Yes</field>
191+
<field name="category_products" xsi:type="array">
192+
<item name="dataset" xsi:type="string">catalogProductSimple::default</item>
193+
</field>
194+
</dataset>
195+
<dataset name="default_anchored_category_with_product">
196+
<field name="name" xsi:type="string">Category%isolation%</field>
197+
<field name="url_key" xsi:type="string">category%isolation%</field>
198+
<field name="is_active" xsi:type="string">Yes</field>
199+
<field name="include_in_menu" xsi:type="string">Yes</field>
200+
<field name="is_anchor" xsi:type="string">Yes</field>
201+
<field name="parent_id" xsi:type="array">
202+
<item name="dataset" xsi:type="string">default_category</item>
203+
</field>
204+
<field name="category_products" xsi:type="array">
205+
<item name="dataset" xsi:type="string">catalogProductSimple::product_5_dollar</item>
206+
</field>
207+
</dataset>
182208
</repository>
183209
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/MoveCategoryEntityTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
<constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteCategoryInGrid" />
1616
</variation>
1717
<variation name="MoveCategoryEntityTestVariation2" summary="Move default subcategory with anchored parent to default subcategory" ticketId="MAGETWO-21202">
18-
<data name="issue" xsi:type="string">MAGETWO-65147: Category is not present in Layered navigation block when anchor is on</data>
19-
<data name="childCategory/dataset" xsi:type="string">default_subcategory_with_anchored_parent</data>
18+
<data name="childCategory/dataset" xsi:type="string">default_subcategory_with_anchored_parent_with_product</data>
2019
<data name="parentCategory/dataset" xsi:type="string">default</data>
2120
<data name="moveLevel" xsi:type="number">2</data>
2221
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryMovedMessage" />
@@ -25,9 +24,8 @@
2524
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryBreadcrumbs" />
2625
</variation>
2726
<variation name="MoveCategoryEntityTestVariation3" summary="Move default anchored subcategory with anchored parent to default subcategory" ticketId="MAGETWO-21202">
28-
<data name="issue" xsi:type="string">MAGETWO-65147: Category is not present in Layered navigation block when anchor is on</data>
2927
<data name="childCategory/dataset" xsi:type="string">default_subcategory_with_anchored_parent</data>
30-
<data name="childCategory/data/parent_id/dataset" xsi:type="string">default_anchor_subcategory_with_anchored_parent</data>
28+
<data name="childCategory/data/parent_id/dataset" xsi:type="string">default_subcategory_with_anchored_parent_with_product</data>
3129
<data name="parentCategory/dataset" xsi:type="string">default_category</data>
3230
<data name="moveLevel" xsi:type="number">2</data>
3331
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryMovedMessage" />

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ class Navigation extends Block
6464
*/
6565
private $productQty = '/following-sibling::span[contains(text(), "%s")]';
6666

67+
/**
68+
* Selector for child element with product quantity.
69+
*
70+
* @var string
71+
*/
72+
private $productQtyInCategory = '/span[contains(text(), "%s")]';
73+
6774
/**
6875
* Remove all applied filters.
6976
*
@@ -124,10 +131,19 @@ public function applyFilter($filter, $linkPattern)
124131
*/
125132
public function isCategoryVisible(Category $category, $qty)
126133
{
127-
return $this->_rootElement->find(
128-
sprintf($this->categoryName, $category->getName()) . sprintf($this->productQty, $qty),
129-
Locator::SELECTOR_XPATH
130-
)->isVisible();
134+
$link = $this->_rootElement->find(sprintf($this->optionTitle, 'Category'), Locator::SELECTOR_XPATH);
135+
if ($link->isVisible()) {
136+
$link->click();
137+
return $this->_rootElement->find(
138+
sprintf($this->categoryName, $category->getName()) . sprintf($this->productQtyInCategory, $qty),
139+
Locator::SELECTOR_XPATH
140+
)->isVisible();
141+
} else {
142+
return $this->_rootElement->find(
143+
sprintf($this->categoryName, $category->getName()) . sprintf($this->productQty, $qty),
144+
Locator::SELECTOR_XPATH
145+
)->isVisible();
146+
}
131147
}
132148

133149
/**

0 commit comments

Comments
 (0)