Exemple #1
0
 /**
  * @param array $urlParameters
  * @return boolean
  */
 public function isOpen(array $urlParameters = [])
 {
     if (!isset($urlParameters['id'])) {
         $urlParameters['id'] = '*';
     }
     return parent::isOpen($urlParameters);
 }
 /**
  * @param string $locator
  * @param string $value
  */
 public function simpleFillField($locator, $value)
 {
     $field = parent::findField($locator);
     if (null === $field) {
         throw $this->elementNotFound('form field', 'id|name|label|value', $locator);
     }
     $field->setValue($value);
 }
Exemple #3
0
 /**
  * @inheritdoc
  */
 public function open(array $urlParameters = ['xml' => ''])
 {
     return parent::open($urlParameters);
 }
 /**
  * @Given I am on the page for :page
  * @Then I should be on the page for :page
  */
 public function iAmOnPage(Page $page)
 {
     $page->open();
 }
Exemple #5
0
 /**
  * Clicks link with specified locator.
  *
  * @param string $locator
  *        	link id, title, text or image alt
  *        	
  * @throws ElementNotFoundException
  */
 public function clickLink($locator)
 {
     $this->scrollWindowToLink($locator);
     parent::clickLink($locator);
 }
Exemple #6
0
 /**
  * {@inheritdoc}
  */
 public function getElement($name, $timeout = 20, $message = 'no message')
 {
     return $this->spin(function () use($name) {
         return parent::getElement($name);
     }, $timeout, $message);
 }
Exemple #7
0
 /**
  * @param string $locator
  * @param string $value
  */
 public function simpleFillField($locator, $value)
 {
     $this->spin(function () use($locator) {
         return parent::findField($locator);
     })->setValue($value);
 }
Exemple #8
0
 /**
  * @param string $locator
  * @param string $value
  */
 public function simpleFillField($locator, $value)
 {
     $this->spin(function () use($locator) {
         return parent::findField($locator);
     }, sprintf('Cannot find field "%s"', $locator))->setValue($value);
 }
Exemple #9
0
 /**
  * Helper method that returns the content block of a page
  * @param Page $parent
  * @return \Behat\Mink\Element\NodeElement
  * @throws \Exception
  */
 public static function getContentBlock(Page $parent)
 {
     $contentBlocks = ['emotion' => 'div#content > div.inner', 'responsive' => 'div.content-main--inner'];
     foreach ($contentBlocks as $locator) {
         $block = $parent->find('css', $locator);
         if ($block) {
             return $block;
         }
     }
     self::throwException('No content block found!');
 }
Exemple #10
0
 /**
  * @param Session $session
  * @param Factory $factory
  * @param array $parameters
  * @param RouterInterface $router
  */
 public function __construct(Session $session, Factory $factory, array $parameters = array(), RouterInterface $router)
 {
     parent::__construct($session, $factory, $parameters);
     $this->router = $router;
 }
 /**
  * A bit of a hack, we require the Session to create instances of Notice, so we store it here
  * @param NodeElement $node
  * @param Session $session
  */
 public function __construct(Session $session, Factory $factory, array $parameters = array())
 {
     parent::__construct($session, $factory, $parameters);
     $this->session = $session;
 }
 /**
  * @Then /^I should be on the (page "[^"]*")$/
  */
 public function iShouldBeOnThePage(Page $page)
 {
     $page->verifyPage();
 }
 /**
  * @param string $name
  * @param array $arguments
  * @return Page
  */
 public function openPage($name, $arguments = [])
 {
     $this->currentPage = $this->getPage($name)->open($arguments);
     expect($this->currentPage->isOpen())->toBe(true);
     return $this->currentPage;
 }
 /**
  * Helper function to get the current language ('de' or 'en')
  * @param Page $page
  * @return string
  */
 public static function getCurrentLanguage(Page $page)
 {
     $shop = null;
     $meta = $page->find('css', 'meta[name=application-name]');
     $shop = $meta->getAttribute('content');
     if ($shop === 'English') {
         return 'en';
     }
     return 'de';
 }