Created
November 3, 2016 19:47
-
-
Save alnutile/4cef8b219877afa8acd0c2c6d5202c04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait LogInAs | |
{ | |
/** | |
* @Given I log in as behat user | |
*/ | |
public function logInAsBehat() | |
{ | |
$user = '[email protected]'; | |
$pass = env('BEHAT_PASSWORD'); | |
$this->loginForm($user, $pass); | |
} | |
/** | |
* @Given I log in as admin | |
*/ | |
public function logInAsAdmin() | |
{ | |
$user = '[email protected]'; | |
$pass = env('ADMIN_PASSWORD'); | |
$this->loginForm($user, $pass); | |
} | |
public function loginForm($user, $pass) | |
{ | |
/** | |
* if for any reason we are logged in still | |
*/ | |
$this->visit('/logout'); | |
sleep(1); | |
$this->visit('/login'); | |
sleep(2); | |
$this->fillField('email', $user); | |
$this->fillField('password', $pass); | |
$this->pressButton('Login'); | |
sleep(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment