mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API Moved iShouldSeeAButton to behat-extension
This commit is contained in:
parent
8118448a9c
commit
9e563ebd3a
@ -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$/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user