Beispiel #1
0
 /**
  * Shut down the Mink session.
  *
  * @return void
  */
 protected function stopMinkSession()
 {
     if (!empty($this->session)) {
         $this->session->stop();
         $this->session = null;
     }
 }
Beispiel #2
0
 /**
  *
  * @return array
  */
 public function shoot()
 {
     $this->_session = $this->_camera->get_session();
     // Iterate over shots
     foreach ($this->_shots as $shot) {
         /* @var $shot Shot */
         $output = $this->_shoot_shot($shot);
         $this->_log_out("Saving as " . $this->_film->get_root_folder() . $shot->get_destination_file());
         // Save output in folder
         if (empty($output)) {
             $this->_log_out("There was an error capturing this page. Please, check or retry. ");
             continue;
         }
         $saved_result = $this->_film->get_filesystem()->put($shot->get_destination_file(), $output);
         if (!$saved_result) {
             $this->_log_out("There was an error saving the screenshot. Please, check or retry. ");
             continue;
         }
         // It was successful, mark it
         $shot->set_completed(true);
     }
     // If session is open (it should) just close it
     if ($this->_session->isStarted()) {
         $this->_session->stop();
     }
     return $this->_shots;
 }
 /**
  * Stops session.
  *
  * @return void
  */
 protected function stopSession()
 {
     if ($this->_session === null) {
         return;
     }
     $this->_session->stop();
     $this->_session = null;
 }
Beispiel #4
0
 public function _after(\Codeception\TestCase $test)
 {
     //that call does not really terminate node process
     //@see https://github.com/symfony/symfony/issues/5499
     $this->session->stop();
     //so we kill it ourselves
     exec('killall ' . pathinfo($this->server->getNodeBin(), PATHINFO_BASENAME) . ' > /dev/null 2>&1');
 }
 public function testStop()
 {
     $this->driver->expects($this->once())->method('stop');
     $this->session->stop();
 }
Beispiel #6
0
 public function _after(TestCase $test)
 {
     $this->session->stop();
 }
Beispiel #7
0
 public function _after(\Codeception\TestCase $test)
 {
     $this->session->stop();
 }
<?php

require __DIR__ . '/vendor/autoload.php';
use Behat\Mink\Driver\GoutteDriver;
use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Session;
//$driver = new GoutteDriver();
$driver = new Selenium2Driver();
$session = new Session($driver);
$session->start();
$session->visit('http://jurassicpark.wikia.com');
//echo "The status code is ".$session->getStatusCode()."\n";
echo "The current URL is " . $session->getCurrentUrl() . "\n";
// Hallo! I'm a DocumentElement
$page = $session->getPage();
echo "The start of the page text is " . substr($page->getText(), 0, 56) . "\n";
// And I'm a NodeElement!
$nodeElement = $page->find('css', '.subnav-2 li a');
echo "The matched link text is " . $nodeElement->getText() . "\n";
$randomLink = $page->findLink('Random page');
echo "The matched URL is " . $randomLink->getAttribute('href') . "\n";
$randomLink->click();
echo "The new URL is " . $session->getCurrentUrl() . "\n";
$session->stop();
Beispiel #9
0
 /**
  * @Then /^I close the session$/
  */
 public function iCloseTheSession()
 {
     $this->session->stop();
 }
Beispiel #10
0
 public function tearDown()
 {
     $this->session->stop();
 }