API Changes for Authenticator refactor

This commit is contained in:
Damian Mooyman 2017-06-09 16:47:20 +12:00 committed by GitHub
commit 4e0868e68d

View File

@ -69,19 +69,16 @@ class LoginContext implements Context
$loginUrl = $c->joinUrlParts($c->getBaseUrl(), $c->getLoginUrl()); $loginUrl = $c->joinUrlParts($c->getBaseUrl(), $c->getLoginUrl());
$this->getMainContext()->getSession()->visit($loginUrl); $this->getMainContext()->getSession()->visit($loginUrl);
$page = $this->getMainContext()->getSession()->getPage(); $page = $this->getMainContext()->getSession()->getPage();
$forms = $page->findAll('xpath', '//form[contains(@action, "Security/LoginForm")]'); $form = $page->findById('MemberLoginForm_LoginForm');
assertNotNull($forms, 'Login form not found'); assertNotNull($form, 'Login form not found');
// Try to find visible forms again on login page. // Try to find visible forms again on login page.
$visibleForm = null; $visibleForm = null;
/** @var NodeElement $form */ /** @var NodeElement $form */
foreach ($forms as $form) { if ($form->isVisible() && $form->find('css', '[name=Email]')) {
if ($form->isVisible() && $form->find('css', '[name=Email]')) { $visibleForm = $form;
$visibleForm = $form;
}
} }
assertNotNull($visibleForm, 'Could not find login email field');
assertNotNull($visibleForm, 'Could not find login form');
$emailField = $visibleForm->find('css', '[name=Email]'); $emailField = $visibleForm->find('css', '[name=Email]');
$passwordField = $visibleForm->find('css', '[name=Password]'); $passwordField = $visibleForm->find('css', '[name=Password]');