Created
October 5, 2018 08:22
-
-
Save alpap/a0761fc1b19b83dbca75e32b0b7c75f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using Bizzkit.PIM.EndToEndTests.Helper.SeleniumTests.Helper; | |
using Bizzkit.PIM.EndToEndTests.Pages; | |
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
namespace Bizzkit.PIM.EndToEndTests | |
{ | |
public class WebDriversCollection: IEnumerable<IWebDriver>, IDisposable | |
{ | |
private IWebDriver[] Drivers = Array.Empty<IWebDriver>(); | |
public void SetDrivers(IWebDriver[] drivers) | |
{ | |
Drivers = drivers; | |
} | |
public IEnumerator<IWebDriver> GetEnumerator() | |
{ | |
foreach(IWebDriver val in Drivers) | |
{ | |
yield return val; | |
} | |
} | |
IEnumerator IEnumerable.GetEnumerator() | |
{ | |
return GetEnumerator(); | |
} | |
public void Dispose() | |
{ | |
foreach(IWebDriver val in Drivers) | |
{ | |
val.Quit(); | |
} | |
} | |
} | |
[TestFixture] | |
public abstract class BaseET | |
{ | |
private static WebDriversCollection Drivers= new WebDriversCollection(); | |
[OneTimeSetUp] | |
public void SetUp() | |
{ | |
Drivers.SetDrivers(new [] | |
{ | |
SeleniumTestBase.Chrome(), | |
SeleniumTestBase.Chrome() | |
}); | |
} | |
[OneTimeTearDown] | |
public void TearDown() | |
{ | |
Drivers.Dispose(); | |
} | |
} | |
public class LoginPageTests:BaseET | |
{ | |
[Test] | |
[TestCaseSource(nameof(Drivers))] | |
public void LoginTest(IWebDriver driver) | |
{ | |
new PimLoginPage().Login(driver); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment