I am a newbie to Protractor.NET and I apologize if it is a layman question.
I am testing my AngularJs application using Protractor.NET. I have written multiple Test scenarios in C#. But for each and every test which is executed, the Protractor loads the Browser again and again and closes/quits it. Is it possible to avoid this?? and just load the browser only once and with that instance let my test scenario executes.
Is that possible to achieve?
[TestClass]
public class BaseTest
{
    protected IWebDriver _driver;
    protected NgWebDriver _ngWebDriver;
    [TestInitialize]
    public void Setup()
    {
        var key = ConfigurationManager.AppSettings["key"];
        _driver = new ChromeDriver(key);
        _driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
        _ngWebDriver = new NgWebDriver(_driver);
    }
    [TestCleanup]
    public void Teardown()
    {
        _ngWebDriver.Quit();
    }
}
If I comment out the [TestCleanup] method, the browser does not close and new instances are created. I just need to use a single instance and execute my test cases.
Yes. Just use the [ClassInitialize] and [ClassCleanup] attributes instead of [TestInitialize] and [TestCleanup].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With