Error when invoking Click, on Button with parameters

May 6, 2011 at 7:43 PM

I have a WPF MVVM application that has a button I am trying to test.  I find the button and test its attributes.  This all passes just fine.  Then I have white click it.  While you are watching this run it all looks fine.  The button is clicked and the view loads in the content control just like it is supposed to.  The problem is that white does not seem to notice that everything is fine and errors out.  To test what was going on I added some more clicks after the first one and it never gets to those.  I am running this in Gallio test runner with mbUnit.

Snippet of code:
 Dim SearchCriteria As SearchCriteria = SearchCriteria.ByAutomationId("TransactionsButton")
 Dim EmployeeNamesListBox As Button = _MainWindow.Main.Get(Of Button)(SearchCriteria)
 Assert.IsNotNull(EmployeeNamesListBox, "can't find button with name: {0}", EmployeeNamesListBox)
 Assert.IsTrue(EmployeeNamesListBox.Visible, "Button with name {0} should be visible", EmployeeNamesListBox)
 Assert.IsTrue(EmployeeNamesListBox.Enabled, "Button with name {0} should be enabled", EmployeeNamesListBox)

 EmployeeNamesListBox.Click()

 _MainWindow.ShowListOfEmployeesButton.Click()
 _MainWindow.CafeteriaImportRegisterTransactionsButton.Click()

Gallio Test Runner Report:
ConsoleOutput
[2011-05-06 13:16:16,741][INFO ] Using BusyTimeout=5000 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using WaitBasedOnHourGlass=True for White/Core
[2011-05-06 13:16:16,772][INFO ] Using WorkSessionLocation=. for White/Core
[2011-05-06 13:16:16,772][INFO ] Using UIAutomationZeroWindowBugTimeout=5000 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using PopupTimeout=5000 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using TooltipWaitTime=0 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using SuggestionListTimeout=3000 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using DefaultDateFormat=Month,Day,Year for White/Core
[2011-05-06 13:16:16,772][INFO ] Using DragStepCount=1 for White/Core
[2011-05-06 13:16:16,772][INFO ] Using InProc=False for White/Core
[2011-05-06 13:16:16,772][INFO ] Using ComboBoxItemsPopulatedWithoutDropDownOpen=True for White/Core
[2011-05-06 13:16:16,772][INFO ] Using RawElementBasedSearch=False for White/Core
[2011-05-06 13:16:16,772][INFO ] Using MaxElementSearchDepth=10 for White/Core
Using RecheckDurationInMilliseconds=100 for Bricks/Bricks
[2011-05-06 13:16:16,929][INFO ] Using TableVerticalScrollBar=Vertical Scroll Bar for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableHorizontalScrollBar=Horizontal Scroll Bar for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableColumn=Row  for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableTopLeftHeaderCell=Top Left Header Cell for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableCellNullValue=(null) for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableHeader=Top Row for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using HorizontalScrollBar=Horizontal ScrollBar for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using VerticalScrollBar=Vertical ScrollBar for White/UIItemId
[2011-05-06 13:16:16,929][INFO ] Using TableCellPrefix= Row  for White/UIItemId
[2011-05-06 13:16:27,256][ERROR] Error when invoking Click, on Button with parameters:

Failures
Execute
Bricks.BricksException: Error invoking Button.Click ---> White.Core.UIItems.UIActionException: Window in still wait mode. Cursor: White.Core.InputDevices.MouseCursor, after waiting for 5000 ms
   at White.Core.UIItems.Actions.Action.<Handle>b__2() in c:\white\Core\UIItems\Actions\Action.cs:line 35
   at Bricks.Core.Clock.Perform(Do do, Matched matched, Expired expired) in C:\bricks\Bricks\Core\Clock.cs:line 44
   at White.Core.UIItems.Actions.Action.Handle(Window window) in c:\white\Core\UIItems\Actions\Action.cs:line 36
   at White.Core.UIItems.WindowItems.Window.ActionPerformed(Action action) in c:\white\Core\UIItems\WindowItems\Window.cs:line 185
   at White.Core.InputDevices.Mouse.ActionPerformed(ActionListener actionListener) in c:\white\Core\InputDevices\Mouse.cs:line 156
   at White.Core.InputDevices.Mouse.Click(Point point, ActionListener actionListener) in c:\white\Core\InputDevices\Mouse.cs:line 151
   at White.Core.UIItems.UIItem.PerformClick() in c:\white\Core\UIItems\UIItem.cs:line 222
   at White.Core.UIItems.UIItem.Click() in c:\white\Core\UIItems\UIItem.cs:line 216
   --- End of inner exception stack trace ---
   at Bricks.RuntimeFramework.ReflectedObject.Invoke(MethodInfo methodInfo, Object[] arguments) in C:\bricks\Bricks.RuntimeFramework\ReflectedObject.cs:line 69
   at Bricks.DynamicProxy.DynamicProxyInterceptors.Process(IInvocation invocation, InterceptContext interceptedContext) in C:\bricks\Bricks\DynamicProxy\DynamicProxyInterceptors.cs:line 20
   at White.Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in c:\white\Core\Interceptors\CoreInterceptor.cs:line 30
   at Castle.DynamicProxy.AbstractInvocation.Proceed() in d:\OSS\Castle\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs:line 165
   at ButtonProxy92bc18f267374143a7a6a1758aaa774b.Click()
   at KCafeDotNet.UITesting.MainWindow.Test() in C:\KMM_VisualStudio\K CAFE\KCafe_WorkingDirectory\KCafeWPF\Code\KCafeDotNet.UITesting\MainWindow.vb:line 44

May 9, 2011 at 6:47 AM

Hi


the exception says the window is busy, have you tried to wait still window is active again?

 

Throndorin

May 10, 2011 at 1:07 PM

I tried this:

Dim _testmain As Window = _app.GetWindow("Window", InitializeOption.NoCache)
_testmain.WaitWhileBusy()
Dim TestSearchCriteria As SearchCriteria = SearchCriteria.ByAutomationId("TransactionsButton")
Dim TestButton As Button = _testmain.Get(Of Button)(TestSearchCriteria)
TestButton.Click()

 The App opens,  The button is clicked, The View shows up, and then the application sits and waits until it times out and closes.  I added wait cursors but white never seems to notice that the view is done loading.  The view only takes a part of a second to load.  It is so fast that I can barely see the wait cursor flash on the screen.

May 10, 2011 at 2:03 PM

 

have a look in the  configuration file of your application, have you set the configuration settings as described here

 

try increase Busytimeout

 

Throndorin