Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CurrencyRateForm.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Form;
10 use Magento\Mtf\Fixture\FixtureInterface;
11 use Magento\Mtf\Client\Element\SimpleElement;
12 
16 class CurrencyRateForm extends Form
17 {
23  protected $message = '#messages';
24 
30  protected $importButton = '[data-ui-id$="import-button"]';
31 
37  protected $USDUAHRate = '[name$="rate[USD][UAH]"]';
38 
45  public function clickImportButton()
46  {
47  $this->_rootElement->find($this->importButton)->click();
48 
49  //Wait message
50  $browser = $this->browser;
51  $selector = $this->message;
52  $browser->waitUntil(
53  function () use ($browser, $selector) {
54  $message = $browser->find($selector);
55  return $message->isVisible() ? true : null;
56  }
57  );
58  }
59 
60  /*
61  * Populate USD-UAH rate value.
62  *
63  * @throws \Exception
64  * @return void
65  */
66  public function fillCurrencyUSDUAHRate()
67  {
68  $this->_rootElement->find($this->USDUAHRate)->setValue('2.000');
69 
70  //Wait message
71  $browser = $this->browser;
72  $selector = $this->message;
73  $browser->waitUntil(
74  function () use ($browser, $selector) {
75  $message = $browser->find($selector);
76  return $message->isVisible() ? true : null;
77  }
78  );
79  }
80 
88  public function fill(FixtureInterface $fixture, SimpleElement $element = null)
89  {
91  $this->placeholders['currency_from'] = $fixture->getCurrencyFrom();
92  $this->placeholders['currency_to'] = $fixture->getCurrencyTo();
93  $this->applyPlaceholders();
94 
95  return parent::fill($fixture, $element);
96  }
97 }
$element
Definition: element.phtml:12