NSelene
NSelene copied to clipboard
Enhance error messages for failed search by condition in collection
Open("http://todomvc4tasj.herokuapp.com/");
S("#new-todo").SetValue("a").PressEnter();
S("#new-todo").SetValue("c").PressEnter();
SS("#todo-list>li").FindBy(Have.ExactText("b"))
.DoubleClick();
fails with
Result Message:
Test method Lesson1.TodoMVCTests.TestCommonTasksFlow threw exception: OpenQA.Selenium.WebDriverTimeoutException: Timed out after 4 seconds while waiting for condition: : NSelene.Conditions.Visible Expected: True Actual: False ---> OpenQA.Selenium.NotFoundException: element was not found by conditionNSelene.Conditions.ExactText Expected: contains b Actual: c
but should be something like:
... Expected: contains b Actual: [a, c]
Open("http://todomvc4tasj.herokuapp.com/");
S("#new-todo").SetValue("a").PressEnter();
S("#new-todo").SetValue("c").PressEnter();
SS("#todo-list>a").FindBy(Have.ExactText("b"))
.DoubleClick();
And for this should be something like:
... Expected: contains b Actual: []
fixed to:
OpenQA.Selenium.WebDriverTimeoutException :
Timed out after 0.25 seconds
while waiting entity with locator: By.Selene: (By.CssSelector: #todo-list>li).FindBy(ExactText is b)
for condition: Visible
Expected : True
Actual : False
----> OpenQA.Selenium.NotFoundException : element was not found in collection by condition ExactText is b
Actual : [a,c]
TODO: add test
enhanced a bit:
OpenQA.Selenium.WebDriverTimeoutException :
Timed out after 0.25 seconds
while waiting entity with locator: By.Selene: (By.CssSelector: #todo-list>li).FindBy(ExactText is b)
for condition: Visible
Expected : True
Actual : False
----> OpenQA.Selenium.NotFoundException : element was not found in collection by condition ExactText is b
Actual visible texts : [a,c]
Actual html elements : [<li class="active" data-index="0">
<div class="view">
<input class="toggle" type="checkbox">
<label>a</label>
<button class="destroy"></button>
</div>
<input class="edit">
</li>,<li class="active" data-index="1">
<div class="view">
<input class="toggle" type="checkbox">
<label>c</label>
<button class="destroy"></button>
</div>
<input class="edit">
</li>]