diff --git a/Gruntfile.js b/Gruntfile.js index c8aa52b10..e7ce977e4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -186,11 +186,19 @@ module.exports = function (grunt) { files: '<%= handlebars.files.src %>', tasks: ['handlebars'] }, - copyContent : { - files: '<%= copy.content.cwd %><%= copy.content.src %>', + content : { + files: [ + '**/index.html', + '**/*.css', + '**/*.png', + '**/*.jpg', + '**/*.ico', + '**/FontAwesome/*.*', + '**/fonts/*.*' + ], tasks: ['copy:content'] }, - copyScripts: { + scripts: { files: '<%= copy.scripts.cwd %><%= copy.scripts.src %>', tasks: ['copy:scripts'] } diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs new file mode 100644 index 000000000..36f6050e1 --- /dev/null +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -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 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() + { + + } + } + +} diff --git a/src/NzbDrone.Automation.Test/AutomationTestAttribute.cs b/src/NzbDrone.Automation.Test/AutomationTestAttribute.cs new file mode 100644 index 000000000..d1cf9faec --- /dev/null +++ b/src/NzbDrone.Automation.Test/AutomationTestAttribute.cs @@ -0,0 +1,13 @@ +using NUnit.Framework; + +namespace NzbDrone.Automation.Test +{ + public class AutomationTestAttribute : CategoryAttribute + { + public AutomationTestAttribute() + : base("AutomationTest") + { + + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj new file mode 100644 index 000000000..d32d4c6aa --- /dev/null +++ b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {CC26800D-F67E-464B-88DE-8EB1A0C227A3} + Library + Properties + NzbDrone.Automation.Test + NzbDrone.Automation.Test + v4.0 + 512 + ..\ + true + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + False + ..\packages\FluentAssertions.2.1.0.0\lib\net40\FluentAssertions.dll + + + ..\packages\NLog.2.1.0\lib\net40\NLog.dll + + + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + + + + + + + ..\packages\Selenium.WebDriver.2.37.0\lib\net40\WebDriver.dll + + + ..\packages\Selenium.Support.2.37.0\lib\net40\WebDriver.Support.dll + + + + + + + + + + {F2BE0FDF-6E47-4827-A420-DD4EF82407F8} + NzbDrone.Common + + + {CADDFCE0-7509-4430-8364-2074E1EEFCA2} + NzbDrone.Test.Common + + + + + + + + + \ No newline at end of file diff --git a/src/NzbDrone.Automation.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Automation.Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..e99cbaa72 --- /dev/null +++ b/src/NzbDrone.Automation.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NzbDrone.Automation.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NzbDrone.Automation.Test")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6b8945f5-f5b5-4729-865d-f958fbd673d9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NzbDrone.Automation.Test/packages.config b/src/NzbDrone.Automation.Test/packages.config new file mode 100644 index 000000000..f51e94b57 --- /dev/null +++ b/src/NzbDrone.Automation.Test/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/NzbDrone.Integration.Test/IntegrationTest.cs b/src/NzbDrone.Integration.Test/IntegrationTest.cs index f8556a58d..fc412c174 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTest.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTest.cs @@ -8,6 +8,7 @@ using NzbDrone.Api.History; using NzbDrone.Api.RootFolders; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Integration.Test.Client; +using NzbDrone.Test.Common; using NzbDrone.Test.Common.Categories; using RestSharp; diff --git a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj index babcf6866..cfbad6bf6 100644 --- a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj @@ -108,7 +108,6 @@ - diff --git a/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj b/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj index 277bbae61..0c35b4049 100644 --- a/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj @@ -64,6 +64,10 @@ False ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + False + ..\packages\RestSharp.104.3.3\lib\net4\RestSharp.dll + @@ -82,6 +86,7 @@ + diff --git a/src/NzbDrone.Integration.Test/NzbDroneRunner.cs b/src/NzbDrone.Test.Common/NzbDroneRunner.cs similarity index 97% rename from src/NzbDrone.Integration.Test/NzbDroneRunner.cs rename to src/NzbDrone.Test.Common/NzbDroneRunner.cs index 318f6b01a..8622b6555 100644 --- a/src/NzbDrone.Integration.Test/NzbDroneRunner.cs +++ b/src/NzbDrone.Test.Common/NzbDroneRunner.cs @@ -1,17 +1,15 @@ using System; using System.Diagnostics; using System.IO; -using System.Linq; using System.Threading; using System.Xml.Linq; using System.Xml.XPath; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Processes; -using NzbDrone.Core.Configuration; using RestSharp; -namespace NzbDrone.Integration.Test +namespace NzbDrone.Test.Common { public class NzbDroneRunner { diff --git a/src/NzbDrone.Test.Common/packages.config b/src/NzbDrone.Test.Common/packages.config index 2ab611796..28a2e5f1d 100644 --- a/src/NzbDrone.Test.Common/packages.config +++ b/src/NzbDrone.Test.Common/packages.config @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/src/NzbDrone.sln b/src/NzbDrone.sln index f118155ff..d7333e186 100644 --- a/src/NzbDrone.sln +++ b/src/NzbDrone.sln @@ -1,5 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{57A04B72-8088-4F75-A582-1158CF8291F7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test.Common", "Test.Common", "{47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97}" @@ -58,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Host", "Host", "{486ADF86-D EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.SignalR", "NzbDrone.SignalR\NzbDrone.SignalR.csproj", "{7C2CC69F-5CA0-4E5C-85CB-983F9F6C3B36}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Automation.Test", "NzbDrone.Automation.Test\NzbDrone.Automation.Test.csproj", "{CC26800D-F67E-464B-88DE-8EB1A0C227A3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -278,6 +282,16 @@ Global {7C2CC69F-5CA0-4E5C-85CB-983F9F6C3B36}.Release|Mixed Platforms.Build.0 = Release|x86 {7C2CC69F-5CA0-4E5C-85CB-983F9F6C3B36}.Release|x86.ActiveCfg = Release|x86 {7C2CC69F-5CA0-4E5C-85CB-983F9F6C3B36}.Release|x86.Build.0 = Release|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Debug|Any CPU.ActiveCfg = Debug|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Debug|x86.ActiveCfg = Debug|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Debug|x86.Build.0 = Debug|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Release|Any CPU.ActiveCfg = Release|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Release|Mixed Platforms.Build.0 = Release|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Release|x86.ActiveCfg = Release|x86 + {CC26800D-F67E-464B-88DE-8EB1A0C227A3}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -291,6 +305,7 @@ Global {D18A5DEB-5102-4775-A1AF-B75DAAA8907B} = {57A04B72-8088-4F75-A582-1158CF8291F7} {CBF6B8B0-A015-413A-8C86-01238BB45770} = {57A04B72-8088-4F75-A582-1158CF8291F7} {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB} = {57A04B72-8088-4F75-A582-1158CF8291F7} + {CC26800D-F67E-464B-88DE-8EB1A0C227A3} = {57A04B72-8088-4F75-A582-1158CF8291F7} {FAFB5948-A222-4CF6-AD14-026BE7564802} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97} {CADDFCE0-7509-4430-8364-2074E1EEFCA2} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97} {6BCE712F-846D-4846-9D1B-A66B858DA755} = {F9E67978-5CD6-4A5F-827B-4249711C0B02} diff --git a/src/UI/Instrumentation/ErrorHandler.js b/src/UI/Instrumentation/ErrorHandler.js index 80fc27441..d55c10735 100644 --- a/src/UI/Instrumentation/ErrorHandler.js +++ b/src/UI/Instrumentation/ErrorHandler.js @@ -4,6 +4,10 @@ window.Messenger().post(message); }; + var addError = function(message){ + window.$('#errors').append('
' + message + '
'); + }; + window.onerror = function (msg, url, line) { try { @@ -28,6 +32,8 @@ window.Messenger().post(message); + addError(message.message); + } catch (error) { console.log('An error occurred while reporting error. ' + error); @@ -58,22 +64,23 @@ if (xmlHttpRequest.status === 0 && xmlHttpRequest.readyState === 0) { return false; - //message.message = 'NzbDrone Server Not Reachable. make sure NzbDrone is running.'; } - else if (xmlHttpRequest.status === 400 && ajaxOptions.isValidatedCall) { + + if (xmlHttpRequest.status === 400 && ajaxOptions.isValidatedCall) { return false; } - else if (xmlHttpRequest.status === 503) { + if (xmlHttpRequest.status === 503) { message.message = xmlHttpRequest.responseJSON.message; } - else - { + else { message.message = '[{0}] {1} : {2}'.format(ajaxOptions.type, xmlHttpRequest.statusText, ajaxOptions.url); } window.Messenger().post(message); + addError(message.message); + return false; }); diff --git a/src/UI/index.html b/src/UI/index.html index 5af3cf1a8..515edecb9 100644 --- a/src/UI/index.html +++ b/src/UI/index.html @@ -61,7 +61,8 @@ - +
+