Merge pull request #165 from kinglozzer/updated-logout-step

Update logout step to use new logout form
This commit is contained in:
Daniel Hensby 2017-06-22 09:09:58 +01:00 committed by GitHub
commit b020cf3426

View File

@ -57,7 +57,21 @@ class LoginContext implements Context
public function stepIAmNotLoggedIn()
{
$c = $this->getMainContext();
$this->getMainContext()->getSession()->visit($c->joinUrlParts($c->getBaseUrl(), Security::logout_url()));
// We're missing a security token, so we'll be presented with a form
$this->getMainContext()->getSession()->visit($c->joinUrlParts($c->getBaseUrl(), 'Security/logout/'));
$page = $this->getMainContext()->getSession()->getPage();
$form = $page->findById('LogoutForm_Form');
assertNotNull($form, 'Logout form not found');
$submitButton = $form->find('css', '[type=submit]');
$securityID = $form->find('css', '[name=SecurityID]');
assertNotNull($submitButton, 'Submit button on logout form not found');
assertNotNull($securityID, 'CSRF token not found');
$submitButton->press();
}
/**