/** * Assert that message from dataSet is displayed for each items on order(s) view page on frontend * * @param GiftMessage $giftMessage * @param Customer $customer * @param OrderHistory $orderHistory * @param CustomerOrderView $customerOrderView * @param CustomerAccountLogout $customerAccountLogout * @param string $orderId * @param array $products * @return void */ public function processAssert(GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, CustomerOrderView $customerOrderView, CustomerAccountLogout $customerAccountLogout, $orderId, $products = []) { $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $expectedData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()]; $orderHistory->open(); $orderHistory->getOrderHistoryBlock()->openOrderById($orderId); foreach ($products as $key => $product) { if ($giftMessage->hasData('items')) { $itemGiftMessage = $giftMessage->getItems()[$key]; $expectedData = ['sender' => $itemGiftMessage->getSender(), 'recipient' => $itemGiftMessage->getRecipient(), 'message' => $itemGiftMessage->getMessage()]; } \PHPUnit_Framework_Assert::assertEquals($expectedData, $customerOrderView->getGiftMessageForItemBlock()->getGiftMessage($product->getName()), 'Wrong gift message is displayed on "' . $product->getName() . '" item.'); } $customerAccountLogout->open(); }
/** * Assert that message from dataset is displayed on order(s) view page on frontend. * * @param GiftMessage $giftMessage * @param Customer $customer * @param OrderHistory $orderHistory * @param CustomerOrderView $customerOrderView * @param CustomerAccountLogout $customerAccountLogout * @param string $orderId * @return void */ public function processAssert(GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, CustomerOrderView $customerOrderView, CustomerAccountLogout $customerAccountLogout, $orderId) { $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $expectedData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()]; $orderHistory->open(); $orderHistory->getOrderHistoryBlock()->openOrderById($orderId); \PHPUnit_Framework_Assert::assertEquals($expectedData, $customerOrderView->getGiftMessageForOrderBlock()->getGiftMessage(), 'Wrong gift message is displayed on order.'); $customerAccountLogout->open(); }
/** * Assert that invoiced Grand Total amount is equal to placed order Grand total amount on invoice page (frontend) * * @param OrderHistory $orderHistory * @param OrderInjectable $order * @param CustomerOrderView $customerOrderView * @param InvoiceView $invoiceView * @param array $ids * @return void */ public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, InvoiceView $invoiceView, array $ids) { $this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer()); $orderHistory->getOrderHistoryBlock()->openOrderById($order->getId()); $customerOrderView->getOrderViewBlock()->openLinkByName('Invoices'); foreach ($ids['invoiceIds'] as $key => $invoiceId) { \PHPUnit_Framework_Assert::assertEquals(number_format($order->getPrice()[$key]['grand_invoice_total'], 2), $invoiceView->getInvoiceBlock()->getItemBlock($invoiceId)->getGrandTotal()); } }
/** * Assert that shipped items quantity in 'Total Quantity' is equal to data from fixture on My Account page * * @param OrderHistory $orderHistory * @param OrderInjectable $order * @param CustomerOrderView $customerOrderView * @param ShipmentView $shipmentView * @param array $ids * @return void */ public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, ShipmentView $shipmentView, array $ids) { $totalQty = $order->getTotalQtyOrdered(); $this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer()); $orderHistory->getOrderHistoryBlock()->openOrderById($order->getId()); $customerOrderView->getOrderViewBlock()->openLinkByName('Order Shipments'); foreach ($ids['shipmentIds'] as $key => $shipmentIds) { \PHPUnit_Framework_Assert::assertEquals($totalQty[$key], $shipmentView->getShipmentBlock()->getItemShipmentBlock($shipmentIds)->getTotalQty()); } }
/** * Get order product prices. * * @param InjectableFixture $product * @param $actualPrices * @return array */ public function getOrderPrices($actualPrices, InjectableFixture $product) { $viewBlock = $this->customerOrderView->getOrderViewBlock(); $actualPrices['cart_item_price_excl_tax'] = $viewBlock->getItemPriceExclTax($product->getName()); $actualPrices['cart_item_price_incl_tax'] = $viewBlock->getItemPriceInclTax($product->getName()); $actualPrices['cart_item_subtotal_excl_tax'] = $viewBlock->getItemSubExclTax($product->getName()); $actualPrices['cart_item_subtotal_incl_tax'] = $viewBlock->getItemSubInclTax($product->getName()); return $actualPrices; }