Skip to content

Commit

Permalink
API Changes for Authenticator refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mooyman authored Jun 9, 2017
2 parents 47bebe6 + e40f0ee commit 4e0868e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Context/LoginContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,16 @@ public function stepILogInWith($email, $password)
$loginUrl = $c->joinUrlParts($c->getBaseUrl(), $c->getLoginUrl());
$this->getMainContext()->getSession()->visit($loginUrl);
$page = $this->getMainContext()->getSession()->getPage();
$forms = $page->findAll('xpath', '//form[contains(@action, "Security/LoginForm")]');
assertNotNull($forms, 'Login form not found');
$form = $page->findById('MemberLoginForm_LoginForm');
assertNotNull($form, 'Login form not found');

// Try to find visible forms again on login page.
$visibleForm = null;
/** @var NodeElement $form */
foreach ($forms as $form) {
if ($form->isVisible() && $form->find('css', '[name=Email]')) {
$visibleForm = $form;
}
if ($form->isVisible() && $form->find('css', '[name=Email]')) {
$visibleForm = $form;
}

assertNotNull($visibleForm, 'Could not find login form');
assertNotNull($visibleForm, 'Could not find login email field');

$emailField = $visibleForm->find('css', '[name=Email]');
$passwordField = $visibleForm->find('css', '[name=Password]');
Expand Down

0 comments on commit 4e0868e

Please sign in to comment.