From 50201104589979b70d20d463dc9392a1fa734fa9 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 27 Feb 2014 14:15:07 -0700 Subject: [PATCH] Changed test to assert timeout is thrown #56 --- .../Fixtures/ValidationElementHandlerFixture.cs | 17 +++++++++++++++++ ...validation_to_complete_before_proceeding.xml | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/FubuMVC.Validation.StoryTeller/Fixtures/ValidationElementHandlerFixture.cs b/src/FubuMVC.Validation.StoryTeller/Fixtures/ValidationElementHandlerFixture.cs index 0ecf529..43ba57d 100644 --- a/src/FubuMVC.Validation.StoryTeller/Fixtures/ValidationElementHandlerFixture.cs +++ b/src/FubuMVC.Validation.StoryTeller/Fixtures/ValidationElementHandlerFixture.cs @@ -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)"); + } } } \ No newline at end of file diff --git a/src/FubuMVC.Validation.StoryTeller/Tests/ValidationElementHandler/ValidationElementHandler_waits_for_validation_to_complete_before_proceeding.xml b/src/FubuMVC.Validation.StoryTeller/Tests/ValidationElementHandler/ValidationElementHandler_waits_for_validation_to_complete_before_proceeding.xml index e86da32..1e4707d 100644 --- a/src/FubuMVC.Validation.StoryTeller/Tests/ValidationElementHandler/ValidationElementHandler_waits_for_validation_to_complete_before_proceeding.xml +++ b/src/FubuMVC.Validation.StoryTeller/Tests/ValidationElementHandler/ValidationElementHandler_waits_for_validation_to_complete_before_proceeding.xml @@ -1,9 +1,9 @@ - + - + - \ No newline at end of file +