API Moved iShouldSeeAButton to behat-extension

This commit is contained in:
Damian Mooyman 2017-01-10 14:39:24 +13:00
parent 8118448a9c
commit 9e563ebd3a
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A

View File

@ -2,15 +2,9 @@
namespace SilverStripe\Framework\Test\Behaviour;
use Behat\Behat\Context\ClosuredContextInterface;
use Behat\Behat\Context\TranslatedContextInterface;
use Behat\Behat\Context\BehatContext;
use Behat\Behat\Context\Step;
use Behat\Behat\Exception\PendingException;
use Behat\Mink\Exception\ElementHtmlException;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext as MinkContext;
use Symfony\Component\DomCrawler\Crawler;
use Behat\Mink\Element\NodeElement;
use SilverStripe\SiteConfig\SiteConfig;
@ -215,30 +209,6 @@ JS;
$this->getSession()->executeScript($js);
}
/**
* Example: I should see a "Submit" button
* Example: I should not see a "Delete" button
*
* @Given /^I should( not? |\s*)see a "([^"]*)" button$/
*/
public function iShouldSeeAButton($negative, $text)
{
$page = $this->getSession()->getPage();
$els = $page->findAll('named', array('link_or_button', "'$text'"));
$matchedEl = null;
foreach ($els as $el) {
if ($el->isVisible()) {
$matchedEl = $el;
}
}
if (trim($negative)) {
assertNull($matchedEl, sprintf('%s button found', $text));
} else {
assertNotNull($matchedEl, sprintf('%s button not found', $text));
}
}
/**
* @Given /^I should( not? |\s*)see a "([^"]*)" field$/
*/