mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Update logout step to use new logout form
This commit is contained in:
parent
684608a241
commit
987a029b51
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user