Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Unit tests refactoring #158

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix code style
  • Loading branch information
Mikhail Tymchuk (DevExpress) committed Jun 30, 2016
commit a97a86ddd7f99222244ade48bcd6310ecb7175c0
28 changes: 14 additions & 14 deletions AjaxControlToolkit.Tests/JasmineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ namespace AjaxControlToolkit.Tests {
[TestFixture]
public class JasmineTests {

TimeSpan maxTimeout = TimeSpan.FromMinutes(4);
TimeSpan checkInterval = TimeSpan.FromSeconds(5);
string siteUrl;
string driverDir;
TimeSpan _maxTimeout = TimeSpan.FromMinutes(4);
TimeSpan _checkInterval = TimeSpan.FromSeconds(5);
string _siteUrl;
string _driverDir;

[SetUp]
public void Setup() {
siteUrl = Environment.GetEnvironmentVariable("AjaxControlToolkitTestSiteUrl");
_siteUrl = Environment.GetEnvironmentVariable("AjaxControlToolkitTestSiteUrl");

if(String.IsNullOrWhiteSpace(siteUrl))
siteUrl = "http://localhost/JasmineTests/TestRunner.aspx";
if(String.IsNullOrWhiteSpace(_siteUrl))
_siteUrl = "http://localhost/JasmineTests/TestRunner.aspx";

driverDir = GetDriverDirectory();
_driverDir = GetDriverDirectory();
}

static string GetDriverDirectory() {
Expand All @@ -34,14 +34,14 @@ static string GetDriverDirectory() {

[Test]
public void Chrome() {
var driver = new ChromeDriver(driverDir);
var driver = new ChromeDriver(_driverDir);

TestBrowser(driver);
}

[Test]
public void FireFox() {
var driverService = FirefoxDriverService.CreateDefaultService(driverDir, "geckodriver.exe");
var driverService = FirefoxDriverService.CreateDefaultService(_driverDir, "geckodriver.exe");
driverService.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
Expand All @@ -52,15 +52,15 @@ public void FireFox() {

[Test]
public void InternetExplorer() {
var driver = new InternetExplorerDriver(driverDir, new InternetExplorerOptions(), TimeSpan.FromMinutes(3));
var driver = new InternetExplorerDriver(_driverDir, new InternetExplorerOptions(), TimeSpan.FromMinutes(3));

TestBrowser(driver);
}

void TestBrowser(IWebDriver driver) {

try {
driver.Navigate().GoToUrl(siteUrl);
driver.Navigate().GoToUrl(_siteUrl);

var selectAllCheckbox = driver.FindElement(By.XPath("//label[text()='SELECT ALL']"));
selectAllCheckbox.Click();
Expand All @@ -74,8 +74,8 @@ void TestBrowser(IWebDriver driver) {
var stopwatch = new Stopwatch();
stopwatch.Start();

while(stopwatch.ElapsedMilliseconds < maxTimeout.TotalMilliseconds) {
Thread.Sleep(checkInterval);
while(stopwatch.ElapsedMilliseconds < _maxTimeout.TotalMilliseconds) {
Thread.Sleep(_checkInterval);
CheckTestResults(driver, currentSpecCount, totalSpecCount);
}

Expand Down