Beispiel #1
0
 /**
  * @param string $name
  * @return string
  */
 public function getCookie($name)
 {
     $result = null;
     $cookieData = $this->_driver->manage()->getCookieNamed($name);
     if ($cookieData !== null) {
         $result = urldecode($cookieData['value']);
     }
     return $result;
 }
 public function testSessionSnapshots()
 {
     $this->module->amOnPage('/');
     $this->module->setCookie('PHPSESSID', '123456', ['path' => '/']);
     $this->module->saveSessionSnapshot('login');
     $this->module->seeCookie('PHPSESSID');
     $this->webDriver->manage()->deleteAllCookies();
     $this->module->dontSeeCookie('PHPSESSID');
     $this->module->loadSessionSnapshot('login');
     $this->module->seeCookie('PHPSESSID');
 }
Beispiel #3
0
 /**
  * Maximizes current window
  */
 public function maximizeWindow()
 {
     $this->webDriver->manage()->window()->maximize();
 }
Beispiel #4
0
 /**
  * Specify the amount of time the driver should wait when searching for an element if it is not immediately present.
  * @param number $seconds specify the wait time in seconds
  */
 public function waitFor($seconds = 5)
 {
     self::$webDriver->manage()->timeouts()->implicitlyWait($seconds);
 }
Beispiel #5
0
 public function loadSessionSnapshot($name)
 {
     if (!isset($this->sessionSnapshots[$name])) {
         return false;
     }
     foreach ($this->sessionSnapshots[$name] as $cookie) {
         $this->webDriver->manage()->addCookie($cookie);
     }
     $this->debugSection('Snapshot', "{$name} session restored");
     return true;
 }