I am just getting started with BeHat and I’m able to successfully run tests that do not require authentication. But, anything that requires authentication is failing.
STATEMENT (or any logged in statement)
Fails with ERROR MESSAGE .
But, if I add ‘not-logged-in’ as a possible class for logged in, then the test passes. This tells me that I am not successfully logging in with my tests. The test is actually finding a class ‘not-logged-in’ when it is testing to see if it’s logged in.
I am getting email notification that a user has been created when the test runs. So, I know that a user is being created, but not successfully logging in.
Feature: Authentication In order to make sure Behaviour testing is working As a behat test user I want to make sure I can log in Scenario: Anonymous access Given I am on the homepage Then I should see "Login" @api Scenario: Test Being Logged In Given I am logged in as a user with the "administrator" role Then I should see the link "Test Link"
My behat.yml file looks like this:
default: suites: default: contexts: - FeatureContext - DrupalDrupalExtensionContextDrupalContext - DrupalDrupalExtensionContextMinkContext extensions: BehatMinkExtension: goutte: ~ selenium2: ~ base_url: http://mysite.localhost DrupalDrupalExtension: blackbox: ~ api_driver: 'drupal' drush: alias: 'local' drupal: drupal_root: '/Users/myfolder/sites/mysite' region_map: footer: "#footer"