From ba7dfcfd54a742fe63c326d74706c66d25f50641 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 9 Apr 2013 09:39:06 +0200 Subject: [PATCH] Added iShouldSeeAButton assertion --- .../Framework/Test/Behaviour/CmsFormsContext.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php b/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php index ca7b7baf9..a738e8652 100644 --- a/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php +++ b/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php @@ -98,4 +98,14 @@ class CmsFormsContext extends BehatContext $this->getMainContext()->assertElementContains('#' . $inputField->getAttribute('id'), $value); } + + /** + * @Given /^I should see a "([^"]*)" button$/ + */ + public function iShouldSeeAButton($text) + { + $page = $this->getSession()->getPage(); + $element = $page->find('named', array('link_or_button', "'$text'")); + assertNotNull($element, sprintf('%s button not found', $text)); + } }