コード例 #1
0
 /**
  * Select shipping method
  *
  * @return void
  */
 public function run()
 {
     if ($this->shipping['shipping_service'] !== '-') {
         $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping);
         $this->checkoutOnepage->getShippingMethodBlock()->clickContinue();
     }
 }
コード例 #2
0
 /**
  * Run step that selecting payment method
  *
  * @return void
  */
 public function run()
 {
     if ($this->payment['method'] !== 'free') {
         $this->checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod($this->payment, $this->creditCard);
     }
     $this->checkoutOnepage->getPaymentMethodsBlock()->clickContinue();
 }
 /**
  * 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);
 }
コード例 #4
0
 /**
  * Select shipping method
  *
  * @return void
  */
 public function run()
 {
     if (!empty($this->shipping)) {
         $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping);
         $this->checkoutOnepage->getShippingMethodBlock()->clickContinue();
     }
 }
コード例 #5
0
ファイル: PlaceOrderStep.php プロジェクト: opexsw/magento2
 /**
  * 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()];
 }
コード例 #6
0
 /**
  * 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()];
 }
コード例 #7
0
 /**
  * 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];
 }
コード例 #8
0
 /**
  * Fill billing address.
  *
  * @return void
  */
 public function run()
 {
     if ($this->billingCheckboxState) {
         $this->assertBillingAddressCheckbox->processAssert($this->checkoutOnepage, $this->billingCheckboxState);
     }
     if ($this->billingAddress) {
         $selectedPaymentMethod = $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock();
         $selectedPaymentMethod->getBillingBlock()->fillBilling($this->billingAddress);
     }
 }
 /**
  * Assert that Catalog Price Rule is applied & it impacts on product's discount price on OnePage Checkout page.
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param Customer $customer
  * @param array $products
  * @param array $cartPrice
  * @param array $shipping
  * @param array $payment
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, Customer $customer, array $products, array $cartPrice, array $shipping, array $payment)
 {
     $this->objectManager->create('\\Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', ['products' => $products])->run();
     $this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\ProceedToCheckoutStep')->run();
     $this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\FillBillingInformationStep', ['customer' => $customer, 'checkoutMethod' => 'register'])->run();
     $this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\FillShippingMethodStep', ['shipping' => $shipping])->run();
     $this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\SelectPaymentMethodStep', ['payment' => $payment])->run();
     $actualPrices['grand_total'] = $checkoutOnepage->getReviewBlock()->getGrandTotal();
     $actualPrices['sub_total'] = $checkoutOnepage->getReviewBlock()->getSubtotal();
     $expectedPrices['grand_total'] = $cartPrice['grand_total'] + $cartPrice['shipping_price'];
     $expectedPrices['sub_total'] = $cartPrice['sub_total'];
     \PHPUnit_Framework_Assert::assertEquals($expectedPrices, $actualPrices, 'Wrong total cart prices are displayed.');
 }
コード例 #10
0
 /**
  * Verify Terms and Conditions checkbox is absent on checkout page.
  *
  * @param ObjectManager $objectManager
  * @param $products
  * @param CheckoutOnepage $checkoutOnepage
  * @param $shipping
  * @param $payment
  * @param CheckoutAgreement $agreement
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(ObjectManager $objectManager, $products, CheckoutOnepage $checkoutOnepage, $shipping, $payment, CheckoutAgreement $agreement)
 {
     $shippingAddressData = ['shippingAddress' => ['dataSet' => 'US_address_1']];
     $productsData = ['products' => $products];
     $shippingMethodData = ['shipping' => $shipping];
     $paymentData = ['payment' => $payment];
     $products = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', $productsData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $products)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\ProceedToCheckoutStep')->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingAddressStep', $shippingAddressData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingMethodStep', $shippingMethodData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\SelectPaymentMethodStep', $paymentData)->run();
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getAgreementReview()->checkAgreement($agreement), 'Checkout Agreement \'' . $agreement->getName() . '\' is present in the Place order step.');
 }
コード例 #11
0
 /**
  * Run step that selecting checkout method.
  *
  * @return void
  * @throws \Exception
  */
 public function run()
 {
     $checkoutMethodBlock = $this->checkoutOnepage->getLoginBlock();
     switch ($this->checkoutMethod) {
         case 'guest':
             $checkoutMethodBlock->clickContinue();
             break;
         case 'login':
             $checkoutMethodBlock->loginCustomer($this->customer);
             break;
         default:
             throw new \Exception("Undefined checkout method.");
             break;
     }
 }
 /**
  * Get review product prices.
  *
  * @param InjectableFixture $product
  * @param $actualPrices
  * @return array
  */
 public function getReviewPrices($actualPrices, InjectableFixture $product)
 {
     $reviewBlock = $this->checkoutOnepage->getReviewBlock();
     $actualPrices['cart_item_price_excl_tax'] = $reviewBlock->getItemPriceExclTax($product->getName());
     $actualPrices['cart_item_price_incl_tax'] = $reviewBlock->getItemPriceInclTax($product->getName());
     $actualPrices['cart_item_subtotal_excl_tax'] = $reviewBlock->getItemSubExclTax($product->getName());
     $actualPrices['cart_item_subtotal_incl_tax'] = $reviewBlock->getItemSubInclTax($product->getName());
     return $actualPrices;
 }
コード例 #13
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 ObjectManager $objectManager
  * @param string $products
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutOnepageSuccess $checkoutOnepageSuccess
  * @param AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage
  * @param array $shipping
  * @param array $payment
  * @param CheckoutAgreement $agreement
  * @return void
  */
 public function processAssert(ObjectManager $objectManager, $products, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage, $shipping, $payment, CheckoutAgreement $agreement)
 {
     $paymentBlock = $checkoutOnepage->getPaymentBlock();
     $shippingAddressData = ['shippingAddress' => ['dataSet' => 'US_address_1']];
     $productsData = ['products' => $products];
     $shippingMethodData = ['shipping' => $shipping];
     $paymentData = ['payment' => $payment];
     $products = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', $productsData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $products)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\ProceedToCheckoutStep')->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingAddressStep', $shippingAddressData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingMethodStep', $shippingMethodData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\SelectPaymentMethodStep', $paymentData)->run();
     $paymentBlock->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', $agreement);
     $paymentBlock->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     $assertOrderSuccessPlacedMessage->processAssert($checkoutOnepageSuccess);
 }
コード例 #14
0
 /**
  * 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()->guestCheckout();
     $checkoutOnepage->getLoginBlock()->clickContinue();
     $checkoutOnepage->getBillingBlock()->fill($billingAddress);
     $checkoutOnepage->getBillingBlock()->clickContinue();
     $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shipping);
     $checkoutOnepage->getShippingMethodBlock()->clickContinue();
     $checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod($payment);
     $checkoutOnepage->getPaymentMethodsBlock()->clickContinue();
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getAgreementReview()->checkAgreement($agreement), 'Checkout Agreement \'' . $agreement->getName() . '\' is present in the Place order step.');
 }
 /**
  * Assert that credit card is not present on checkout.
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param $deletedCreditCard
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $deletedCreditCard)
 {
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getVaultPaymentBlock()->isSavedCreditCardPresent($deletedCreditCard), 'Credit card is present on checkout.');
 }
コード例 #16
0
 /**
  * Add gift message to order
  *
  * @return void
  */
 public function run()
 {
     $this->checkoutOnepage->getGiftMessagesBlock()->fillGiftMessage($this->giftMessage, $this->products);
 }
 /**
  * Assert that "Same as Shipping" checkbox of Billing Address selection block is in correct state.
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param string $billingCheckboxState
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $billingCheckboxState)
 {
     $actualResult = $checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->getBillingBlock()->getSameAsShippingCheckboxValue();
     \PHPUnit_Framework_Assert::assertEquals($billingCheckboxState, $actualResult, '"Same as Shipping" checkbox has wrong value');
 }
コード例 #18
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->getPaymentMethodsBlock()->selectPaymentMethod($payment);
     $checkoutOnepage->getPaymentMethodsBlock()->clickContinue();
     $checkoutOnepage->getAgreementReview()->placeOrder();
     \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);
 }
コード例 #19
0
 /**
  * Run step that selecting checkout method.
  *
  * @return void
  */
 public function run()
 {
     if ($this->checkoutMethod === 'login') {
         $this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer);
     }
 }
コード例 #20
0
 /**
  * Click Continue to PayPal button.
  *
  * @return array
  */
 public function run()
 {
     $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
 }
コード例 #21
0
 /**
  * Click Continue to PayPal button.
  *
  * @return array
  */
 public function run()
 {
     $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->inContextPaypalCheckout();
 }
コード例 #22
0
 /**
  * Assert that Order Grand Total is correct on checkoutOnePage
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param string $grandTotal
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal)
 {
     $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal();
     \PHPUnit_Framework_Assert::assertEquals($checkoutReviewGrandTotal, number_format($grandTotal, 2), "Grand Total price: {$checkoutReviewGrandTotal} not equals with price from data set: " . $grandTotal);
 }
コード例 #23
0
 /**
  * Fill shipping address.
  *
  * @return void
  */
 public function run()
 {
     if ($this->shippingAddress) {
         $this->checkoutOnepage->getShippingBlock()->fill($this->shippingAddress);
     }
 }
コード例 #24
0
 /**
  * Assert that Order Subtotal is correct on Review page.
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param string $subTotal
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $subTotal)
 {
     $reviewSubTotal = $checkoutOnepage->getReviewBlock()->getSubtotal();
     \PHPUnit_Framework_Assert::assertEquals($reviewSubTotal, number_format($subTotal, 2), 'Subtotal price: \'' . $reviewSubTotal . '\' not equals with price from data set: \'' . $reviewSubTotal . '\'');
 }
コード例 #25
0
 /**
  * Fill billing address
  *
  * @return void
  */
 public function run()
 {
     $this->checkoutOnepage->getBillingBlock()->fillBilling($this->billingAddress);
     $this->checkoutOnepage->getBillingBlock()->clickContinue();
 }
コード例 #26
0
 /**
  * Run step that saves credit card.
  *
  * @return void
  */
 public function run()
 {
     $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->saveCreditCard($this->payment['method'], $this->creditCardSave);
 }
コード例 #27
0
 /**
  * Fill billing address
  *
  * @return void
  */
 public function run()
 {
     $customer = $this->checkoutMethod === 'register' ? $this->customer : null;
     $this->checkoutOnepage->getBillingBlock()->fillBilling($this->billingAddress, $customer);
     $this->checkoutOnepage->getBillingBlock()->clickContinue();
 }
コード例 #28
0
 /**
  * Assert that total tax price is correct on Review page.
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param string $taxTotal
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $taxTotal)
 {
     $reviewTaxTotal = $checkoutOnepage->getReviewBlock()->getTax();
     \PHPUnit_Framework_Assert::assertEquals($reviewTaxTotal, number_format($taxTotal, 2), "Tax price '{$reviewTaxTotal}' not equals with price from data set '{$taxTotal}'.");
 }
コード例 #29
0
 /**
  * Assert that Order Grand Total is correct on checkoutOnePage
  *
  * @param CheckoutOnepage $checkoutOnepage
  * @param string $grandTotal
  * @return void
  */
 public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal)
 {
     $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal();
     \PHPUnit_Framework_Assert::assertEquals($checkoutReviewGrandTotal, $grandTotal, 'Grand Total price: \'' . $checkoutReviewGrandTotal . '\' not equals with price from data set: \'' . $grandTotal . '\'');
 }
コード例 #30
0
 /**
  * Run step that selects saved credit card.
  *
  * @return void
  */
 public function run()
 {
     $this->payment['method'] .= '_item_';
     $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment);
 }