In my Chai test, I have the following:
this.When(/^I click the (.*) button$/, function(button, next) {
element(by.xpath('//input[@value="Log Out"]')).click();
next();
});
I'm expecting this to FAIL because the text of my button is actually Log in
However, my test runs (before the browser is even displayed) and on the terminal I see:
Feature: Authentication
In order to protect the system
As an owner
I want to require authentication
Scenario: Require username features\general\authentication.feature:6
Given I am on the login page ...
When I do not enter a username ...
And I click the "Log in" button ...
Then I should receive a validation error "The Username field is required."
Scenario: Require password
Given I am on the login page ...
When I do not enter a password ...
And I click the "Log in" button ...
Then I should receive a validation error "The Password field is required."
2 scenarios (2 passed)
8 steps (8 passed)
0m00.014s
Then, I finally see the browser open and the tests start going through the browser.
At this point, I receive the error:
C:\Projects\NexusWeb\Develop\Nexus.Web\Nexus.Web.Tests\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
NoSuchElementError: No element found using locator: By.xpath("//input[@value=\"Log Out\"]")
This, of course is what I expect.
My questions...
- Why do I receive a report that 2 scenarios passed, when the browser has not even stepped through them yet?
- Why are they reporting passing when they both should fail?
Thanks.