/**
  * Search order products report.
  *
  * @param OrderInjectable $order
  * @param array $customersReport
  * @return void
  */
 public function test(OrderInjectable $order, array $customersReport)
 {
     // Preconditions
     $order->persist();
     // Steps
     $this->orderedProducts->open();
     $this->orderedProducts->getGridBlock()->searchAccounts($customersReport);
 }
 /**
  * Order downloadable product.
  *
  * @param OrderInjectable $order
  * @param string $downloads
  * @return void
  */
 public function test(OrderInjectable $order, $downloads)
 {
     // Preconditions
     $order->persist();
     $invoice = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order]);
     $invoice->run();
     $this->openDownloadableLink($order, (int) $downloads);
 }
 /**
  * Create shipment.
  *
  * @param OrderInjectable $order
  * @param array $data
  * @return array
  */
 public function test(OrderInjectable $order, array $data)
 {
     // Preconditions
     $order->persist();
     // Steps
     $createShipping = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateShipmentStep', ['order' => $order, 'data' => $data]);
     return ['ids' => $createShipping->run()];
 }
 /**
  * Create invoice.
  *
  * @param OrderInjectable $order
  * @param array $data
  * @return array
  */
 public function test(OrderInjectable $order, array $data)
 {
     // Preconditions
     $order->persist();
     // Steps
     $result = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order, 'data' => $data])->run();
     return $result;
 }
 /**
  * Create invoice.
  *
  * @param OrderInjectable $order
  * @param array $data
  * @return array
  */
 public function test(OrderInjectable $order, array $data)
 {
     // Preconditions
     $order->persist();
     // Steps
     $result = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order, 'data' => $data])->run();
     return ['ids' => ['invoiceIds' => $result['invoiceIds'], 'shipmentIds' => isset($result['shipmentIds']) ? $result['shipmentIds'] : null]];
 }
 /**
  * Create credit memo.
  *
  * @param OrderInjectable $order
  * @param array $data
  * @return array
  */
 public function test(OrderInjectable $order, array $data)
 {
     // Preconditions
     $order->persist();
     $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order])->run();
     // Steps
     $createCreditMemoStep = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateCreditMemoStep', ['order' => $order, 'data' => $data]);
     $result = $createCreditMemoStep->run();
     return ['ids' => ['creditMemoIds' => $result['creditMemoIds']], 'product' => $this->getProduct($order, $data), 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer()];
 }
 /**
  * Bestseller Products Report.
  *
  * @param OrderInjectable $order
  * @param array $bestsellerReport
  * @return void
  */
 public function test(OrderInjectable $order, array $bestsellerReport)
 {
     // Preconditions
     $order->persist();
     $this->bestsellers->open();
     $this->bestsellers->getMessagesBlock()->clickLinkInMessages('notice', 'here');
     // Steps
     $this->bestsellers->getFilterBlock()->viewsReport($bestsellerReport);
     $this->bestsellers->getActionsBlock()->showReport();
 }
 /**
  * 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()];
 }
 /**
  * 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];
 }
 /**
  * Move last ordered products on order page.
  *
  * @param OrderInjectable $order
  * @return array
  */
 public function test(OrderInjectable $order)
 {
     // Preconditions:
     $order->persist();
     $customer = $order->getDataFieldConfig('customer_id')['source']->getCustomer();
     // Steps:
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $this->customerIndexEdit->getPageActionsBlock()->createOrder();
     $this->orderCreateIndex->getStoreBlock()->selectStoreView();
     $products = $order->getEntityId()['products'];
     $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock();
     $activitiesBlock->getLastOrderedItemsBlock()->addProductsToOrder($products);
     $activitiesBlock->updateChanges();
     return ['products' => $products];
 }
 /**
  * Automatic Apply Tax Based on VAT ID.
  *
  * @param ConfigData $vatConfig
  * @param OrderInjectable $order
  * @param TaxRule $taxRule
  * @param Cart $cart
  * @param string $configData
  * @param string $customerGroup
  * @return array
  */
 public function test(ConfigData $vatConfig, OrderInjectable $order, TaxRule $taxRule, Cart $cart, $configData, $customerGroup)
 {
     // Preconditions
     $this->configData = $configData;
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run();
     $taxRule->persist();
     // Prepare data
     $this->customer = $order->getDataFieldConfig('customer_id')['source']->getCustomer();
     $address = $this->customer->getDataFieldConfig('address')['source']->getAddresses()[0];
     $this->prepareVatConfig($vatConfig, $customerGroup);
     $poducts = $order->getEntityId()['products'];
     $cart = $this->fixtureFactory->createByCode('cart', ['data' => array_merge($cart->getData(), ['items' => ['products' => $poducts]])]);
     // Steps
     $order->persist();
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run();
     $this->objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $order->getEntityId())->run();
     $this->checkoutCart->open();
     $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
     $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
     $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
     return ['customer' => $this->customer, 'address' => $address, 'orderId' => $order->getId(), 'cart' => $cart, 'products' => $poducts];
 }
 /**
  * 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->salesOrderView->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();
     if (isset($viewsReport['rules_list'])) {
         $viewsReport['rules_list'] = str_replace('%rule_name%', $ruleName, $viewsReport['rules_list']);
     }
     $this->salesCouponReportView->getFilterBlock()->viewsReport($viewsReport);
     $this->salesCouponReportView->getActionBlock()->showReport();
 }
 /**
  * Run Update Custom OrderStatus Test.
  *
  * @param OrderStatus $orderStatusInitial
  * @param OrderStatus $orderStatus
  * @param OrderInjectable $order
  * @param FixtureFactory $fixtureFactory
  * @param string $orderExist
  * @return array
  */
 public function test(OrderStatus $orderStatusInitial, OrderStatus $orderStatus, OrderInjectable $order, FixtureFactory $fixtureFactory, $orderExist)
 {
     // Preconditions:
     $orderStatusInitial->persist();
     if ($orderExist == 'Yes') {
         $config = $fixtureFactory->createByCode('configData', ['dataset' => 'checkmo_custom_new_order_status', 'data' => ['payment/checkmo/order_status' => ['value' => $orderStatusInitial->getStatus()]]]);
         $config->persist();
         $order->persist();
     }
     // Steps:
     $this->orderStatusIndex->open();
     $this->orderStatusIndex->getOrderStatusGrid()->searchAndOpen(['label' => $orderStatusInitial->getLabel()]);
     $this->orderStatusEdit->getOrderStatusForm()->fill($orderStatus);
     $this->orderStatusEdit->getFormPageActions()->save();
     // Configuring orderStatus for asserts.
     $orderStatus = $fixtureFactory->createByCode('orderStatus', ['data' => array_merge($orderStatusInitial->getData(), $orderStatus->getData())]);
     // Prepare data for tear down
     $this->orderStatus = $orderStatus;
     $this->orderStatusInitial = $orderStatusInitial;
     $this->order = $order;
     return ['orderStatus' => $orderStatus, 'status' => $orderStatus->getLabel(), 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer()];
 }
 /**
  * Run Assign Custom OrderStatus.
  *
  * @param OrderStatus $orderStatus
  * @param OrderInjectable $order
  * @param array $orderStatusState
  * @param AssertOrderStatusSuccessAssignMessage $assertion
  * @return array
  */
 public function test(OrderStatus $orderStatus, OrderInjectable $order, array $orderStatusState, AssertOrderStatusSuccessAssignMessage $assertion)
 {
     // Preconditions:
     $orderStatus->persist();
     /** @var OrderStatus $orderStatus */
     $orderStatus = $this->fixtureFactory->createByCode('orderStatus', ['data' => array_merge($orderStatus->getData(), $orderStatusState)]);
     $this->orderStatus = $orderStatus;
     // Steps:
     $this->orderStatusIndex->open();
     $this->orderStatusIndex->getGridPageActions()->assignStatusToState();
     $this->orderStatusAssign->getAssignForm()->fill($orderStatus);
     $this->orderStatusAssign->getPageActionsBlock()->save();
     $assertion->processAssert($this->orderStatusIndex);
     $order->persist();
     $this->order = $order;
     return ['orderId' => $order->getId(), 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), 'status' => $orderStatus->getLabel()];
 }
 /**
  * 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();
 }
Exemplo n.º 16
0
 /**
  * Create order.
  *
  * @return array
  */
 public function run()
 {
     $this->order->persist();
     return ['products' => $this->order->getEntityId()['products'], 'order' => $this->order];
 }