mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
new add series page automation
PageBase helper class.
This commit is contained in:
100
src/NzbDrone.Automation.Test/PageModel/PageBase.cs
Normal file
100
src/NzbDrone.Automation.Test/PageModel/PageBase.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Remote;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
|
||||
namespace NzbDrone.Automation.Test.PageModel
|
||||
{
|
||||
public class PageBase
|
||||
{
|
||||
private readonly RemoteWebDriver _driver;
|
||||
|
||||
public PageBase(RemoteWebDriver driver)
|
||||
{
|
||||
_driver = driver;
|
||||
}
|
||||
|
||||
public IWebElement FindByClass(string className, int timeout = 5)
|
||||
{
|
||||
return Find(By.ClassName(className), timeout);
|
||||
}
|
||||
|
||||
public IWebElement Find(By by, int timeout = 5)
|
||||
{
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(timeout));
|
||||
return wait.Until(d => d.FindElement(by));
|
||||
}
|
||||
|
||||
|
||||
public void WaitForNoSpinner(int timeout = 20)
|
||||
{
|
||||
//give the spinner some time to show up.
|
||||
Thread.Sleep(100);
|
||||
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(timeout));
|
||||
wait.Until(d =>
|
||||
{
|
||||
try
|
||||
{
|
||||
IWebElement element = d.FindElement(By.Id("followingBalls"));
|
||||
return !element.Displayed;
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public IWebElement SeriesNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("Series"));
|
||||
}
|
||||
}
|
||||
|
||||
public IWebElement CalendarNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("Calendar"));
|
||||
}
|
||||
}
|
||||
|
||||
public IWebElement HistoryNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("History"));
|
||||
}
|
||||
}
|
||||
|
||||
public IWebElement MissingNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("Missing"));
|
||||
}
|
||||
}
|
||||
|
||||
public IWebElement SettingNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("Settings"));
|
||||
}
|
||||
}
|
||||
|
||||
public IWebElement SystemNavIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
return Find(By.LinkText("System"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user