/**
  * 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);
 }
Esempio n. 2
0
 /**
  * Select shipping method
  *
  * @return void
  */
 public function run()
 {
     if ($this->shipping['shipping_service'] !== '-') {
         $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping);
         $this->checkoutOnepage->getShippingMethodBlock()->clickContinue();
     }
 }
 /**
  * Select shipping method
  *
  * @return void
  */
 public function run()
 {
     if (!empty($this->shipping)) {
         $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping);
         $this->checkoutOnepage->getShippingMethodBlock()->clickContinue();
     }
 }
 /**
  * Place order and verify there is no checkbox Terms and Conditions.
  *
  * @param FixtureFactory $fixtureFactory
  * @param ObjectManager $objectManager
  * @param string $product
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutAgreement $agreement
  * @param array $shipping
  * @param array $payment
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(FixtureFactory $fixtureFactory, ObjectManager $objectManager, $product, BrowserInterface $browser, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutAgreement $agreement, $shipping, $payment)
 {
     $createProductsStep = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => $product]);
     $product = $createProductsStep->run();
     $billingAddress = $fixtureFactory->createByCode('address', ['dataset' => 'default']);
     $browser->open($_ENV['app_frontend_url'] . $product['products'][0]->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCartButton();
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->getOnepageLinkBlock()->proceedToCheckout();
     $checkoutOnepage->getLoginBlock()->clickContinue();
     $checkoutOnepage->getBillingBlock()->fill($billingAddress);
     $checkoutOnepage->getBillingBlock()->clickContinue();
     $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shipping);
     $checkoutOnepage->getShippingMethodBlock()->clickContinue();
     $checkoutOnepage->getPaymentBlock()->selectPaymentMethod($payment);
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getAgreementReview()->checkAgreement($agreement), 'Checkout Agreement \'' . $agreement->getName() . '\' is present in the Place order step.');
 }
Esempio n. 5
0
 /**
  * Check that checkbox is present on the last checkout step - Order Review.
  * Check that after Place order without click on checkbox "Terms and Conditions" order was not successfully placed.
  * Check that after clicking on "Terms and Conditions" checkbox and "Place Order" button success place order message
  * appears.
  *
  * @param FixtureFactory $fixtureFactory
  * @param ObjectManager $objectManager
  * @param string $product
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutOnepageSuccess $checkoutOnepageSuccess
  * @param AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage
  * @param array $shipping
  * @param array $payment
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(FixtureFactory $fixtureFactory, ObjectManager $objectManager, $product, BrowserInterface $browser, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage, $shipping, $payment)
 {
     $createProductsStep = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => $product]);
     $product = $createProductsStep->run();
     $billingAddress = $fixtureFactory->createByCode('address', ['dataset' => 'default']);
     $browser->open($_ENV['app_frontend_url'] . $product['products'][0]->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCartButton();
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->getOnepageLinkBlock()->proceedToCheckout();
     $checkoutOnepage->getLoginBlock()->clickContinue();
     $checkoutOnepage->getBillingBlock()->fill($billingAddress);
     $checkoutOnepage->getBillingBlock()->clickContinue();
     $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shipping);
     $checkoutOnepage->getShippingMethodBlock()->clickContinue();
     $checkoutOnepage->getPaymentBlock()->selectPaymentMethod($payment);
     $checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     \PHPUnit_Framework_Assert::assertEquals(self::NOTIFICATION_MESSAGE, $checkoutOnepage->getAgreementReview()->getNotificationMassage(), 'Notification required message of Terms and Conditions is absent.');
     $checkoutOnepage->getAgreementReview()->setAgreement('Yes');
     $checkoutOnepage->getAgreementReview()->placeOrder();
     $assertOrderSuccessPlacedMessage->processAssert($checkoutOnepageSuccess);
 }