From cffd45d1de44dbe201c64dadb8b2879758aad290 Mon Sep 17 00:00:00 2001 From: Vitaliy Dobriyan Date: Mon, 6 Jul 2026 00:31:34 +0300 Subject: [PATCH 1/3] added wait conditions for: having value, has any row, has any item --- .../Synchronization/Conditions/Until.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs index 54b0010..976c0ef 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.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 HasAnyItems(this TTarget element) where TTarget : class, IControl, IHasItems => + element.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 HasRows(this TTarget element) where TTarget : class, IControl, IDataGrid => + element.RowsCount > 0 ? element : null; } } From b7edf60c924766f932c3b8f8ac3993e6a54c60a8 Mon Sep 17 00:00:00 2001 From: Vitaliy Dobriyan Date: Mon, 6 Jul 2026 10:43:00 +0300 Subject: [PATCH 2/3] wait conditions fix --- src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs | 6 ++---- src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) 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 976c0ef..2d43b41 100644 --- a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs +++ b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs @@ -126,7 +126,7 @@ public static TTarget ContainsText(this TTarget element, string textPar /// 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.Value.Equals(expectedValue) ? element : null; + (element as IHasValue).Value.Equals(expectedValue) ? element : null; /// /// Checks if element text does not contain expected value. @@ -145,7 +145,7 @@ public static TTarget DoesNotContainText(this TTarget element, string t /// Target element /// true when control has at leas one item and false otherwise public static TTarget HasAnyItems(this TTarget element) where TTarget : class, IControl, IHasItems => - element.Items.Count > 0 ? element : null; + (element as IHasItems).Items.Count > 0 ? element : null; /// /// Checks if data grid has any rows. @@ -154,6 +154,6 @@ public static TTarget HasAnyItems(this TTarget element) where TTarget : /// Target element /// true when data grid has at leas one row and false otherwise public static TTarget HasRows(this TTarget element) where TTarget : class, IControl, IDataGrid => - element.RowsCount > 0 ? element : null; + (element as IDataGrid).RowsCount > 0 ? element : null; } } From e3c8da40db4a93bbc91b7856a510a76195bd0bc8 Mon Sep 17 00:00:00 2001 From: Vitaliy Dobriyan Date: Mon, 6 Jul 2026 11:08:05 +0300 Subject: [PATCH 3/3] renamed hasRows and HasAnyItems conditions --- src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs index 2d43b41..a0b658e 100644 --- a/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs +++ b/src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs @@ -144,7 +144,7 @@ public static TTarget DoesNotContainText(this TTarget element, string t /// Target element type implementing and /// Target element /// true when control has at leas one item and false otherwise - public static TTarget HasAnyItems(this TTarget element) where TTarget : class, IControl, IHasItems => + public static TTarget HasAtLeastOneItem(this TTarget element) where TTarget : class, IControl, IHasItems => (element as IHasItems).Items.Count > 0 ? element : null; /// @@ -153,7 +153,7 @@ public static TTarget HasAnyItems(this TTarget element) where TTarget : /// Target element type implementing and /// Target element /// true when data grid has at leas one row and false otherwise - public static TTarget HasRows(this TTarget element) where TTarget : class, IControl, IDataGrid => + public static TTarget HasAtLeastOneRow(this TTarget element) where TTarget : class, IControl, IDataGrid => (element as IDataGrid).RowsCount > 0 ? element : null; } }