/**
  * @param  string                   $filename Snapshot filename. Should be unique per test
  * @param  string                   $logDir   Directory to write snapshots into
  * @param  UriInterface|string|null $base     Resolve all relative links with this base uri
  */
 public function saveSessionSnapshot($filename, $logDir, $base = null)
 {
     if (is_dir($logDir) && is_writable($logDir)) {
         if ($this->currentSession instanceof CrawlerSession) {
             $this->currentSession->saveHtml("{$logDir}/{$filename}.html", $base);
         }
         if ($this->currentSession instanceof BrowserSession) {
             $this->currentSession->saveScreenshot("{$logDir}/{$filename}.png");
         }
     } else {
         throw new InvalidArgumentException(sprintf('Make sure directory %s exists and is writable', $logDir));
     }
 }
 /**
  * @covers ::__construct
  * @covers ::getBrowser
  */
 public function testConstruct()
 {
     $session = new BrowserSession($this->browser);
     $this->assertSame($this->browser, $session->getBrowser());
     $this->assertSame($this->browser, $session->getCrawler());
 }
 /**
  * @return BrowserSession
  */
 public function getBrowserSession()
 {
     $session = new BrowserSession(self::getDriver());
     $session->open(self::getServerUri());
     return $session;
 }