Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddGiftMessageBackendStep.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex;
11 use Magento\Mtf\TestStep\TestStepInterface;
12 
17 class AddGiftMessageBackendStep implements TestStepInterface
18 {
24  protected $orderCreateIndex;
25 
31  protected $giftMessage;
32 
38  protected $products;
39 
46  public function __construct(
47  OrderCreateIndex $orderCreateIndex,
48  GiftMessage $giftMessage,
49  array $products = []
50  ) {
51  $this->orderCreateIndex = $orderCreateIndex;
52  $this->giftMessage = $giftMessage;
53  $this->products = $products;
54  }
55 
61  public function run()
62  {
63  if ($this->giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
64  $giftMessageForOrderBlock = $this->orderCreateIndex->getGiftMessageForOrderBlock();
65  $giftMessageForOrderBlock->fill($this->giftMessage);
66  $giftMessageForOrderBlock->waitForElementNotVisible('.loading-mask');
67  }
68  if ($this->giftMessage->getAllowGiftOptionsForItems() === 'Yes') {
69  $giftMessageBlock = $this->orderCreateIndex->getCreateGiftMessageBlock();
70  $giftMessageBlock->fillGiftMessageForItems($this->products, $this->giftMessage);
71  $giftMessageBlock->waitForElementNotVisible('.loading-mask');
72  }
73 
74  return ['giftMessage' => $this->giftMessage];
75  }
76 }
__construct(OrderCreateIndex $orderCreateIndex, GiftMessage $giftMessage, array $products=[])