symfony2 / behat / mink login troubles when testing in the browser

723 views Asked by At

I have troubles executing a behat/mink test routine in the browser. I have tried sahi and selenium divers, the result is the same:

I run the test, sahi opens the login modal-popup, but does not fill in username and password. Clicking "submit" does work again, but due to the missing username and password the user is not logged in ("wrong username/password" message is shown).

Now the questions:

  • Does anyone have an idea why this might happen and what I can do to get the issue fixed
  • Can someone tell me how to slow down execution in the browser (its very hard to follow)
  • Any more ideas on how to debug issues which occur during execution of the test scripts?

my feature step for loging in:

    /**
     * @Given /^I am logged in as "([^"]*)"$/
     */
    public function iAmLoggedInAs($username)
    {
        $user = $this->getUserFromUsername($username);
        $this->clickLink('Login');
        $this->fillField('_username',$user->getEmail());
        $this->fillField('_password','12341234');
        $this->pressButton('_submit');
        $this->loggedInUser = $user;
    }

html of the page:

http://pastebin.com/Mb5a0xnq

1

There are 1 answers

2
Inoryy On

Fields parameters should be either field labels (actual text, not id) or field names.

so solution to your problem is to either use:

$this->fillField('_username',$user->getEmail());
$this->fillField('_password','12341234');

or

$this->fillField('E-Mail',$user->getEmail());
$this->fillField('Passwort:','12341234');