public function VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.7
Same name and namespace in other branches
- 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword()
- 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword()
#varbase : To authenticate a user with a gavin username and password on the spot.
Example: I am a logged in user with the username "testing" and password "testing user password"
@Given /^I am a logged in user with (?:|the )username "(?P<username>[^"]*)" and password "(?P<password>[^"]*)"$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 87
Class
- VarbaseContext
- Defines application features from the specific context.
Code
public function iAmLoggedInUserWithTheUsernameAndPassword($username, $password) {
// Logout if I am logged in.
if ($this
->loggedIn()) {
$this
->logout();
}
// Login with the
$element = $this
->getSession()
->getPage();
$this
->getSession()
->visit($this
->locatePath('/user'));
$element
->fillField('edit-name', $username);
$element
->fillField('edit-pass', $password);
$submit = $element
->findButton('op');
$submit
->click();
}