Hello Telerik Team
I'm automating WPF application with Telerik Testing Framework (2012_2_1204). Great framework!.
Shown in the attachment is DockPanel with 3 buttons inside. Buttons are shown on application based on business logic. Currently only Edit is shown. Other two buttons are hidden with Visibility=Collapsed. I want to verify that specific button is not shown on application window.
Having sample code structure:
Application:
namespace Test
{
public class AppName
{
public ArtOfTest.WebAii.Wpf.WpfApplication ApplicationWebAii { get; private set; }
public AppName(ArtOfTest.WebAii.Wpf.WpfApplication webAiiApp) { ApplicationWebAii = webAiiApp; }
public WindowName WindowName { get { return new WindowName(ApplicationWebAii.WaitForWindow("WindowName").Find); } }
}
}
Window class containing buttons. Buttons are located by exact XamlPath:
using ArtOfTest.WebAii.Controls.Xaml.Wpf;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.TestTemplates;
namespace Test
{
public class WindowName : XamlElementContainer
{
public WindowName(VisualFind find) : base(find) { }
public Button OK { get { return Get<Button>("XamlPath=/DockPanel[0]/Button[0]"); } }
public Button Edit { get { return Get<Button>("XamlPath=/DockPanel[0]/Button[1]"); } }
}
}
Trying to access button OK in my test class code: AppName.WindowName.OK gives exception:
Wait for condition has timed out:
at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
at ArtOfTest.WebAii.Silverlight.VisualWait.ForVisible(Int32 timeout)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get(XamlFindExpression expr, Boolean waitOnElement, Int32 timeout)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get(XamlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get[TControl](XamlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get[TControl](String[] clauses)
This exception is thrown after ~10 seconds and is in case of Visibility=Collapsed. If button is shown then there is no exception and element is located.
I'm handling this by
I wonder is this issue with Telerik Testing Framework or me using it incorrectly :-) Thanks for your support.
I'm automating WPF application with Telerik Testing Framework (2012_2_1204). Great framework!.
Shown in the attachment is DockPanel with 3 buttons inside. Buttons are shown on application based on business logic. Currently only Edit is shown. Other two buttons are hidden with Visibility=Collapsed. I want to verify that specific button is not shown on application window.
Having sample code structure:
Application:
namespace Test
{
public class AppName
{
public ArtOfTest.WebAii.Wpf.WpfApplication ApplicationWebAii { get; private set; }
public AppName(ArtOfTest.WebAii.Wpf.WpfApplication webAiiApp) { ApplicationWebAii = webAiiApp; }
public WindowName WindowName { get { return new WindowName(ApplicationWebAii.WaitForWindow("WindowName").Find); } }
}
}
Window class containing buttons. Buttons are located by exact XamlPath:
using ArtOfTest.WebAii.Controls.Xaml.Wpf;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.TestTemplates;
namespace Test
{
public class WindowName : XamlElementContainer
{
public WindowName(VisualFind find) : base(find) { }
public Button OK { get { return Get<Button>("XamlPath=/DockPanel[0]/Button[0]"); } }
public Button Edit { get { return Get<Button>("XamlPath=/DockPanel[0]/Button[1]"); } }
}
}
Trying to access button OK in my test class code: AppName.WindowName.OK gives exception:
Wait for condition has timed out:
at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
at ArtOfTest.WebAii.Silverlight.VisualWait.ForVisible(Int32 timeout)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get(XamlFindExpression expr, Boolean waitOnElement, Int32 timeout)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get(XamlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get[TControl](XamlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.XamlElementContainer.Get[TControl](String[] clauses)
This exception is thrown after ~10 seconds and is in case of Visibility=Collapsed. If button is shown then there is no exception and element is located.
I'm handling this by
"try {AppName.WindowName.OK} catch (System.Exception) {}
"
and if element is not found taking appropriate actions in catch. This work for me with the limitation that it slows down my test with 10 seconds for each hidden element invocation.I wonder is this issue with Telerik Testing Framework or me using it incorrectly :-) Thanks for your support.