Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/Unicorn.UI.Core/Controls/Interfaces/Typified/IWindow.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Unicorn.UI.Core.PageObject;

namespace Unicorn.UI.Core.Controls.Interfaces.Typified
namespace Unicorn.UI.Core.Controls.Interfaces.Typified
{
/// <summary>
/// Interface for windows implementation.
/// Interface for windows implementation.
/// Has definitions of basic methods and properties.
/// </summary>
public interface IWindow : IHasTitle
Expand Down
30 changes: 30 additions & 0 deletions src/Unicorn.UI.Core/Synchronization/Conditions/Until.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -116,6 +118,16 @@ public static TTarget HasText<TTarget>(this TTarget element, string text) where
public static TTarget ContainsText<TTarget>(this TTarget element, string textPart) where TTarget : class, IControl =>
(element as IControl).Text.Contains(textPart) ? element : null;

/// <summary>
/// Checks if element text has expected value.
/// </summary>
/// <typeparam name="TTarget">Target element type implementing <see cref="IControl"/></typeparam>
/// <param name="element">Target element</param>
/// <param name="expectedValue">expected control value</param>
/// <returns><c>element</c> when control has expected value and <c>null</c> otherwise</returns>
public static TTarget HasValue<TTarget>(this TTarget element, string expectedValue) where TTarget : class, IControl, IHasValue =>
(element as IHasValue).Value.Equals(expectedValue) ? element : null;

/// <summary>
/// Checks if element text does not contain expected value.
/// </summary>
Expand All @@ -125,5 +137,23 @@ public static TTarget ContainsText<TTarget>(this TTarget element, string textPar
/// <returns><c>element</c> when text does not contain expected value and <c>null</c> otherwise</returns>
public static TTarget DoesNotContainText<TTarget>(this TTarget element, string textPart) where TTarget : class, IControl =>
!(element as IControl).Text.Contains(textPart) ? element : null;

/// <summary>
/// Checks if control has any items.
/// </summary>
/// <typeparam name="TTarget">Target element type implementing <see cref="IControl"/> and <see cref="IHasItems"/></typeparam>
/// <param name="element">Target element</param>
/// <returns><c>true</c> when control has at leas one item and <c>false</c> otherwise</returns>
public static TTarget HasAtLeastOneItem<TTarget>(this TTarget element) where TTarget : class, IControl, IHasItems =>
(element as IHasItems).Items.Count > 0 ? element : null;

/// <summary>
/// Checks if data grid has any rows.
/// </summary>
/// <typeparam name="TTarget">Target element type implementing <see cref="IControl"/> and <see cref="IDataGrid"/></typeparam>
/// <param name="element">Target element</param>
/// <returns><c>true</c> when data grid has at leas one row and <c>false</c> otherwise</returns>
public static TTarget HasAtLeastOneRow<TTarget>(this TTarget element) where TTarget : class, IControl, IDataGrid =>
(element as IDataGrid).RowsCount > 0 ? element : null;
}
}
Loading