Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertBestsellersOnDashboard.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Backend\Test\Page\Adminhtml\Dashboard;
12 
16 class AssertBestsellersOnDashboard extends AbstractConstraint
17 {
18  /* tags */
19  const SEVERITY = 'low';
20  /* end tags */
21 
29  public function processAssert(OrderInjectable $order, Dashboard $dashboard)
30  {
31  $dashboard->open();
32  $dashboard->getStoreStatsBlock()->refreshData();
34  $bestsellersGrid = $dashboard->getStoreStatsBlock()->getTab('bestsellers')->getBestsellersGrid();
35  $products = $order->getEntityId()['products'];
36  foreach ($products as $product) {
37  \PHPUnit\Framework\Assert::assertTrue(
38  $bestsellersGrid->isProductVisible($product),
39  'Bestseller ' . $product->getName() . ' is not present in report grid after refresh data.'
40  );
41  }
42  }
43 
49  public function toString()
50  {
51  return 'Bestsellers successfully updated after Refreshing data.';
52  }
53 }
$order
Definition: order.php:55