trait BrowserTestHelpersTrait in Typed Data API enhancements 8
Provides some helpers for BrowserTestBase.
Hierarchy
- trait \Drupal\Tests\typed_data\Traits\BrowserTestHelpersTrait
1 file declares its use of BrowserTestHelpersTrait
- FormWidgetBrowserTestBase.php in tests/
src/ Functional/ TypedDataFormWidget/ FormWidgetBrowserTestBase.php
File
- tests/
src/ Traits/ BrowserTestHelpersTrait.php, line 8
Namespace
Drupal\Tests\typed_data\TraitsView source
trait BrowserTestHelpersTrait {
/**
* Finds link with specified locator.
*
* @param string $locator
* Link id, title, text or image alt.
*
* @return \Behat\Mink\Element\NodeElement|null
* The link node element.
*/
public function findLink($locator) {
return $this
->getSession()
->getPage()
->findLink($locator);
}
/**
* Finds field (input, textarea, select) with specified locator.
*
* @param string $locator
* Input id, name or label.
*
* @return \Behat\Mink\Element\NodeElement|null
* The input field element.
*/
public function findField($locator) {
return $this
->getSession()
->getPage()
->findField($locator);
}
/**
* Finds button with specified locator.
*
* @param string $locator
* Button id, value or alt.
*
* @return \Behat\Mink\Element\NodeElement|null
* The button node element.
*/
public function findButton($locator) {
return $this
->getSession()
->getPage()
->findButton($locator);
}
/**
* Presses button with specified locator.
*
* @param string $locator
* Button id, value or alt.
*
* @throws \Behat\Mink\Exception\ElementNotFoundException
*/
public function pressButton($locator) {
$this
->getSession()
->getPage()
->pressButton($locator);
}
/**
* Fills in field (input, textarea, select) with specified locator.
*
* @param string $locator
* Input id, name or label.
* @param string $value
* Value.
*
* @throws \Behat\Mink\Exception\ElementNotFoundException
*
* @see \Behat\Mink\Element\NodeElement::setValue
*/
public function fillField($locator, $value) {
$this
->getSession()
->getPage()
->fillField($locator, $value);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BrowserTestHelpersTrait:: |
public | function | Fills in field (input, textarea, select) with specified locator. | |
BrowserTestHelpersTrait:: |
public | function | Finds button with specified locator. | |
BrowserTestHelpersTrait:: |
public | function | Finds field (input, textarea, select) with specified locator. | |
BrowserTestHelpersTrait:: |
public | function | Finds link with specified locator. | |
BrowserTestHelpersTrait:: |
public | function | Presses button with specified locator. |