/** * Assert that prices on order review and customer order pages are equal to specified in dataset. * * @param array $prices * @param InjectableFixture $product * @param CheckoutCart $checkoutCart * @param CheckoutOnepage $checkoutOnepage * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param CustomerOrderView $customerOrderView * @param CmsIndex $cmsIndex * @return void */ public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView, CmsIndex $cmsIndex) { $this->checkoutOnepage = $checkoutOnepage; $this->customerOrderView = $customerOrderView; $checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); $cmsIndex->getCmsPageBlock()->waitPageInit(); $shippingMethod = ['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']; $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shippingMethod); $checkoutOnepage->getShippingMethodBlock()->clickContinue(); $checkoutOnepage->getPaymentBlock()->selectPaymentMethod(['method' => 'checkmo']); $actualPrices = []; $actualPrices = $this->getReviewPrices($actualPrices, $product); $actualPrices = $this->getReviewTotals($actualPrices); $prices = $this->preparePrices($prices); //Order review prices verification $message = 'Prices on order review should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals(array_diff_key($prices, ['cart_item_price_excl_tax' => null, 'cart_item_price_incl_tax' => null]), $actualPrices, $message); $checkoutOnepage->getPaymentBlock()->placeOrder(); $checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); $checkoutOnepageSuccess->getSuccessBlock()->openOrder(); $actualPrices = []; $actualPrices = $this->getOrderPrices($actualPrices, $product); $actualPrices = $this->getOrderTotals($actualPrices); //Frontend order prices verification $message = 'Prices on order view page should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); }
/** * Assert that prices on order review and customer order pages are equal to specified in dataset. * * @param array $prices * @param InjectableFixture $product * @param CheckoutCart $checkoutCart * @param CheckoutOnepage $checkoutOnepage * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param CustomerOrderView $customerOrderView * @return void */ public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView) { $this->checkoutOnepage = $checkoutOnepage; $this->customerOrderView = $customerOrderView; $checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); $checkoutOnepage->getBillingBlock()->clickContinue(); $checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod(['method' => 'check_money_order']); $checkoutOnepage->getPaymentMethodsBlock()->clickContinue(); $actualPrices = []; $actualPrices = $this->getReviewPrices($actualPrices, $product); $actualPrices = $this->getReviewTotals($actualPrices); $prices = $this->preparePrices($prices); //Order review prices verification $message = 'Prices on order review should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); $checkoutOnepage->getReviewBlock()->placeOrder(); $checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); $checkoutOnepageSuccess->getSuccessBlock()->openOrder(); $actualPrices = []; $actualPrices = $this->getOrderPrices($actualPrices, $product); $actualPrices = $this->getOrderTotals($actualPrices); //Frontend order prices verification $message = 'Prices on order view page should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); }
/** * Place order after checking order totals on review step. * * @return array */ public function run() { if (!empty($this->prices)) { $this->assertOrderTotalOnReviewPage->processAssert($this->checkoutOnepage, $this->prices); } $this->checkoutOnepage->getReviewBlock()->placeOrder(); return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()]; }
/** * Place order after checking order totals on review step. * * @return array */ public function run() { if (isset($this->prices['grandTotal'])) { $this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']); } $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()]; }
/** * Place order after checking order totals on review step. * * @return array */ public function run() { if (isset($this->prices['grandTotal'])) { $this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']); } $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['entity_id' => ['products' => $this->products]]]); return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), 'order' => $order]; }
/** * Review order contents and place order. * * @return array */ public function run() { $this->orderReviewExpress->getReviewBlock()->selectShippingMethod($this->shipping); foreach ($this->prices as $priceName => $value) { $assertName = 'Assert' . ucfirst($priceName) . 'OrderReview'; $assert = $this->objectManager->create('Magento\\Checkout\\Test\\Constraint\\' . $assertName); $assert->processAssert($this->checkoutOnepage, $value); } $this->orderReviewExpress->getReviewBlock()->placeOrder(); return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()]; }
/** * Review order contents and place order. * * @return array */ public function run() { $this->orderReviewExpress->getReviewBlock()->selectShippingMethod($this->shipping); foreach ($this->prices as $priceName => $value) { $assertName = 'Assert' . ucfirst($priceName) . 'OrderReview'; $assert = $this->objectManager->create('Magento\\Checkout\\Test\\Constraint\\' . $assertName); $assert->processAssert($this->checkoutOnepage, $value); } $this->orderReviewExpress->getReviewBlock()->placeOrder(); $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['entity_id' => ['products' => $this->products]]]); return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), 'order' => $order]; }
/** * Get success placed order id. * * @return array */ public function run() { return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()]; }