/**
  * Assert that message from dataset is displayed on order(s) view page on backend.
  *
  * @param GiftMessage $giftMessage
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param FixtureFactory $fixtureFactory
  * @param array $products
  * @param string $orderId
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, SalesOrderView $salesOrderView, OrderIndex $orderIndex, FixtureFactory $fixtureFactory, array $products, $orderId)
 {
     $expectedData = [];
     $actualData = [];
     $orderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     if ($giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $formData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()];
         $giftMessageForm = $fixtureFactory->createByCode('giftMessage', ['data' => $formData]);
         $expectedData[] = $giftMessageForm->getData();
         $actualData[] = $salesOrderView->getGiftOptionsBlock()->getData($giftMessageForm);
     }
     if ($giftMessage->getAllowGiftOptionsForItems() === 'Yes') {
         foreach ($giftMessage->getItems() as $key => $giftMessageItem) {
             $expectedData[] = $giftMessageItem->getData();
             $product = $products[$key];
             $actualData[] = $salesOrderView->getGiftItemsBlock()->getItemProduct($product)->getGiftMessageFormData($giftMessage);
         }
     }
     $errors = $this->verifyData($expectedData, $actualData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Assert  that comment about authorized amount exist in Comments History section on order page in backend.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $prices
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $prices)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
     \PHPUnit_Framework_Assert::assertContains(self::AUTHORIZED_AMOUNT . $prices['grandTotal'], $actualAuthorizedAmount, 'Incorrect authorized amount value for the order #' . $orderId);
 }
 /**
  * Assert that status is correct on order page in backend (same with value of orderStatus variable)
  *
  * @param string $status
  * @param string $orderId
  * @param OrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param string|null $statusToCheck
  * @return void
  */
 public function processAssert($status, $orderId, OrderIndex $salesOrder, SalesOrderView $salesOrderView, $statusToCheck = null)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $orderStatus = $statusToCheck == null ? $status : $statusToCheck;
     \PHPUnit_Framework_Assert::assertEquals($salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), $orderStatus);
 }
 /**
  * Assert that orders are present in Sales -> Orders Grid
  *
  * @param OrderInjectable[] $orders
  * @param OrderIndex $orderIndex
  * @param array $orderStatuses
  * @param AssertOrderInOrdersGrid $assertOrderInOrdersGrid
  * @return void
  */
 public function processAssert($orders, OrderIndex $orderIndex, array $orderStatuses, AssertOrderInOrdersGrid $assertOrderInOrdersGrid)
 {
     $orderIndex->open();
     foreach ($orders as $key => $order) {
         $assertOrderInOrdersGrid->assert($order, $orderIndex, $orderStatuses[$key]);
     }
 }
 /**
  * Assert that order with fixture data in not more in the Orders grid
  *
  * @param OrderInjectable $order
  * @param OrderIndex $orderIndex
  * @return void
  */
 public function processAssert(OrderInjectable $order, OrderIndex $orderIndex)
 {
     $data = $order->getData();
     $filter = ['id' => $data['id']];
     $orderIndex->open();
     $errorMessage = implode(', ', $filter);
     \PHPUnit_Framework_Assert::assertFalse($orderIndex->getSalesOrderGrid()->isRowVisible($filter), 'Order with following data \'' . $errorMessage . '\' is present in Orders grid.');
 }
 /**
  * Assert that comment about captured amount exist in Comments History section on order page in Admin.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $capturedPrices
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $capturedPrices)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $actualCapturedAmount = $salesOrderView->getOrderHistoryBlock()->getCapturedAmount();
     foreach ($capturedPrices as $key => $capturedPrice) {
         \PHPUnit_Framework_Assert::assertContains(self::CAPTURED_AMOUNT . $capturedPrice, $actualCapturedAmount[$key], 'Incorrect captured amount value for the order #' . $orderId);
     }
 }
 /**
  * Put created order on hold.
  *
  * @param OrderInjectable $order
  * @return array
  */
 public function test(OrderInjectable $order)
 {
     // Preconditions
     $order->persist();
     // Steps
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->salesOrderView->getPageActions()->hold();
     return ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer()];
 }
Ejemplo n.º 8
0
 /**
  * Mass orders update.
  *
  * @param string $steps
  * @param int $ordersCount
  * @param string $action
  * @param string $resultStatuses
  * @return array
  */
 public function test($steps, $ordersCount, $action, $resultStatuses)
 {
     // Preconditions
     $orders = $this->createOrders($ordersCount, $steps);
     $items = $this->prepareFilter($orders);
     // Steps
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->massaction($items, $action);
     return ['orders' => $orders, 'orderStatuses' => explode(',', $resultStatuses)];
 }
 /**
  * Create shipping for order on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     $this->salesOrderView->getPageActions()->ship();
     if (!empty($this->data)) {
         $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']);
     }
     $this->orderShipmentNew->getFormBlock()->submit();
     return ['shipmentIds' => $this->getShipmentIds()];
 }
 /**
  * Assert that order Id is present in search results
  *
  * @param Dashboard $dashboard
  * @param GlobalSearch $search
  * @param OrderIndex $orderIndex
  * @return void
  */
 public function processAssert(Dashboard $dashboard, GlobalSearch $search, OrderIndex $orderIndex)
 {
     $order = $search->getDataFieldConfig('query')['source']->getEntity();
     $orderId = "Order #" . $order->getId();
     $isVisibleInResult = $dashboard->getAdminPanelHeader()->isSearchResultVisible($orderId);
     \PHPUnit_Framework_Assert::assertTrue($isVisibleInResult, 'Order Id ' . $order->getId() . ' is absent in search results');
     $dashboard->getAdminPanelHeader()->navigateToGrid("Orders");
     $isOrderGridVisible = $orderIndex->getSalesOrderGrid()->isVisible();
     \PHPUnit_Framework_Assert::assertTrue($isOrderGridVisible, 'Order grid is not visible');
     \PHPUnit_Framework_Assert::assertContains((string) $order->getId(), $orderIndex->getSalesOrderGrid()->getAllIds(), 'Order grid does not have ' . $order->getId() . ' in search results');
 }
 /**
  * Assert that deleted customers address is not displayed on backend during order creation
  *
  * @param OrderIndex $orderIndex
  * @param OrderCreateIndex $orderCreateIndex
  * @param Address $deletedAddress
  * @param Customer $customer
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex, OrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)
 {
     $filter = ['email' => $customer->getEmail()];
     $orderIndex->open()->getGridPageActions()->addNew();
     $orderCreateIndex->getCustomerBlock()->searchAndOpen($filter);
     $orderCreateIndex->getStoreBlock()->selectStoreView();
     $actualAddresses = $orderCreateIndex->getCreateBlock()->getBillingAddressBlock()->getExistingAddresses();
     $addressRenderer = $this->objectManager->create('Magento\\Customer\\Test\\Block\\Address\\Renderer', ['address' => $deletedAddress]);
     $addressToSearch = $addressRenderer->render();
     \PHPUnit_Framework_Assert::assertFalse(in_array($addressToSearch, $actualAddresses), 'Deleted address is present on backend during order creation');
 }
 /**
  * Assert that shipment is present in the Shipments tab with correct shipped items quantity
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param OrderInjectable $order
  * @param array $ids
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, OrderInjectable $order, array $ids)
 {
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $salesOrderView->getOrderForm()->openTab('shipments');
     $totalQty = $order->getTotalQtyOrdered();
     $totalQty = is_array($totalQty) ? $totalQty : [$totalQty];
     foreach ($ids['shipmentIds'] as $key => $shipmentId) {
         $filter = ['id' => $shipmentId, 'qty_from' => $totalQty[$key], 'qty_to' => $totalQty[$key]];
         \PHPUnit_Framework_Assert::assertTrue($salesOrderView->getOrderForm()->getTabElement('shipments')->getGridBlock()->isRowVisible($filter), 'Shipment is absent on shipments tab.');
     }
 }
 /**
  * Create credit memo from order on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     $this->salesOrderView->getPageActions()->orderCreditMemo();
     if (!empty($this->data)) {
         $this->orderCreditMemoNew->getFormBlock()->fillProductData($this->data, $this->order->getEntityId()['products']);
         $this->orderCreditMemoNew->getFormBlock()->updateQty();
         $this->orderCreditMemoNew->getFormBlock()->fillFormData($this->data);
     }
     $this->orderCreditMemoNew->getFormBlock()->submit();
     return ['creditMemoIds' => $this->getCreditMemoIds()];
 }
 /**
  * Assert that refund is present in the tab with ID and refunded amount(depending on full/partial refund).
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param OrderInjectable $order
  * @param array $ids
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, OrderInjectable $order, array $ids)
 {
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $salesOrderView->getOrderForm()->openTab('creditmemos');
     /** @var Grid $grid */
     $grid = $salesOrderView->getOrderForm()->getTab('creditmemos')->getGridBlock();
     $amount = $order->getPrice();
     foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
         $filter = ['id' => $creditMemoId, 'amount_from' => $amount[$key]['grand_creditmemo_total'], 'amount_to' => $amount[$key]['grand_creditmemo_total']];
         \PHPUnit_Framework_Assert::assertTrue($grid->isRowVisible($filter, true, false), 'Credit memo is absent on credit memos tab.');
     }
 }
 /**
  * Assert that buttons from dataset are not present on page
  *
  * @param OrderIndex $orderIndex
  * @param SalesOrderView $salesOrderView
  * @param OrderInjectable $order
  * @param string $orderButtonsUnavailable
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex, SalesOrderView $salesOrderView, OrderInjectable $order, $orderButtonsUnavailable)
 {
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $buttons = explode(',', $orderButtonsUnavailable);
     $matches = [];
     foreach ($buttons as $button) {
         if ($salesOrderView->getPageActions()->isActionButtonVisible(trim($button))) {
             $matches[] = $button;
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($matches, 'Buttons are present on order page.' . "\nLog:\n" . implode(";\n", $matches));
 }
 /**
  * @param $orderId
  * @param OrderIndex $orderIndex
  * @param SalesOrderView $salesOrderView
  * @param BraintreeSettlementReportIndex $braintreeSettlementReportIndex
  * @throws \Exception
  */
 public function processAssert($orderId, OrderIndex $orderIndex, SalesOrderView $salesOrderView, BraintreeSettlementReportIndex $braintreeSettlementReportIndex)
 {
     $this->salesOrderView = $salesOrderView;
     $this->settlementReportIndex = $braintreeSettlementReportIndex;
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $transactionId = $this->getTransactionId();
     \PHPUnit_Framework_Assert::assertNotEmpty($transactionId);
     $this->settlementReportIndex->open();
     $grid = $this->settlementReportIndex->getSettlementReportGrid();
     $grid->search(['id' => $transactionId]);
     $ids = $grid->getTransactionIds();
     \PHPUnit_Framework_Assert::assertTrue(in_array($transactionId, $ids));
 }
 /**
  * Assert that invoice is present in the invoices tab of the order with corresponding amount(Grand Total)
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param OrderInjectable $order
  * @param array $ids
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, OrderInjectable $order, array $ids)
 {
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $salesOrderView->getOrderForm()->openTab('invoices');
     /** @var Grid $grid */
     $grid = $salesOrderView->getOrderForm()->getTabElement('invoices')->getGridBlock();
     $amount = $order->getPrice();
     foreach ($ids['invoiceIds'] as $key => $invoiceId) {
         $filter = ['id' => $invoiceId, 'amount_from' => $amount[$key]['grand_invoice_total'], 'amount_to' => $amount[$key]['grand_invoice_total']];
         $grid->search($filter);
         $filter['amount_from'] = number_format($amount[$key]['grand_invoice_total'], 2);
         $filter['amount_to'] = number_format($amount[$key]['grand_invoice_total'], 2);
         \PHPUnit_Framework_Assert::assertTrue($grid->isRowVisible($filter, false, false), 'Invoice is absent on invoices tab.');
     }
 }
 /**
  * Create credit memo.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices\Grid $invoicesGrid */
     $invoicesGrid = $this->salesOrderView->getOrderForm()->getTab('invoices')->getGridBlock();
     $this->salesOrderView->getOrderForm()->openTab('invoices');
     $invoicesGrid->viewInvoice();
     $this->salesOrderView->getPageActions()->orderInvoiceCreditMemo();
     if (!empty($this->refundData)) {
         $this->orderCreditMemoNew->getFormBlock()->fillProductData($this->refundData, $this->order->getEntityId()['products']);
         $this->orderCreditMemoNew->getFormBlock()->updateQty();
     }
     $this->orderCreditMemoNew->getFormBlock()->submit();
     return ['ids' => ['creditMemoIds' => $this->getCreditMemoIds()]];
 }
 /**
  * Assert that message from dataSet is displayed on order(s) view page on backend.
  *
  * @param GiftMessage $giftMessage
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param array $products
  * @param string $orderId
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, SalesOrderView $salesOrderView, OrderIndex $orderIndex, array $products, $orderId)
 {
     $orderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     if ($giftMessage->getAllowGiftMessagesForOrder()) {
         $expectedData[] = $giftMessage->getData();
         $actualData[] = $salesOrderView->getGiftOptionsBlock()->getData($giftMessage);
     }
     if ($giftMessage->getAllowGiftOptionsForItems()) {
         foreach ($products as $key => $product) {
             $expectedData[] = $giftMessage->getItems()[$key]->getData();
             $actualData[] = $salesOrderView->getGiftItemsBlock()->getItemProduct($product)->getGiftMessageFormData($giftMessage);
         }
     }
     $errors = $this->verifyData($expectedData, $actualData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
Ejemplo n.º 20
0
 /**
  * Change created order status and unassign custom order status if order was created.
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->order->hasData('id')) {
         $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel');
         $filter = ['label' => $this->orderStatus->getLabel(), 'status' => $this->orderStatusInitial->getStatus()];
         $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter);
     }
 }
 /**
  * Assert that comment about authorized amount exist in Comments History section on order page in Admin.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $transactionDetails
  * @throws \Exception
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $transactionDetails)
 {
     $transactionId = '';
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $comment = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
     preg_match('/(ID: ")(\\w+-*\\w+)(")/', $comment, $matches);
     if (!empty($matches[2])) {
         $transactionId = $matches[2];
     }
     \PHPUnit_Framework_Assert::assertNotEmpty($transactionId);
     $orderForm = $salesOrderView->getOrderForm()->openTab('transactions');
     /** @var Grid $grid */
     $grid = $orderForm->getTab('transactions')->getGridBlock();
     $actualTxnIds = $grid->getIds();
     \PHPUnit_Framework_Assert::assertEquals($transactionDetails, $actualTxnIds[$transactionId], 'Incorrect transaction details for the order #' . $orderId);
 }
 /**
  * Change created order status and unassign custom order status if order was created.
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->order->hasData('id')) {
         $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel');
         $filter = ['label' => $this->orderStatus->getLabel(), 'status' => $this->orderStatusInitial->getStatus()];
         $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter);
         $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'checkmo_custom_new_order_status_rollback'])->run();
     }
 }
 /**
  * Assert that specified prices are actual on order, invoice and refund pages.
  *
  * @param array $prices
  * @param InjectableFixture $product
  * @param OrderIndex $orderIndex
  * @param SalesOrderView $salesOrderView
  * @param OrderInvoiceNew $orderInvoiceNew
  * @param OrderCreditMemoNew $orderCreditMemoNew
  * @return void
  */
 public function processAssert(array $prices, InjectableFixture $product, OrderIndex $orderIndex, SalesOrderView $salesOrderView, OrderInvoiceNew $orderInvoiceNew, OrderCreditMemoNew $orderCreditMemoNew)
 {
     $this->salesOrderView = $salesOrderView;
     $this->orderInvoiceNew = $orderInvoiceNew;
     $this->orderCreditMemoNew = $orderCreditMemoNew;
     $orderIndex->open();
     $orderIndex->getSalesOrderGrid()->openFirstRow();
     //Check prices on order page
     $actualPrices = [];
     $actualPrices = $this->getOrderPrices($actualPrices, $product);
     $actualPrices = $this->getOrderTotals($actualPrices);
     $prices = $this->preparePrices($prices);
     $message = 'Prices on order view page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
     $salesOrderView->getPageActions()->invoice();
     //Check prices on invoice creation page
     $actualPrices = [];
     $actualPrices = $this->getInvoiceNewPrices($actualPrices, $product);
     $actualPrices = $this->getInvoiceNewTotals($actualPrices);
     $message = 'Prices on invoice new page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
     $orderInvoiceNew->getTotalsBlock()->submit();
     //Check prices after invoice on order page
     $actualPrices = [];
     $actualPrices = $this->getOrderPrices($actualPrices, $product);
     $actualPrices = $this->getOrderTotals($actualPrices);
     $message = 'Prices on invoice page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
     $salesOrderView->getPageActions()->orderCreditMemo();
     //Check prices on credit memo creation page
     $pricesCreditMemo = $this->preparePricesCreditMemo($prices);
     $actualPrices = [];
     $actualPrices = $this->getCreditMemoNewPrices($actualPrices, $product);
     $actualPrices = $this->getCreditMemoNewTotals($actualPrices);
     $message = 'Prices on credit memo new page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($pricesCreditMemo, $actualPrices, $message);
     $orderCreditMemoNew->getFormBlock()->submit();
     //Check prices after refund on order page
     $actualPrices = [];
     $actualPrices = $this->getOrderPrices($actualPrices, $product);
     $actualPrices = $this->getOrderTotals($actualPrices);
     $message = 'Prices on credit memo page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
 }
Ejemplo n.º 24
0
 /**
  * Create invoice (with shipment optionally) for order on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     $this->salesOrderView->getPageActions()->invoice();
     if (!empty($this->data)) {
         $this->orderInvoiceNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']);
         $this->orderInvoiceNew->getFormBlock()->updateQty();
     }
     $this->orderInvoiceNew->getFormBlock()->submit();
     $invoiceIds = $this->getInvoiceIds();
     if (!empty($this->data)) {
         $shipmentIds = $this->getShipmentIds();
     }
     return ['invoiceIds' => $invoiceIds, 'shipmentIds' => isset($shipmentIds) ? $shipmentIds : null];
 }
 /**
  * Create tax report entity.
  *
  * @param OrderInjectable $order
  * @param TaxRule $taxRule
  * @param array $report
  * @param string $orderSteps
  * @return void
  */
 public function test(OrderInjectable $order, TaxRule $taxRule, array $report, $orderSteps)
 {
     // Precondition
     $taxRule->persist();
     $this->taxRule = $taxRule;
     $order->persist();
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->processOrder($orderSteps, $order);
     $this->reportStatistic->open();
     $this->reportStatistic->getGridBlock()->massaction([['report' => 'Tax']], 'Refresh Statistics for the Last Day', true);
     // Steps
     $this->salesTaxReport->open();
     $this->salesTaxReport->getFilterBlock()->viewsReport($report);
     $this->salesTaxReport->getActionBlock()->showReport();
 }
 /**
  * Sales coupon report
  *
  * @param OrderInjectable $order
  * @param array $viewsReport
  * @return void
  */
 public function test(OrderInjectable $order, array $viewsReport)
 {
     // Precondition
     $order->persist();
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->orderView->getPageActions()->invoice();
     $this->orderInvoiceNew->getTotalsBlock()->submit();
     $this->reportStatistic->open();
     $this->reportStatistic->getGridBlock()->massaction([['report' => 'Coupons']], 'Refresh Statistics for the Last Day', true);
     // Steps
     $this->salesCouponReportView->open();
     $ruleName = $order->getCouponCode()->getName();
     $viewsReport['rules_list'] = str_replace('%rule_name%', $ruleName, $viewsReport['rules_list']);
     $this->salesCouponReportView->getFilterBlock()->viewsReport($viewsReport);
     $this->salesCouponReportView->getActionBlock()->showReport();
 }
 /**
  * Assert cancel fail message is displayed on order index page
  *
  * @param OrderIndex $orderIndex
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::FAIL_CANCEL_MESSAGE, $orderIndex->getMessagesBlock()->getErrorMessage());
 }
 /**
  * Open Sales order
  *
  * @return void
  */
 public function run()
 {
     $this->orderIndex->open();
 }
 /**
  * Assert release success message is displayed on order index page
  *
  * @param OrderIndex $orderIndex
  * @param int $ordersCount
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex, $ordersCount)
 {
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_RELEASE_MESSAGE, $ordersCount), $orderIndex->getMessagesBlock()->getSuccessMessages());
 }
 /**
  * Assert that Order Grand Total is correct on order page in backend
  *
  * @param SalesOrderView $salesOrderView
  * @param string $orderId
  * @param OrderIndex $salesOrder
  * @param string $grandTotal
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, $grandTotal)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     \PHPUnit_Framework_Assert::assertEquals($grandTotal, $salesOrderView->getOrderTotalsBlock()->getGrandTotal(), 'Grand Total price does not equal to price from data set.');
 }