/**
  * Fill Shipping Data.
  *
  * @return array
  */
 public function run()
 {
     if ($this->shipping['shipping_service'] !== null) {
         $this->orderCreateIndex->getCreateBlock()->selectShippingMethod($this->shipping);
     }
     return ['shipping' => $this->shipping];
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     $block = $this->orderCreatePage->getCreateBlock();
     $this->payment['method'] .= '_cc_vault';
     $block->selectPaymentMethod($this->payment);
     $block->selectVaultToken('token_switcher_' . $this->payment['method']);
 }
 /**
  * Assert product was added to Items Ordered grid in customer account on Order creation page backend
  *
  * @param OrderCreateIndex $orderCreateIndex
  * @param array $products
  * @throws \Exception
  * @return void
  */
 public function processAssert(OrderCreateIndex $orderCreateIndex, array $products)
 {
     if (empty($products)) {
         throw new \Exception("No products");
     }
     $data = $this->prepareData($products, $orderCreateIndex->getCreateBlock()->getItemsBlock());
     \PHPUnit_Framework_Assert::assertEquals($data['fixtureData'], $data['pageData'], 'Grouped product data on order create page not equals to passed from fixture.');
 }
 /**
  * Fill Sales Data.
  *
  * @return array
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->submitOrder();
     $this->salesOrderView->getMessagesBlock()->waitSuccessMessage();
     $orderId = trim($this->salesOrderView->getTitleBlock()->getTitle(), '#');
     $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['id' => $orderId, 'customer_id' => ['customer' => $this->customer], 'entity_id' => ['products' => $this->products], 'billing_address_id' => ['billingAddress' => $this->billingAddress]]]);
     return ['orderId' => $orderId, 'order' => $order];
 }
 /**
  * Add gift message to backend order.
  *
  * @return array
  */
 public function run()
 {
     if ($this->giftMessage->getAllowGiftMessagesForOrder()) {
         $this->orderCreateIndex->getGiftMessageForOrderBlock()->fill($this->giftMessage);
     }
     if ($this->giftMessage->getAllowGiftOptionsForItems()) {
         $this->orderCreateIndex->getCreateGiftMessageBlock()->fillGiftMessageForItems($this->products, $this->giftMessage);
     }
     return ['giftMessage' => $this->giftMessage];
 }
 /**
  * Assert that deleted customers address is not displayed on backend during order creation
  *
  * @param OrderIndex $orderIndex
  * @param OrderCreateIndex $orderCreateIndex
  * @param Address $deletedAddress
  * @param Customer $customer
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex, OrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)
 {
     $filter = ['email' => $customer->getEmail()];
     $orderIndex->open()->getGridPageActions()->addNew();
     $orderCreateIndex->getCustomerBlock()->searchAndOpen($filter);
     $orderCreateIndex->getStoreBlock()->selectStoreView();
     $actualAddresses = $orderCreateIndex->getCreateBlock()->getBillingAddressBlock()->getExistingAddresses();
     $addressRenderer = $this->objectManager->create('Magento\\Customer\\Test\\Block\\Address\\Renderer', ['address' => $deletedAddress]);
     $addressToSearch = $addressRenderer->render();
     \PHPUnit_Framework_Assert::assertFalse(in_array($addressToSearch, $actualAddresses), 'Deleted address is present on backend during order creation');
 }
 /**
  * Add product to sales
  *
  * @return void
  */
 public function run()
 {
     $createBlock = $this->orderCreateIndex->getCreateBlock();
     $createBlock->getItemsBlock()->clickAddProducts();
     foreach ($this->products as $product) {
         $createBlock->getGridBlock()->searchAndSelect(['sku' => $product->getSku()]);
         $createBlock->getTemplateBlock()->waitLoader();
         if ($this->orderCreateIndex->getConfigureProductBlock()->isVisible()) {
             $this->orderCreateIndex->getConfigureProductBlock()->configProduct($product);
         }
     }
     $createBlock->addSelectedProductsToOrder();
     $createBlock->getTemplateBlock()->waitLoader();
 }
 /**
  * Add gift message to backend order.
  *
  * @return array
  */
 public function run()
 {
     if ($this->giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $giftMessageForOrderBlock = $this->orderCreateIndex->getGiftMessageForOrderBlock();
         $giftMessageForOrderBlock->fill($this->giftMessage);
         $giftMessageForOrderBlock->waitForElementNotVisible('.loading-mask');
     }
     if ($this->giftMessage->getAllowGiftOptionsForItems() === 'Yes') {
         $giftMessageBlock = $this->orderCreateIndex->getCreateGiftMessageBlock();
         $giftMessageBlock->fillGiftMessageForItems($this->products, $this->giftMessage);
         $giftMessageBlock->waitForElementNotVisible('.loading-mask');
     }
     return ['giftMessage' => $this->giftMessage];
 }
 /**
  * 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];
 }
 /**
  * Create order from customer page (cartActions).
  *
  * @param Customer $customer
  * @param string $product
  * @return array
  */
 public function test(Customer $customer, $product)
 {
     //Preconditions
     // Create product
     $product = $this->objectManager->create('\\Magento\\Catalog\\Test\\TestStep\\CreateProductStep', ['product' => $product])->run()['product'];
     // Login under customer
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->catalogProductView->getViewBlock()->addToCart($product);
     //Steps
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $this->customerIndexEdit->getPageActionsBlock()->createOrder();
     $this->orderCreateIndex->getStoreBlock()->selectStoreView();
     $this->orderCreateIndex->getCustomerActivitiesBlock()->getShoppingCartItemsBlock()->addProductsToOrder([$product]);
     $this->orderCreateIndex->getCustomerActivitiesBlock()->updateChanges();
     return ['products' => [$product]];
 }
 /**
  * Move compare products on order page.
  *
  * @param Customer $customer
  * @param string $products
  * @return array
  */
 public function test(Customer $customer, $products)
 {
     // Preconditions
     // Create products
     $products = $this->objectManager->create('\\Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => $products])->run()['products'];
     // Add products to compare
     foreach ($products as $itemProduct) {
         $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->clickAddToCompare();
     }
     // Steps
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $this->customerIndexEdit->getPageActionsBlock()->createOrder();
     $this->orderCreateIndex->getStoreBlock()->selectStoreView();
     $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock();
     $activitiesBlock->getProductsInComparisonBlock()->addProductsToOrder($products);
     $activitiesBlock->updateChanges();
     return ['products' => $products, 'productsIsConfigured' => false];
 }
 /**
  * Move recently compared products on order page.
  *
  * @param Customer $customer
  * @param string $products
  * @return array
  */
 public function test(Customer $customer, $products)
 {
     // Preconditions
     // Create product
     $products = $this->objectManager->create('\\Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => $products])->run()['products'];
     // Login under customer
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     foreach ($products as $itemProduct) {
         $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->clickAddToCompare();
     }
     $this->cmsIndex->getLinksBlock()->openLink("Compare Products");
     $this->catalogProductCompare->getCompareProductsBlock()->removeAllProducts();
     // Steps:
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $this->customerIndexEdit->getPageActionsBlock()->createOrder();
     $this->orderCreateIndex->getStoreBlock()->selectStoreView();
     $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock();
     $activitiesBlock->getRecentlyComparedProductsBlock()->addProductsToOrder($products);
     $activitiesBlock->updateChanges();
     return ['products' => $products, 'productsIsConfigured' => false];
 }
 /**
  * Add Recently Viewed Products to cart.
  *
  * @return void
  */
 public function run()
 {
     $recentlyBlock = $this->orderCreateIndex->getCustomerActivitiesBlock();
     $recentlyBlock->getRecentlyViewedItemsBlock()->addToOrderByName($this->extractProductNames());
     $recentlyBlock->updateChanges();
 }
 /**
  * Select Customer for Order
  *
  * @return void
  */
 public function run()
 {
     $this->orderCreateIndex->getCustomerBlock()->selectCustomer($this->customer);
 }
 /**
  * Fill product data
  *
  * @return void
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->updateProductsData($this->products);
 }
Esempio n. 16
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $block = $this->orderCreatePage->getCreateBlock();
     $block->selectPaymentMethod(['method' => 'vault']);
     $block->selectVaultToken('token_switcher_vault_item_');
 }
 /**
  * Fill Sales Data.
  *
  * @return Address
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->fillAddresses($this->billingAddress, $this->saveAddress);
     return ['billingAddress' => $this->billingAddress];
 }
Esempio n. 18
0
 /**
  * Select store on order create page
  *
  * @return array
  */
 public function run()
 {
     if ($this->orderCreateIndex->getStoreBlock()->isVisible()) {
         $this->orderCreateIndex->getStoreBlock()->selectStoreView($this->store);
     }
 }
 /**
  * Fill Payment data
  *
  * @return void
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->selectPaymentMethod($this->payment);
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     $block = $this->orderCreatePage->getCreateBlock();
     $block->selectPaymentMethod($this->payment, $this->creditCard);
     $block->saveCreditCard($this->payment['method'], $this->creditCardSave);
 }
 /**
  * Fill Order Account Data.
  *
  * @return void
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->getAccountBlock()->fill($this->customer);
 }
 /**
  * Apply gift card on place order in admin.
  *
  * @return void
  */
 public function run()
 {
     if ($this->salesRule !== null) {
         $this->orderCreateIndex->getCouponsBlock()->applyCouponCode($this->salesRule);
     }
 }
 /**
  * Add Recently Viewed Products to cart.
  *
  * @return void
  */
 public function run()
 {
     $recentlyBlock = $this->orderCreateIndex->getCustomerActivitiesBlock();
     $recentlyBlock->getRecentlyViewedItemsBlock()->addProductsToOrder($this->products);
     $recentlyBlock->updateChanges();
 }