79 lines
1.9 KiB
C#
79 lines
1.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using FluentAssertions;
|
|||
|
using NLog;
|
|||
|
using NLog.Config;
|
|||
|
using NLog.Targets;
|
|||
|
using NUnit.Framework;
|
|||
|
using NzbDrone.Common.EnvironmentInfo;
|
|||
|
using NzbDrone.Test.Common;
|
|||
|
using OpenQA.Selenium;
|
|||
|
using OpenQA.Selenium.Firefox;
|
|||
|
using OpenQA.Selenium.Support.UI;
|
|||
|
|
|||
|
namespace NzbDrone.Automation.Test
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
[AutomationTest]
|
|||
|
public abstract class AutomationTest
|
|||
|
{
|
|||
|
private NzbDroneRunner _runner;
|
|||
|
protected FirefoxDriver driver;
|
|||
|
|
|||
|
public AutomationTest()
|
|||
|
{
|
|||
|
new StartupArguments();
|
|||
|
|
|||
|
LogManager.Configuration = new LoggingConfiguration();
|
|||
|
var consoleTarget = new ConsoleTarget { Layout = "${level}: ${message} ${exception}" };
|
|||
|
LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget);
|
|||
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget));
|
|||
|
}
|
|||
|
|
|||
|
[SetUp]
|
|||
|
public void SmokeTestSetup()
|
|||
|
{
|
|||
|
driver = new FirefoxDriver();
|
|||
|
|
|||
|
_runner = new NzbDroneRunner();
|
|||
|
_runner.KillAll();
|
|||
|
_runner.Start();
|
|||
|
|
|||
|
|
|||
|
driver.Url = "http://localhost:8989";
|
|||
|
|
|||
|
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
|||
|
|
|||
|
wait.Until(d => d.FindElement(By.Id("x-toolbar")));
|
|||
|
|
|||
|
GetPageErrors().Should().BeEmpty();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected IEnumerable<string> GetPageErrors()
|
|||
|
{
|
|||
|
return driver.FindElements(By.CssSelector("#errors div"))
|
|||
|
.Select(e => e.Text);
|
|||
|
}
|
|||
|
|
|||
|
[TearDown]
|
|||
|
public void SmokeTestTearDown()
|
|||
|
{
|
|||
|
_runner.KillAll();
|
|||
|
//driver.Quit();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[TestFixture]
|
|||
|
public class MyAutoTest : AutomationTest
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void Test1()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|