mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-06-26 06:29:27 +02:00
Behat: More informative error on login form not found
"setValue() on a non-object" wasn't very helpful
This commit is contained in:
parent
b8915d8a80
commit
71245ababd
|
@ -122,12 +122,20 @@ class LoginContext extends BehatContext
|
||||||
|
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
|
|
||||||
|
$form = $page->find('css', 'form[action="Security/LoginForm"]');
|
||||||
|
assertNotNull($form, 'Login form not found');
|
||||||
|
|
||||||
$emailField = $page->find('css', '[name=Email]');
|
$emailField = $page->find('css', '[name=Email]');
|
||||||
$passwordField = $page->find('css', '[name=Password]');
|
$passwordField = $page->find('css', '[name=Password]');
|
||||||
$submit_button = $page->find('css', '[type=submit]');
|
$submitButton = $page->find('css', '[type=submit]');
|
||||||
|
|
||||||
|
assertNotNull($emailField, 'Email field on login form not found');
|
||||||
|
assertNotNull($passwordField, 'Password field on login form not found');
|
||||||
|
assertNotNull($submitButton, 'Submit button on login form not found');
|
||||||
|
|
||||||
$emailField->setValue($email);
|
$emailField->setValue($email);
|
||||||
$passwordField->setValue($password);
|
$passwordField->setValue($password);
|
||||||
$submit_button->press();
|
$submitButton->press();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user