Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StoreGrid.php
Go to the documentation of this file.
1 <?php
8 
12 use Magento\Store\Test\Fixture\Website;
13 use Magento\Mtf\Client\Locator;
14 
18 class StoreGrid extends Grid
19 {
25  protected $editLink = 'td[data-column="store_title"] > a';
26 
32  protected $rowTemplateStrict = '//*[text()[normalize-space()="%s"]]';
33 
39  protected $filters = [
40  'store_title' => [
41  'selector' => '#storeGrid_filter_store_title',
42  ],
43  'group_title' => [
44  'selector' => '#storeGrid_filter_group_title',
45  ],
46  'website_title' => [
47  'selector' => '#storeGrid_filter_website_title',
48  ],
49  ];
50 
56  protected $titleFormat = '//td[a[.="%s"]]';
57 
63  protected $storeName = '//a[.="%s"]';
64 
71  public function isStoreExists($title)
72  {
73  $element = $this->_rootElement->find(sprintf($this->titleFormat, $title), Locator::SELECTOR_XPATH);
74  return $element->isVisible();
75  }
76 
83  public function isWebsiteExists($website)
84  {
85  return $this->_rootElement->find(sprintf($this->titleFormat, $website->getName()), Locator::SELECTOR_XPATH)
86  ->isVisible();
87  }
88 
95  public function searchAndOpenWebsite(Website $website)
96  {
97  $websiteName = $website->getName();
98  $this->search(['website_title' => $websiteName]);
99  $this->_rootElement->find(sprintf($this->storeName, $websiteName), Locator::SELECTOR_XPATH)->click();
100  }
101 
108  public function searchAndOpenWebsiteByName($websiteName)
109  {
110  $this->search(['website_title' => $websiteName]);
111  $this->_rootElement->find(sprintf($this->storeName, $websiteName), Locator::SELECTOR_XPATH)->click();
112  }
113 
120  public function searchAndOpenStore(Store $store)
121  {
122  $storeName = $store->getName();
123  $this->search(['store_title' => $storeName]);
124  $this->_rootElement->find(sprintf($this->storeName, $storeName), Locator::SELECTOR_XPATH)->click();
125  }
126 
133  public function searchAndOpenStoreGroup(StoreGroup $storeGroup)
134  {
135  $storeGroupName = $storeGroup->getName();
136  $this->search(['group_title' => $storeGroupName]);
137  $this->_rootElement->find(sprintf($this->storeName, $storeGroupName), Locator::SELECTOR_XPATH)->click();
138  }
139 }
$title
Definition: default.phtml:14
$element
Definition: element.phtml:12