Skip to content

Commit

Permalink
Workaround for bug Codeception#5401 to ensure cookie expiry value is …
Browse files Browse the repository at this point in the history
…not null which fails in chromedriver 2.46
  • Loading branch information
JvE committed Feb 21, 2019
1 parent f9d1374 commit c4d21e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Codeception/Module/WebDriver.php
Expand Up @@ -3088,15 +3088,16 @@ public function loadSessionSnapshot($name)
if (!isset($this->sessionSnapshots[$name])) {
return false;
}

foreach ($this->webDriver->manage()->getCookies() as $cookie) {
if (in_array(trim($cookie['name']), [LocalServer::COVERAGE_COOKIE, LocalServer::COVERAGE_COOKIE_ERROR])) {
continue;
}
$this->webDriver->manage()->deleteCookieNamed($cookie['name']);
}

foreach ($this->sessionSnapshots[$name] as $cookie) {
$cookie->setExpiry($cookie->getExpiry());
$this->webDriver->manage()->addCookie($cookie);
}
$this->debugSection('Snapshot', "Restored \"$name\" session snapshot");
Expand Down

0 comments on commit c4d21e3

Please sign in to comment.