Ejemplo n.º 1
0
 public function testGetWebDriverSessionId()
 {
     /** @var Selenium2Driver $driver */
     $driver = $this->getSession()->getDriver();
     $this->assertNotEmpty($driver->getWebDriverSessionId(), 'Started session has an ID');
     $driver = new Selenium2Driver();
     $this->assertNull($driver->getWebDriverSessionId(), 'Not started session don\'t have an ID');
 }
Ejemplo n.º 2
0
 public function _initialize()
 {
     $capabilities = array_merge(Selenium2Driver::getDefaultCapabilities(), $this->config['capabilities']);
     $capabilities['name'] = 'Codeception Test';
     $driver = new Selenium2Driver($this->config['browser'], $capabilities, sprintf('http://%s:%d/wd/hub', $this->config['host'], $this->config['port']));
     $this->session = new \Behat\Mink\Session($driver);
 }
 /**
  * Instantiates the driver.
  *
  * @param string    $browser Browser name
  * @param array     $desiredCapabilities The desired capabilities
  * @param string    $wdHost The WebDriver host
  * @param array     $moodleParameters Moodle parameters including our non-behat-friendly selenium capabilities
  */
 public function __construct($browserName = 'firefox', $desiredCapabilities = null, $wdHost = 'http://localhost:4444/wd/hub', $moodleParameters = false)
 {
     // If they are set add them overridding if it's the case (not likely).
     if (!empty($moodleParameters) && !empty($moodleParameters['capabilities'])) {
         foreach ($moodleParameters['capabilities'] as $key => $capability) {
             $desiredCapabilities[$key] = $capability;
         }
     }
     parent::__construct($browserName, $desiredCapabilities, $wdHost);
     // This class is instantiated by the dependencies injection system so
     // prior to all of beforeSuite subscribers which will call getBrowser*()
     self::$browser = $browserName;
 }
Ejemplo n.º 4
0
 /**
  * Returns list of default parameters.
  *
  * @return  array
  */
 protected static function getDefaultParameters()
 {
     return array('default_session' => 'goutte', 'javascript_session' => 'sahi', 'base_url' => 'http://localhost', 'show_cmd' => static::getDefaultShowCmd(), 'show_tmp_dir' => sys_get_temp_dir(), 'browser' => 'firefox', 'goutte' => array('zend_config' => array(), 'server_parameters' => array()), 'sahi' => array('sid' => null, 'host' => 'localhost', 'port' => 9999), 'zombie' => array('host' => '127.0.0.1', 'port' => 8124, 'node_bin' => 'node', 'auto_server' => true), 'selenium' => array('host' => 'localhost', 'port' => 4444), 'webdriver' => array('host' => 'http://localhost:4444/wd/hub', 'capabilities' => Selenium2Driver::getDefaultCapabilities()));
 }
 /**
  * {@inheritdoc}
  */
 public function stop()
 {
     parent::stop();
     $this->phantomJsProc->stop(0);
 }
 public function switchToWindow($name = null)
 {
     $this->saveScreenshot();
     parent::switchToWindow($name);
     $this->saveScreenshot();
 }
Ejemplo n.º 7
0
 public function wait($time, $condition = 'false')
 {
     parent::wait($time, $condition);
 }