SessionSnapshot
in
Table of Contents
Methods
- deleteSessionSnapshot() : mixed
- Deletes session snapshot.
- loadSessionSnapshot() : mixed
- Loads cookies from a saved snapshot.
- saveSessionSnapshot() : mixed
- Saves current cookies into named snapshot in order to restore them in other tests This is useful to save session state between tests.
Methods
deleteSessionSnapshot()
Deletes session snapshot.
public
deleteSessionSnapshot(mixed $name) : mixed
Parameters
- $name : mixed
loadSessionSnapshot()
Loads cookies from a saved snapshot.
public
loadSessionSnapshot(mixed $name) : mixed
Allows to reuse same session across tests without additional login.
Parameters
- $name : mixed
saveSessionSnapshot()
Saves current cookies into named snapshot in order to restore them in other tests This is useful to save session state between tests.
public
saveSessionSnapshot(mixed $name) : mixed
For example, if user needs log in to site for each test this scenario can be executed once while other tests can just restore saved cookies.
<?php
// inside AcceptanceTester class:
public function login()
{
// if snapshot exists - skipping login
if ($I->loadSessionSnapshot('login')) return;
// logging in
$I->amOnPage('/login');
$I->fillField('name', 'jon');
$I->fillField('password', '123345');
$I->click('Login');
// saving snapshot
$I->saveSessionSnapshot('login');
}
?>
Parameters
- $name : mixed