A simple Behat Context for working with HTML and navigation
Install via composer
"edmondscommerce/behat-html-context": "0.0.1"
default:
# ...
suites:
default:
# ...
contexts:
- # ...
- EdmondsCommerce\BehatHtmlContext\HTMLContext
- EdmondsCommerce\BehatHtmlContext\RedirectionContext
EdmondsCommerce\BehatHtmlContext\RedirectionContext
is no longer supported and marked as deprecated.
You will need to load the HTML context as part of your own suite of contexts using @BeforeScenario
to access the helper methods
All helpers accept a custom message to use with the exception
// Instantiate context class,
$args = [
'args' => [
'--disable-gpu',
'--window-size=1920,1080',
'--start-maximised',
],
];
$driver = new Selenium2Driver('chrome', $args);
$session = new Behat\Mink\Session($driver);
$mink = new Mink(['selenium2' => $session]);
$htmlContext = new HTMLContext();
$htmlContext->setMink($mink);
//Find a node and return it or throw an exception
$htmlContext->findOneOrFail($selector, $locator, $message = null)
//Find multiple nodes and return an array of them or throw an exception if none are found
$htmlContext->findAllOrFail($selector, $locator, $message = null)
//Same as findOrFail but searches from the context of another node, can be useful for chaining
$htmlContext->findOrFailFromNode(\Behat\Mink\Element\NodeElement $element, $selector, $locator, $message = null)
Simple PHP QA pipeline and scripts, that helps achieving high quality of code. Click here for more details.
PHP Built-in web server. Click here for more details.
Goutte driver. Click here for more details.
Selenium2 driver. Click here for more details.