class WebAssert in Zircon Profile 8
Same name in this branch
- 8 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert
- 8 core/modules/simpletest/src/WebAssert.php \Drupal\simpletest\WebAssert
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebAssert.php \Drupal\simpletest\WebAssert
Defines a class with methods for asserting presence of elements during tests.
Hierarchy
Expanded class hierarchy of WebAssert
File
- core/
modules/ simpletest/ src/ WebAssert.php, line 17 - Contains \Drupal\simpletest\WebAssert.
Namespace
Drupal\simpletestView source
class WebAssert extends MinkWebAssert {
/**
* Checks that specific button exists on the current page.
*
* @param string $button
* One of id|name|label|value for the button.
* @param \Behat\Mink\Element\TraversableElement $container
* (optional) The document to check against. Defaults to the current page.
*
* @return \Behat\Mink\Element\NodeElement
* The matching element.
*
* @throws \Behat\Mink\Exception\ElementNotFoundException
* When the element doesn't exist.
*/
public function buttonExists($button, TraversableElement $container = NULL) {
$container = $container ?: $this->session
->getPage();
$node = $container
->findButton($button);
if ($node === NULL) {
throw new ElementNotFoundException($this->session, 'button', 'id|name|label|value', $button);
}
return $node;
}
/**
* Checks that specific select field exists on the current page.
*
* @param string $select
* One of id|name|label|value for the select field.
* @param \Behat\Mink\Element\TraversableElement $container
* (optional) The document to check against. Defaults to the current page.
*
* @return \Behat\Mink\Element\NodeElement
* The matching element
*
* @throws \Behat\Mink\Exception\ElementNotFoundException
* When the element doesn't exist.
*/
public function selectExists($select, TraversableElement $container = NULL) {
$container = $container ?: $this->session
->getPage();
$node = $container
->find('named', array(
'select',
$this->session
->getSelectorsHandler()
->xpathLiteral($select),
));
if ($node === NULL) {
throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
}
return $node;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebAssert:: |
protected | property | ||
WebAssert:: |
public | function | Checks that current session address is equals to provided one. | |
WebAssert:: |
public | function | Checks that current session address matches regex. | |
WebAssert:: |
public | function | Checks that current session address is not equals to provided one. | |
WebAssert:: |
private | function | Asserts a condition. | |
WebAssert:: |
private | function | Asserts a condition on an element. | |
WebAssert:: |
private | function | Asserts a condition involving the text of an element. | |
WebAssert:: |
private | function | Asserts a condition involving the response text. | |
WebAssert:: |
public | function | Checks that specific button exists on the current page. | |
WebAssert:: |
public | function | Checks that specific checkbox is checked. | |
WebAssert:: |
public | function | Checks that specific checkbox is unchecked. | |
WebAssert:: |
protected | function | Trims scriptname from the URL. | |
WebAssert:: |
public | function | Checks that specified cookie exists and its value equals to a given one. | |
WebAssert:: |
public | function | Checks that specified cookie exists. | |
WebAssert:: |
public | function | Checks that an attribute of a specific elements contains text. | |
WebAssert:: |
public | function | Checks that an attribute exists in an element. | |
WebAssert:: |
public | function | Checks that an attribute of a specific elements does not contain text. | |
WebAssert:: |
public | function | Checks that specific element contains HTML. | |
WebAssert:: |
public | function | Checks that specific element exists on the current page. | |
WebAssert:: |
public | function | Checks that specific element does not contains HTML. | |
WebAssert:: |
public | function | Checks that specific element does not exists on the current page. | |
WebAssert:: |
public | function | Checks that there is specified number of specific elements on the page. | |
WebAssert:: |
public | function | Checks that specific element contains text. | |
WebAssert:: |
public | function | Checks that specific element does not contains text. | |
WebAssert:: |
public | function | Checks that specific field exists on the current page. | |
WebAssert:: |
public | function | Checks that specific field does not exists on the current page. | |
WebAssert:: |
public | function | Checks that specific field have provided value. | |
WebAssert:: |
public | function | Checks that specific field have provided value. | |
WebAssert:: |
protected | function | Gets current url of the page. | |
WebAssert:: |
private | function | ||
WebAssert:: |
public | function | Checks that current page contains text. | |
WebAssert:: |
public | function | Checks that current page text matches regex. | |
WebAssert:: |
public | function | Checks that current page does not contains text. | |
WebAssert:: |
public | function | Checks that current page text does not matches regex. | |
WebAssert:: |
public | function | Checks that page HTML (response content) contains text. | |
WebAssert:: |
public | function | Checks that current response header contains value. | |
WebAssert:: |
public | function | Checks that current response header equals value. | |
WebAssert:: |
public | function | Checks that current response header matches regex. | |
WebAssert:: |
public | function | Checks that current response header does not contain value. | |
WebAssert:: |
public | function | Checks that current response header does not equal value. | |
WebAssert:: |
public | function | Checks that current response header does not match regex. | |
WebAssert:: |
public | function | Checks that page HTML (response content) matches regex. | |
WebAssert:: |
public | function | Checks that page HTML (response content) does not contains text. | |
WebAssert:: |
public | function | Checks that page HTML (response content) does not matches regex. | |
WebAssert:: |
public | function | Checks that specific select field exists on the current page. | |
WebAssert:: |
public | function | Checks that current response code equals to provided one. | |
WebAssert:: |
public | function | Checks that current response code not equals to provided one. | |
WebAssert:: |
public | function | Initializes assertion engine. |