-
-
Save testautomationtribe/5c235439c50ace62d0a56c99102d0a9f to your computer and use it in GitHub Desktop.
This file contains 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 NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
namespace TatAutomationFramework.Web | |
{ | |
/// <summary> | |
///TestBase.cs Version 1.0 | |
/// This attribute that marks a class that contains tests | |
/// and is inherited by any derived classes | |
/// This means we do not have to worry about this in our test classes | |
/// </summary> | |
[TestFixture] | |
public abstract class TestBase | |
{ | |
internal static IWebDriver driver; | |
///<summary> | |
///Run Before every Test and setup Tests. | |
///</summary> | |
[SetUp] | |
public void TestSetup() | |
{ | |
driver.Navigate().GoToUrl("http://127.0.0.1:4001/wordpress/"); | |
} | |
/// <summary> | |
/// Runs after every Test and Cleans up Test. | |
/// </summary> | |
[TearDown] | |
public void TestCleanUp() | |
{ | |
driver.Manage().Cookies.DeleteAllCookies(); | |
} | |
/// <summary> | |
/// Begin execution of tests | |
/// </summary> | |
public static void BeginExecution() | |
{ | |
driver = new ChromeDriver(); | |
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20)); | |
driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(20)); | |
driver.Manage().Window.Maximize(); | |
} | |
/// <summary> | |
/// Finish Execution of tests | |
/// </summary> | |
public static void ExitExecution() | |
{ | |
if (driver != null) | |
{ | |
driver.Quit(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment