mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
NEW: Adding some Behat steps for css selectors and Dialog confirmation
This commit is contained in:
parent
c456dbac5d
commit
4dc379a38a
@ -345,6 +345,32 @@ JS;
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click on the element with the provided xpath query
|
||||
*
|
||||
* @When /^I click on the element with css selector "([^"]*)"$/
|
||||
*/
|
||||
public function iClickOnTheElementWithCSSSelector($cssSelector) {
|
||||
$session = $this->getSession();
|
||||
$element = $session->getPage()->find(
|
||||
'xpath',
|
||||
$session->getSelectorsHandler()->selectorToXpath('css', $cssSelector) // just changed xpath to css
|
||||
);
|
||||
if (null === $element) {
|
||||
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
|
||||
}
|
||||
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I click on the element with css selector "([^"]*)", confirming the dialog$/
|
||||
*/
|
||||
public function iClickOnTheElementWithCSSSelectorConfirmingTheDialog($cssSelector) {
|
||||
$this->iClickOnTheElementWithCSSSelector($cssSelector);
|
||||
$this->iConfirmTheDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I type "([^"]*)" into the dialog$/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user