mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Added automation tests
This commit is contained in:
parent
c7fed3e2d7
commit
6d30bea5c7
21 changed files with 1044 additions and 172 deletions
77
PlexRequestes.Automation.Helpers/DriverHelpers.cs
Normal file
77
PlexRequestes.Automation.Helpers/DriverHelpers.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
|
||||
using OpenQA.Selenium;
|
||||
|
||||
namespace PlexRequestes.Automation.Helpers
|
||||
{
|
||||
public static class DriverHelpers
|
||||
{
|
||||
public static bool Exists(this IWebElement element, bool preformAStringEmptyCheck)
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = element.Text;
|
||||
if (preformAStringEmptyCheck)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Exists(this IWebDriver driver, By locator, bool preformAStringEmptyCheck)
|
||||
{
|
||||
try
|
||||
{
|
||||
var element = driver.FindElement(locator);
|
||||
var text = element.Text;
|
||||
if (preformAStringEmptyCheck)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The exists.
|
||||
/// </summary>
|
||||
/// <param name="element">The element.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="bool" />.
|
||||
/// </returns>
|
||||
public static bool Exists(this IWebElement element)
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = element.Text;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue