Skip to content

Instantly share code, notes, and snippets.

@richsage
Created July 7, 2011 10:22
Show Gist options
  • Save richsage/1069251 to your computer and use it in GitHub Desktop.
Save richsage/1069251 to your computer and use it in GitHub Desktop.
Behat step for logging in
$steps->Given('/^I am logged into the admin area as rich_81$/', function($world) {
$session = $world->getSession();
$doc = $session->getPage();
// Ensure we're logged out for cases where the session isn't
// reset between Behat steps
$session->visit($world->locatePath("/admin/logout"));
$session->visit($world->locatePath("/admin"));
$doc->fillField("_username", "rich_81");
$doc->fillField("_password", "foobar");
$doc->clickButton("Log in");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment