Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FormPageActions.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Client\Locator;
10 
18 {
24  protected $backButton = '#back';
25 
31  protected $resetButton = '#reset';
32 
38  protected $saveAndContinueButton = '#save_and_continue';
39 
45  protected $saveButton = '#save';
46 
52  protected $deleteButton = '.delete';
53 
59  protected $spinner = '[data-role="spinner"]';
60 
66  protected $loader = '//ancestor::body/div[@data-role="loader"]';
67 
73  protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]';
74 
78  public function back()
79  {
80  $this->_rootElement->find($this->backButton)->click();
81  }
82 
86  public function reset()
87  {
88  $this->waitForElementVisible($this->resetButton);
89  $this->_rootElement->find($this->resetButton)->click();
90  }
91 
95  public function saveAndContinue()
96  {
97  $this->waitForElementVisible($this->saveAndContinueButton);
98  $this->_rootElement->find($this->saveAndContinueButton)->click();
99  $this->waitForElementNotVisible('.popup popup-loading');
100  $this->waitForElementNotVisible('.loader');
101  }
102 
106  public function save()
107  {
108  $this->waitForElementVisible($this->saveButton);
109  $this->_rootElement->find($this->saveButton)->click();
110  $this->waitForElementNotVisible($this->spinner);
111  $this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
112  $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH);
113  }
114 
118  public function delete()
119  {
120  $this->waitForElementNotVisible($this->spinner);
121  $this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
122  $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH);
123  $this->waitForElementVisible($this->deleteButton);
124  $this->_rootElement->find($this->deleteButton)->click();
125  }
126 
132  public function checkDeleteButton()
133  {
134  return $this->_rootElement->find($this->deleteButton)->isVisible();
135  }
136 }