コード例 #1
0
ファイル: Block.php プロジェクト: qa-tools/qa-tools
 /**
  * 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));
 }
コード例 #2
0
 /**
  * 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));
 }
コード例 #3
0
 /**
  * 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));
 }
コード例 #4
0
ファイル: TestCase.php プロジェクト: qa-tools/qa-tools
 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('\\QATools\\QATools\\PageObject\\IPageFactory');
     $this->pageFactory->shouldReceive('getSession')->andReturn($this->session);
 }
コード例 #5
0
ファイル: Page.php プロジェクト: eltonoliveira/qa-tools
 /**
  * Initialize the page.
  *
  * @param IPageFactory $page_factory Page factory.
  */
 public function __construct(IPageFactory $page_factory)
 {
     parent::__construct($page_factory->getSession());
     $this->pageFactory = $page_factory;
     $this->pageFactory->initPage($this)->initElements($this, $this->pageFactory->createDecorator($this));
 }
コード例 #6
0
ファイル: Page.php プロジェクト: qa-tools/qa-tools
 /**
  * Checks if the page is currently opened in browser.
  *
  * @return boolean
  */
 public function opened()
 {
     return $this->pageFactory->opened($this);
 }
コード例 #7
0
ファイル: WebElement.php プロジェクト: qa-tools/qa-tools
 /**
  * Returns element session.
  *
  * @return     Session
  * @deprecated Accessing the session from the element is deprecated as of 1.2 and will be impossible in 2.0.
  */
 public function getSession()
 {
     @trigger_error(sprintf('The method %s is deprecated as of 1.2 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED);
     return $this->_pageFactory->getSession();
 }
コード例 #8
0
 /**
  * Checks, that Selenium driver is used.
  *
  * @return boolean
  */
 protected function isSeleniumDriver()
 {
     return is_a($this->_pageFactory->getSession()->getDriver(), '\\Behat\\Mink\\Driver\\Selenium2Driver');
 }