Posted by VenDG on January 23, 2014 at 2:03pm
I have installed Behat on my pc and I am using the feature from the blackbox driver page @ http://dspeak.com/drupalextension/blackbox.html for my first Drupal site test.
Scenario 7 is failing:
Scenario: Error messages
# features\drupalcontext.feature:35
Given I am on "/user"
# FeatureContext::visit()
When I press "Log in"
# FeatureContext::pressButton()
Then I should see the error message "Password field is required"
# FeatureContext::assertErrorVisible()
The page 'https://drupal.org/user' does not contain any error messages
And I should not see the error message "Sorry, unrecognized username or pass
word" # FeatureContext::assertNotErrorVisible()
And I should see the following <error messages>
# FeatureContext::assertMultipleErrors()
| error messages |
| Username field is required |
| Password field is required |
And I should not see the following <error messages>
# FeatureContext::assertNotMultipleErrors()
| error messages
|
| Sorry, unrecognized username or password
|
| Unable to send e-mail. Contact the site administrator if the problem persists |This is my behat.yml file:
# behat.yml
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
base_url: https://drupal.org
goutte: ~
selenium2: ~
Drupal\DrupalExtension\Extension:
blackbox: ~
region_map:
footer: "#footer"
content: "#content"
header: "#header"
left header: "#header-left"
right header: "#header-right"
right sidebar: "#aside"
# https://drupal.org/node/2070849
selectors:
message_selector: '.messages'
error_message_selector: '.messages.messages-error'
success_message_selector: '.messages.messages-status'I see the expected error messages in the browser. If the failure was related to JavaScript then I would expect scenario 8 to fail also. What am I missing?
Thanks
Comments
Error message selector is wrong
The HTML code is the following:
<div class="messages error"><h2 class="element-invisible">Error message</h2>
<ul>
<li>Username field is required.</li>
<li>Password field is required.</li>
</ul>
</div>
Your correct setting is the following:
error_message_selector: '.messages.error'That was it
Thank you.
8 scenarios (8 passed)26 steps (26 passed)
I am now going to try the other two drivers.