Skip to content

Commit

Permalink
Changed test to assert timeout is thrown #56
Browse files Browse the repository at this point in the history
  • Loading branch information
mtscout6 committed Feb 27, 2014
1 parent ed9ce7d commit 5020110
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Expand Up @@ -42,5 +42,22 @@ public void ValidationElementHandlerEnterDataWithWait(string name, int min, int
StoryTellerAssert.Fail(stopwatch.ElapsedMilliseconds < min, "Handler was faster than expected actual elapsed milliseconds {0}".ToFormat(stopwatch.ElapsedMilliseconds));
StoryTellerAssert.Fail(stopwatch.ElapsedMilliseconds > max, "Handler was slower than expected actual elapsed milliseconds {0}".ToFormat(stopwatch.ElapsedMilliseconds));
}

[FormatAs("Entering text into validation field {name} waits so long that it times out and fails")]
public void ValidationElementHandlerEnterDataWithWaitFailsWithTimeout(string name)
{
try
{
var element = Driver.FindElement(By.CssSelector("input[name=\"{0}\"]".ToFormat(name)));
ElementHandlers.FindHandler(element).EnterData(Driver, element, "Some text");
}
catch (StorytellerAssertionException ex)
{
StoryTellerAssert.Fail(!ex.Message.Contains("took longer than expected"), "Failed to enter data for some reason other than a timeout") ;
return;
}

StoryTellerAssert.Fail("Did not timeout when waiting for validation (For some reason this will fail on the Storyteller UI but not in the st runner)");
}
}
}
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<Test name="ValidationElementHandler waits for validation to complete before proceeding" lifecycle="Acceptance">
<Test name="ValidationElementHandler waits for validation to complete before proceeding" lifecycle="Regression">
<ValidationElementHandler>
<ValidationElementHandlerEnterDataWithWait isStep="True" name="AjaxValueFast" min="0" max="1000" />
<ValidationElementHandlerEnterDataWithWait isStep="True" name="AjaxValueSlow" min="3000" max="4000" />
<ValidationElementHandlerEnterDataWithWait isStep="True" name="AjaxValueReallySlow" min="10000" max="11000" />
<ValidationElementHandlerEnterDataWithWait isStep="True" name="SynchronousValue" min="0" max="1000" />
<ValidationElementHandlerEnterDataWithWaitFailsWithTimeout isStep="True" name="AjaxValueReallySlow" />
</ValidationElementHandler>
</Test>
</Test>

0 comments on commit 5020110

Please sign in to comment.