mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #165 from kinglozzer/updated-logout-step
Update logout step to use new logout form
This commit is contained in:
commit
b020cf3426
@ -57,7 +57,21 @@ class LoginContext implements Context
|
|||||||
public function stepIAmNotLoggedIn()
|
public function stepIAmNotLoggedIn()
|
||||||
{
|
{
|
||||||
$c = $this->getMainContext();
|
$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