I'm trying to create automated tests using NUnit and selenium, however I cannot get the SetUp and TearDown functions to work.
[Binding] [SetUpFixture]
public class AuthenticatorSteps
{
IWebDriver _driver;
WebDriverWait wait;
string username;
string password;
[SetUp]
public void SetUp()
{
_driver = new ChromeDriver();
wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
}
[TearDown]
public void TearDown()
{
_driver.Close();
}
[Given(@"I am on the site")]
public void GivenIAmOnTheSite()
{
_driver.Manage().Window.Maximize();
_driver.Navigate().GoToUrl("https://qa02-ukcasino.bedegaming.net");
wait.Until(x => x.FindElement(By.CssSelector(AuthenticatorElements.LoginButton)));
}
They just aren't being called at all. The code I'm using works if I put them inside the steps themselves, however that requires me to add a step eg. Then the browser should close, when I should be able to just use the TearDown function.