private bool ShouldRestartBrowser(BrowserConfiguration browserConfiguration) { if (_previousBrowserConfiguration == null) { return(true); } bool shouldRestartBrowser = browserConfiguration.BrowserBehavior == BrowserBehavior.RestartEveryTime || browserConfiguration.Browser == Browser.NotSet; return(shouldRestartBrowser); }
private BrowserConfiguration GetBrowserConfiguration(MemberInfo memberInfo) { var result = new BrowserConfiguration(); var classBrowserType = GetExecutionBrowserClassLevel(memberInfo.DeclaringType); var methodBrowserType = GetExecutionBrowserMethodLevel(memberInfo); if (methodBrowserType != null) { result = methodBrowserType; } else if (classBrowserType != null) { result = classBrowserType; } return(result); }
public override void PreTestInit(TestContext context, MemberInfo memberInfo) { _currentBrowserConfiguration = GetBrowserConfiguration(memberInfo); bool shouldRestartBrowser = ShouldRestartBrowser(_currentBrowserConfiguration); if (shouldRestartBrowser) { RestartBrowser(); } else { _driver.DeleteAllCookies(); } _previousBrowserConfiguration = _currentBrowserConfiguration; }
public ExecutionBrowserAttribute(Browser browser, BrowserBehavior browserBehavior) { BrowserConfiguration = new BrowserConfiguration(browser, browserBehavior); }