Update logout step to use new logout form

This commit is contained in:
Loz Calver 2017-06-21 14:57:12 +01:00
parent 684608a241
commit 987a029b51

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();
}
/**