diff --git a/src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs b/src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs index a822947..d13889f 100644 --- a/src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs +++ b/src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs @@ -1,9 +1,7 @@ -using Unicorn.UI.Core.PageObject; - -namespace Unicorn.UI.Core.Controls.Interfaces.Typified +namespace Unicorn.UI.Core.Controls.Interfaces.Typified { /// - /// Interface for windows implementation. + /// Interface for windows implementation. /// Has definitions of basic methods and properties. /// public interface IWindow : IHasTitle diff --git a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs index 54b0010..a0b658e 100644 --- a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs +++ b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs @@ -1,4 +1,6 @@ using Unicorn.UI.Core.Controls; +using Unicorn.UI.Core.Controls.Interfaces; +using Unicorn.UI.Core.Controls.Interfaces.Typified; namespace Unicorn.UI.Core.Synchronization.Conditions { @@ -116,6 +118,16 @@ public static TTarget HasText(this TTarget element, string text) where public static TTarget ContainsText(this TTarget element, string textPart) where TTarget : class, IControl => (element as IControl).Text.Contains(textPart) ? element : null; + /// + /// Checks if element text has expected value. + /// + /// Target element type implementing + /// Target element + /// expected control value + /// element when control has expected value and null otherwise + public static TTarget HasValue(this TTarget element, string expectedValue) where TTarget : class, IControl, IHasValue => + (element as IHasValue).Value.Equals(expectedValue) ? element : null; + /// /// Checks if element text does not contain expected value. /// @@ -125,5 +137,23 @@ public static TTarget ContainsText(this TTarget element, string textPar /// element when text does not contain expected value and null otherwise public static TTarget DoesNotContainText(this TTarget element, string textPart) where TTarget : class, IControl => !(element as IControl).Text.Contains(textPart) ? element : null; + + /// + /// Checks if control has any items. + /// + /// Target element type implementing and + /// Target element + /// true when control has at leas one item and false otherwise + public static TTarget HasAtLeastOneItem(this TTarget element) where TTarget : class, IControl, IHasItems => + (element as IHasItems).Items.Count > 0 ? element : null; + + /// + /// Checks if data grid has any rows. + /// + /// Target element type implementing and + /// Target element + /// true when data grid has at leas one row and false otherwise + public static TTarget HasAtLeastOneRow(this TTarget element) where TTarget : class, IControl, IDataGrid => + (element as IDataGrid).RowsCount > 0 ? element : null; } }