fixup! Ensure Lidarr process is killed, exptend process start time

browserstack-automation-testing
Qstick 5 years ago
parent ebf0174e00
commit 3ce4ec5cf9

@ -25,6 +25,15 @@ namespace NzbDrone.Automation.Test
public AutomationTest() public AutomationTest()
{ {
string username = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME");
string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY");
string testType = this.GetType().Name;
if (username.IsNotNullOrWhiteSpace() && accessKey.IsNotNullOrWhiteSpace() && !testType.Contains("BrowserStack"))
{
Assert.Ignore("BrowserStack Tests Enabled, Don't Run Normal Automation Tests");
}
new StartupContext(); new StartupContext();
LogManager.Configuration = new LoggingConfiguration(); LogManager.Configuration = new LoggingConfiguration();
@ -36,14 +45,6 @@ namespace NzbDrone.Automation.Test
[OneTimeSetUp] [OneTimeSetUp]
public virtual void SmokeTestSetup() public virtual void SmokeTestSetup()
{ {
string username = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME");
string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY");
if (username.IsNotNullOrWhiteSpace() && accessKey.IsNotNullOrWhiteSpace())
{
Assert.Ignore("BrowserStack Tests Enabled, Don't Run Normal Automation Tests");
}
var options = new FirefoxOptions(); var options = new FirefoxOptions();
options.AddArguments("--headless"); options.AddArguments("--headless");
driver = new FirefoxDriver(options); driver = new FirefoxDriver(options);

@ -19,10 +19,14 @@ using OpenQA.Selenium.Remote;
namespace NzbDrone.Automation.Test namespace NzbDrone.Automation.Test
{ {
[TestFixture] [TestFixture("", "Windows", "10", "Chrome", "63", 9901)]
[AutomationTest] [TestFixture("", "Windows", "10", "Firefox", "67", 9902)]
[TestFixture("", "Windows", "10", "Edge", "18", 9903)]
[TestFixture("", "OS X", "Mojave", "Safari", "12.1", 9904)]
// [TestFixture("iPhone X", "", "11", "iPhone", "", 9905)]
// [TestFixture("Samsung Galaxy S9 Plus", "", "9.0", "android", "", 9906)]
[Parallelizable(ParallelScope.Fixtures)] [Parallelizable(ParallelScope.Fixtures)]
public abstract class BrowserStackAutomationTest : MainPagesTest public class BrowserStackAutomationTest : MainPagesTest
{ {
protected string browser; protected string browser;
protected string browserVersion; protected string browserVersion;
@ -77,7 +81,7 @@ namespace NzbDrone.Automation.Test
capabilities.SetCapability("browserstack.localIdentifier", browserstackLocalIdentifier); capabilities.SetCapability("browserstack.localIdentifier", browserstackLocalIdentifier);
capabilities.SetCapability("browserstack.debug", "true"); capabilities.SetCapability("browserstack.debug", "true");
capabilities.SetCapability("browserstack.console", "verbose"); capabilities.SetCapability("browserstack.console", "verbose");
capabilities.SetCapability("name", "Functional Tests: " + serverOs + " - " + browser); capabilities.SetCapability("name", string.Format("Functional Tests: {0} - {1}", serverOs, browser));
capabilities.SetCapability("project", "Lidarr"); capabilities.SetCapability("project", "Lidarr");
capabilities.SetCapability("build", buildName); capabilities.SetCapability("build", buildName);
@ -125,7 +129,12 @@ namespace NzbDrone.Automation.Test
public override void SmokeTestTearDown() public override void SmokeTestTearDown()
{ {
driver?.Quit(); driver?.Quit();
_browserStackLocalProcess?.Kill();
if (_browserStackLocalProcess != null && !_browserStackLocalProcess.HasExited)
{
_browserStackLocalProcess.Kill();
}
_runner?.Kill(); _runner?.Kill();
} }
@ -178,9 +187,9 @@ namespace NzbDrone.Automation.Test
} }
}); });
if (!processStarted.Wait(5000)) if (!processStarted.Wait(10000))
{ {
Assert.Fail("Failed to start browserstack within 5 sec"); Assert.Fail("Failed to start browserstack within 10 sec");
} }
TestContext.Progress.WriteLine($"Successfully started browserstacklocal pid {process.Id}"); TestContext.Progress.WriteLine($"Successfully started browserstacklocal pid {process.Id}");

@ -1,18 +0,0 @@
using NUnit.Framework;
namespace NzbDrone.Automation.Test
{
[TestFixture("", "Windows", "10", "Chrome", "63", 9901)]
[TestFixture("", "Windows", "10", "Firefox", "67", 9902)]
[TestFixture("", "Windows", "10", "Edge", "18", 9903)]
[TestFixture("", "OS X", "Mojave", "Safari", "12.1", 9904)]
// [TestFixture("iPhone X", "", "11", "iPhone", "", 9905)]
// [TestFixture("Samsung Galaxy S9 Plus", "", "9.0", "android", "", 9906)]
public class BrowserStackFixture : BrowserStackAutomationTest
{
public BrowserStackFixture(string device, string os, string osVersion, string browser, string browserVersion, int port) :
base(device, os, osVersion, browser, browserVersion, port)
{
}
}
}

@ -50,7 +50,7 @@ namespace NzbDrone.Automation.Test.PageModel
{ {
try try
{ {
IWebElement element = d.FindElement(By.Id("followingBalls")); IWebElement element = d.FindElement(By.CssSelector("div[class*='LoadingIndicator']"));
return !element.Displayed; return !element.Displayed;
} }
catch (NoSuchElementException) catch (NoSuchElementException)

Loading…
Cancel
Save