Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
CustomerActivities.php
Go to the documentation of this file.
1 <?php
8 
15 use Magento\Mtf\Block\Block;
16 use Magento\Mtf\Client\Locator;
17 
23 class CustomerActivities extends Block
24 {
30  protected $updateChanges = '.actions .action-default.scalable';
31 
37  protected $reorderSidebar = '#order-sidebar_reorder';
38 
44  protected $recentlyViewedSidebar = '#sidebar_data_pviewed';
45 
51  protected $comparedSidebar = '#order-sidebar_compared';
52 
58  protected $recentlyComparedSidebar = '#order-sidebar_pcompared';
59 
66  protected $shoppingCartSidebar = '#order-sidebar_cart';
67 
68  // @codingStandardsIgnoreStart
74  protected $lastSidebar = '//*[@class="create-order-sidebar-container"]/div[div[@class="create-order-sidebar-block"]][last()]';
75  // @codingStandardsIgnoreEnd
76 
82  protected $templateBlock = './ancestor::body';
83 
89  public function getLastOrderedItemsBlock()
90  {
91  return $this->blockFactory->create(
92  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\LastOrderedItems::class,
93  ['element' => $this->_rootElement->find($this->reorderSidebar)]
94  );
95  }
96 
102  public function getRecentlyViewedItemsBlock()
103  {
104  return $this->blockFactory->create(
105  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\RecentlyViewedItems::class,
106  ['element' => $this->_rootElement->find($this->recentlyViewedSidebar)]
107  );
108  }
109 
116  {
117  return $this->blockFactory->create(
118  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\ProductsInComparison::class,
119  ['element' => $this->_rootElement->find($this->comparedSidebar)]
120  );
121  }
122 
129  {
130  return $this->blockFactory->create(
131  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\RecentlyComparedProducts::class,
132  ['element' => $this->_rootElement->find($this->recentlyComparedSidebar)]
133  );
134  }
135 
142  {
143  return $this->blockFactory->create(
144  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\RecentlyViewedProducts::class,
145  ['element' => $this->_rootElement->find($this->recentlyViewedSidebar)]
146  );
147  }
148 
154  public function getShoppingCartItemsBlock()
155  {
156  return $this->blockFactory->create(
157  \Magento\Sales\Test\Block\Adminhtml\Order\Create\CustomerActivities\Sidebar\ShoppingCartItems::class,
158  ['element' => $this->_rootElement->find($this->shoppingCartSidebar)]
159  );
160  }
161 
167  public function getTemplateBlock()
168  {
169  return $this->blockFactory->create(
170  \Magento\Backend\Test\Block\Template::class,
171  ['element' => $this->_rootElement->find($this->templateBlock, Locator::SELECTOR_XPATH)]
172  );
173  }
174 
180  public function updateChanges()
181  {
182  $this->_rootElement->find($this->lastSidebar, Locator::SELECTOR_XPATH)->click();
183  $this->_rootElement->find($this->updateChanges)->click();
184  $this->getTemplateBlock()->waitLoader();
185  }
186 }