Ejemplo n.º 1
10
 /**
  * Fill gift message form on order level
  *
  * @param GiftMessage $giftMessage
  * @return void
  */
 public function fillGiftMessageOrder(GiftMessage $giftMessage)
 {
     /** @var \Magento\GiftMessage\Test\Block\Cart\GiftOptions\GiftMessageForm $giftMessageForm */
     if ($giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $this->_rootElement->find($this->allowGiftOptions)->click();
         $giftMessageForm = $this->blockFactory->create('Magento\\GiftMessage\\Test\\Block\\Cart\\GiftOptions\\GiftMessageForm', ['element' => $this->_rootElement->find($this->giftMessageOrderForm)]);
         $formData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()];
         $formData = $this->fixtureFactory->createByCode('giftMessage', ['data' => $formData]);
         $giftMessageForm->fill($formData);
         $this->_rootElement->find($this->giftMessageOrderButton)->click();
         $this->waitForElementVisible($this->giftMessageSummary);
     }
 }
 /**
  * Assert that message from dataset is displayed on order(s) view page on backend.
  *
  * @param GiftMessage $giftMessage
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param FixtureFactory $fixtureFactory
  * @param array $products
  * @param string $orderId
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, SalesOrderView $salesOrderView, OrderIndex $orderIndex, FixtureFactory $fixtureFactory, array $products, $orderId)
 {
     $expectedData = [];
     $actualData = [];
     $orderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     if ($giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $formData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()];
         $giftMessageForm = $fixtureFactory->createByCode('giftMessage', ['data' => $formData]);
         $expectedData[] = $giftMessageForm->getData();
         $actualData[] = $salesOrderView->getGiftOptionsBlock()->getData($giftMessageForm);
     }
     if ($giftMessage->getAllowGiftOptionsForItems() === 'Yes') {
         foreach ($giftMessage->getItems() as $key => $giftMessageItem) {
             $expectedData[] = $giftMessageItem->getData();
             $product = $products[$key];
             $actualData[] = $salesOrderView->getGiftItemsBlock()->getItemProduct($product)->getGiftMessageFormData($giftMessage);
         }
     }
     $errors = $this->verifyData($expectedData, $actualData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * 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];
 }
 /**
  * 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];
 }
Ejemplo n.º 5
0
 /**
  * Fill gift message form on order level
  *
  * @param GiftMessage $giftMessage
  * @return void
  */
 public function fillGiftMessageOrder(GiftMessage $giftMessage)
 {
     /** @var \Magento\GiftMessage\Test\Block\Cart\GiftOptions\GiftMessageForm $giftMessageForm */
     if ($giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $this->_rootElement->find($this->allowGiftOptions)->click();
         $giftMessageForm = $this->blockFactory->create('Magento\\GiftMessage\\Test\\Block\\Cart\\GiftOptions\\GiftMessageForm', ['element' => $this->_rootElement->find($this->giftMessageOrderForm)]);
         $giftMessageForm->fill($giftMessage);
         $this->_rootElement->find($this->giftMessageOrderButton)->click();
         $this->waitForElementVisible($this->giftMessageSummary);
     }
 }
 /**
  * Assert that message from dataSet is displayed on order(s) view page on backend.
  *
  * @param GiftMessage $giftMessage
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $orderIndex
  * @param array $products
  * @param string $orderId
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, SalesOrderView $salesOrderView, OrderIndex $orderIndex, array $products, $orderId)
 {
     $orderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     if ($giftMessage->getAllowGiftMessagesForOrder()) {
         $expectedData[] = $giftMessage->getData();
         $actualData[] = $salesOrderView->getGiftOptionsBlock()->getData($giftMessage);
     }
     if ($giftMessage->getAllowGiftOptionsForItems()) {
         foreach ($products as $key => $product) {
             $expectedData[] = $giftMessage->getItems()[$key]->getData();
             $actualData[] = $salesOrderView->getGiftItemsBlock()->getItemProduct($product)->getGiftMessageFormData($giftMessage);
         }
     }
     $errors = $this->verifyData($expectedData, $actualData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }