mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-13 18:27:08 -07:00
added simple automation test.
This commit is contained in:
parent
4defc04026
commit
034f8e8dfd
14 changed files with 272 additions and 14 deletions
78
src/NzbDrone.Automation.Test/AutomationTest.cs
Normal file
78
src/NzbDrone.Automation.Test/AutomationTest.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue