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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ msbuild.wrn
.vs/

Log/
VisualDumps/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ public interface IVisualizationConfiguration
/// Height of the image resized for comparison.
/// </summary>
int ComparisonHeight { get; }

/// <summary>
/// Path used to save and load page dumps.
/// </summary>
string PathToDumps { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aquality.Selenium.Core.Utilities;
using System.IO;

namespace Aquality.Selenium.Core.Configurations
{
Expand All @@ -24,5 +25,14 @@ public VisualizationConfiguration(ISettingsFile settingsFile)
public int ComparisonWidth => settingsFile.GetValueOrDefault(".visualization.comparisonWidth", 16);

public int ComparisonHeight => settingsFile.GetValueOrDefault(".visualization.comparisonHeight", 16);

public string PathToDumps
{
get
{
var pathInConfiguration = settingsFile.GetValueOrDefault(".visualization.pathToDumps", "../../../Resources/VisualDumps/");
return pathInConfiguration.Contains(".") ? Path.GetFullPath(pathInConfiguration) : pathInConfiguration;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aquality.Selenium.Core.Elements.Interfaces;
using Aquality.Selenium.Core.Logging;
using Aquality.Selenium.Core.Waitings;
using OpenQA.Selenium;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Aquality.Selenium.Core.Elements
/// </summary>
public abstract class Element : IElement
{
private readonly ElementState elementState;
internal readonly ElementState elementState;
private IElementCacheHandler elementCacheHandler;

protected Element(By locator, string name, ElementState state)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aquality.Selenium.Core.Elements.Interfaces;
using Aquality.Selenium.Core.Logging;
using Aquality.Selenium.Core.Waitings;
using OpenQA.Selenium;
using System;
Expand Down Expand Up @@ -33,22 +34,22 @@ public ElementStateProvider(By elementLocator, IConditionalWait conditionalWait,

public bool WaitForDisplayed(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => IsAnyElementFound(timeout, ElementState.Displayed), "displayed");
return DoAndLogWaitForState(() => IsAnyElementFound(timeout, ElementState.Displayed), "displayed", timeout);
}

public bool WaitForNotDisplayed(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => ConditionalWait.WaitFor(() => !IsDisplayed, timeout), "not.displayed");
return DoAndLogWaitForState(() => ConditionalWait.WaitFor(() => !IsDisplayed, timeout), "not.displayed", timeout);
}

public bool WaitForExist(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => IsAnyElementFound(timeout, ElementState.ExistsInAnyState), "exist");
return DoAndLogWaitForState(() => IsAnyElementFound(timeout, ElementState.ExistsInAnyState), "exist", timeout);
}

public bool WaitForNotExist(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => ConditionalWait.WaitFor(() => !IsExist, timeout), "not.exist");
return DoAndLogWaitForState(() => ConditionalWait.WaitFor(() => !IsExist, timeout), "not.exist", timeout);
}

private bool IsAnyElementFound(TimeSpan? timeout, ElementState state)
Expand All @@ -58,12 +59,12 @@ private bool IsAnyElementFound(TimeSpan? timeout, ElementState state)

public bool WaitForEnabled(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => IsElementInDesiredState(element => IsElementEnabled(element), "ENABLED", timeout), "enabled");
return DoAndLogWaitForState(() => IsElementInDesiredState(element => IsElementEnabled(element), "ENABLED", timeout), "enabled", timeout);
}

public bool WaitForNotEnabled(TimeSpan? timeout = null)
{
return DoAndLogWaitForState(() => IsElementInDesiredState(element => !IsElementEnabled(element), "NOT ENABLED", timeout), "not.enabled");
return DoAndLogWaitForState(() => IsElementInDesiredState(element => !IsElementEnabled(element), "NOT ENABLED", timeout), "not.enabled", timeout);
}

protected virtual bool IsElementEnabled(IWebElement element)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenQA.Selenium;
using Aquality.Selenium.Core.Visualization;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using System;

Expand Down Expand Up @@ -27,6 +28,11 @@ public interface IElement : IParent
/// <value>Instance of <see cref="IElementStateProvider"/></value>
IElementStateProvider State { get; }

/// <summary>
/// Gets element visual state.
/// </summary>
IVisualStateProvider Visual { get; }

/// <summary>
/// Finds current element by specified <see cref="Locator"/>
/// </summary>
Expand All @@ -43,7 +49,7 @@ public interface IElement : IParent
/// <summary>
/// Gets element attribute value by its name.
/// </summary>
/// <param name="attr">Name of attrbiute</param>
/// <param name="attr">Name of attribute</param>
/// <returns>Value of element attribute.</returns>
string GetAttribute(string attr);

Expand Down
Loading