/**
  * Initializes html element.
  *
  * @param array        $selenium_selector Element selector.
  * @param IPageFactory $page_factory      Page factory.
  */
 public function __construct(array $selenium_selector, IPageFactory $page_factory)
 {
     parent::__construct($selenium_selector, $page_factory->getSession());
     $this->_pageFactory = $page_factory;
     $this->_pageFactory->initElementContainer($this);
     $this->_pageFactory->initElements($this, $this->_pageFactory->createDecorator($this));
 }
Esempio n. 2
0
 /**
  * Create instance of BEM block.
  *
  * @param string              $name         Block name.
  * @param array|NodeElement[] $nodes        Nodes associated with this block.
  * @param IPageFactory        $page_factory Page factory.
  * @param BEMElementLocator   $locator      Locator.
  */
 public final function __construct($name, array $nodes, IPageFactory $page_factory, BEMElementLocator $locator)
 {
     parent::__construct($name);
     $this->_nodes = $nodes;
     $this->_locator = $locator;
     $page_factory->initElements($this, $page_factory->createDecorator($this));
 }
 /**
  * Specifies wrapped WebElement.
  *
  * @param WebElement   $wrapped_element Element to be wrapped.
  * @param IPageFactory $page_factory    Page factory.
  */
 public function __construct(WebElement $wrapped_element, IPageFactory $page_factory)
 {
     parent::__construct($wrapped_element);
     $this->_pageFactory = $page_factory;
     $this->_pageFactory->initElementContainer($this);
     $this->_pageFactory->initElements($this, $page_factory->createDecorator($this));
 }
Esempio n. 4
0
 protected function setUp()
 {
     parent::setUp();
     $handler = m::mock('\\Behat\\Mink\\Selector\\SelectorsHandler');
     $handler->shouldReceive('selectorToXpath')->with('se', array('xpath' => 'XPATH'))->andReturn('XPATH');
     $handler->shouldReceive('selectorToXpath')->with('se', array('xpath' => 'XPATH_ROOT'))->andReturn('/XPATH');
     $this->selectorsHandler = $handler;
     $this->driver = m::mock('\\Behat\\Mink\\Driver\\DriverInterface');
     $this->session = m::mock('\\Behat\\Mink\\Session');
     $this->session->shouldReceive('getSelectorsHandler')->andReturn($this->selectorsHandler);
     $this->session->shouldReceive('getDriver')->andReturn($this->driver)->byDefault();
     $this->pageFactory = m::mock('\\aik099\\QATools\\PageObject\\IPageFactory');
     $this->pageFactory->shouldReceive('getSession')->andReturn($this->session);
 }
Esempio n. 5
0
 /**
  * Initialize the page.
  *
  * @param IPageFactory $page_factory Page factory.
  */
 public function __construct(IPageFactory $page_factory)
 {
     parent::__construct($page_factory->getSession());
     $page_factory->initPage($this)->initElements($this, $page_factory->createDecorator($this));
 }