From e40f0ee764b2631cdb1b28b8431ab72cd0d7f2b8 Mon Sep 17 00:00:00 2001 From: Simon Erkelens Date: Sun, 4 Jun 2017 13:22:49 +1200 Subject: [PATCH] Update the login method to use findById and rename of the LoginForm to MemberLoginForm --- src/Context/LoginContext.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Context/LoginContext.php b/src/Context/LoginContext.php index e0bc3d9c..b6ce32cd 100644 --- a/src/Context/LoginContext.php +++ b/src/Context/LoginContext.php @@ -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]');