/**
  * Assert that total sales info in report grid is actual
  *
  * @param OrderInjectable $order
  * @param array $salesReport
  * @param array $initialSalesTotalResult
  * @param SalesReport $salesReportPage
  * @return void
  */
 public function processAssert(OrderInjectable $order, array $salesReport, array $initialSalesTotalResult, SalesReport $salesReportPage)
 {
     $this->salesReportPage = $salesReportPage;
     $this->order = $order;
     $this->searchInSalesReportGrid($salesReport);
     $salesResult = $this->prepareSalesResult($salesReportPage->getGridBlock()->getTotalResult());
     $prepareInitialResult = $this->prepareSalesResult($this->prepareExpectedResult($initialSalesTotalResult));
     \PHPUnit_Framework_Assert::assertEquals($prepareInitialResult, $salesResult, "Grand total Sales result is not correct.");
 }
 /**
  * Sales order report.
  *
  * @param OrderInjectable $order
  * @param array $salesReport
  * @return array
  */
 public function test(OrderInjectable $order, array $salesReport)
 {
     // Preconditions
     $this->salesReport->open();
     $this->salesReport->getMessagesBlock()->clickLinkInMessages('notice', 'here');
     $this->salesReport->getFilterBlock()->viewsReport($salesReport);
     $this->salesReport->getActionBlock()->showReport();
     $initialSalesResult = $this->salesReport->getGridBlock()->getLastResult();
     $initialSalesTotalResult = $this->salesReport->getGridBlock()->getTotalResult();
     $order->persist();
     $invoice = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order]);
     $invoice->run();
     return ['initialSalesResult' => $initialSalesResult, 'initialSalesTotalResult' => $initialSalesTotalResult];
 }