Can behat log in as an administrator for testing while using LDAP? I'm using the Behat Drupal Extension. When I try to run a behat test on a sandbox server, I see the following. I see that a temporary admin user is being create but it can't seem to log in. How might I remedy this so that behat can login? 

$ behat

Feature: First   Playing with features and exploring

  @api   Scenario: Run cron                                           
# features/first.feature:6
    Given I am logged in as a user with the "administrator" role # Drupal\DrupalExtension\Context\DrupalContext::assertAuthenticatedByRole()
      Failed to log in as user 'ss5vWjZY' with role 'administrator' (Exception)
    When I run cron                                              # Drupal\DrupalExtension\Context\DrupalContext::assertCron()
    And am on "admin/reports/dblog"                              # Drupal\DrupalExtension\Context\MinkContext::visit()
    Then I should see the link "Cron run completed"              # Drupal\DrupalExtension\Context\MinkContext::assertLinkVisible()


I've changed my LDAP configuration back to mixed mode:


  


And only admins are allowed to create a new account
I had this issue as well. It turned out to be a problem with LDAP. Switching to Mixed Mode allow the DrupalExtension to function properly. Since we don't want mixed by default, I added a pre-test setup function

public static function prepare($scope)
     {
        $data = array(
          'sids' =&gt; array (
            'directory' =&gt; 'directory',
          ),
          'authenticationMode' =&gt; 1,
          'loginConflictResolve' =&gt; 2,
          'acctCreation' =&gt; 4,
          'loginUIUsernameTxt' =&gt; NULL,
          'loginUIPasswordTxt' =&gt; NULL,
          'ldapUserHelpLinkUrl' =&gt; NULL,
          'ldapUserHelpLinkText' =&gt; 'Logon Help',
          'emailOption' =&gt; 3,
          'emailUpdate' =&gt; 1,
          'allowOnlyIfTextInDn' =&gt; array (),
          'excludeIfTextInDn' =&gt; array (),
          'allowTestPhp' =&gt; '',
          'excludeIfNoAuthorizations' =&gt; NULL,
          'ssoRemoteUserStripDomainName' =&gt; NULL,
          'seamlessLogin' =&gt; NULL,
          'ldapImplementation' =&gt; NULL,
          'cookieExpire' =&gt; NULL,

        );
        variable_set('ldap_authentication_conf', $data);
     }


The key is the line 'authenticationMode' =&gt; 1,