Skip to content

Commit 946d85d

Browse files
author
Dmytro Poperechnyy
committed
MAGETWO-15418: Sold products aren't displayed in Bestsellers
- Moved selectors to separate properties in Ordered class;
1 parent 808fc89 commit 946d85d

File tree

1 file changed

+17
-5
lines changed
  • dev/tests/functional/tests/app/Magento/Backend/Test/Block/Dashboard/Tab/Products

1 file changed

+17
-5
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Dashboard/Tab/Products/Ordered.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
*/
1616
class Ordered extends Grid
1717
{
18+
/**
19+
* Base part of row locator template
20+
*
21+
* @var string
22+
*/
23+
protected $location = '//table[@id="productsOrderedGrid_table"]/tbody/tr';
24+
25+
/**
26+
* Secondary part of row locator template
27+
*
28+
* @var string
29+
*/
30+
protected $rowTemplate = 'td[contains(., "%s")]';
31+
1832
/**
1933
* Check if ordered product is in grid
2034
*
@@ -23,19 +37,17 @@ class Ordered extends Grid
2337
*/
2438
public function isProductVisible(CatalogProductSimple $product)
2539
{
26-
$location = '//table[@id="productsOrderedGrid_table"]/tbody/tr[';
27-
$rowTemplate = 'td[contains(., "%s")]';
2840
$filter = [
2941
$product->getName(),
3042
$product->getPrice(),
3143
$product->getCheckoutData()['qty'],
3244
];
3345
$rows = [];
3446
foreach ($filter as $value) {
35-
$rows[] = sprintf($rowTemplate, $value);
47+
$rows[] = sprintf($this->rowTemplate, $value);
3648
}
37-
$location = $location . implode(' and ', $rows) . ']';
49+
$location = $this->location . '[' . implode(' and ', $rows) . ']';
3850

39-
return $this->_rootElement->find($location, Locator::SELECTOR_XPATH)->isVisible() ? true : false;
51+
return $this->_rootElement->find($location, Locator::SELECTOR_XPATH)->isVisible();
4052
}
4153
}

0 commit comments

Comments
 (0)