public virtual void SetUp()
 {
     Log4NetConfiguration.InitializeOnce();
     WebDriverCache.RestartIfNeed();
     WebDriverCache.WebDriver.DeleteAllCookies();
     WebDriverCache.WebDriver.CleanDownloadDirectory();
     PageLoadCounter.Reset();
     JsLogger.Reset();
 }
Пример #2
0
        public TPage GoTo <TPage>(int pageLoads = 1) where TPage : PageBase, new()
        {
            return(PageTimeStatistics.Instance.InvolveAction(typeof(TPage), () =>
            {
                VerifyPageIsAlive();
                PageLoadCounter.WaitPageLoaded(pageLoads, WaitPageLoadTimeout);
                CleanFields(this);
                var newPage = new TPage();
                newPage.BrowseWaitVisible();
//                InitPage();
                return newPage;
            }));
        }
Пример #3
0
        public static TPage GoToUri <TPage>(Uri uri) where TPage : PageBase, new()
        {
            return(PageTimeStatistics.Instance.InvolveAction(typeof(TPage), () =>
            {
                WebDriverCache.WebDriver.GoToUri(uri);
//                PageLoadCounter.InitPageLoadCounterCookie();
                PageLoadCounter.WaitPageLoaded(timeout: WaitPageLoadTimeout);
                WebDriverCache.WebDriver.SetCookie("testingMode", "1");
                var newPage = new TPage();
                newPage.BrowseWaitVisible();
//                InitPage();
                return newPage;
            }));
        }
Пример #4
0
        public static TPage1 RefreshPage <TPage, TPage1>(TPage page)
            where TPage : PageBase, new()
            where TPage1 : PageBase, new()
        {
            return(PageTimeStatistics.Instance.InvolveAction(typeof(TPage1), () =>
            {
                page.VerifyPageIsAlive();
                WebDriverCache.WebDriver.Refresh();
                PageLoadCounter.WaitPageLoaded(timeout: WaitPageLoadTimeout);
                CleanFields(page);
                var newPage = new TPage1();
                newPage.BrowseWaitVisible();
//                InitPage();
                return newPage;
            }));
        }
 private void TearDownInternal()
 {
     try
     {
         PageLoadCounter.AssertPageNotLoaded();
     }
     finally
     {
         TestContext testContext = TestContext.CurrentContext;
         try
         {
             if (testContext.Result.Status == TestStatus.Failed)
             {
                 CaptureJavascriptErrors();
                 JsLogger.Show();
                 WebDriverCache.WebDriver.CaptureScreenshot();
             }
         }
         catch
         {
             Console.Out.WriteLine("Cannot save screenshot. Probably TearDown method called not in NUnit context");
         }
     }
 }