new add series page automation

PageBase helper class.
This commit is contained in:
kayone
2013-11-17 19:34:31 -08:00
parent ff0785b8d1
commit b29b560b14
4 changed files with 150 additions and 15 deletions

View 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"));
}
}
}
}