/// <summary> /// Page load performance test. /// </summary> /// <param name="ts">TestSuite</param> /// <param name="url">URL page</param> /// <param name="benchmark">Benchmark.</param> public static void PerformancePageLoadTest(BaseTestSuite ts, string url, int benchmark) { DateTime start = DateTime.Now; ts.Instance.NavigateToSkipReadyForStatic(url); ts.Instance.WaitForReadyForStatic(); DateTime end = DateTime.Now; TimeSpan diff = end - start; int actual = (int)diff.TotalMilliseconds; int expected = benchmark; Console.WriteLine("Page loaded waiting for #readyForStatic in '{0}'ms", actual); Assert.Less(actual, expected, string.Format("Took longer than '{0}'ms to load, url '{1}'!", expected, url)); }
/// <summary> /// Socials the links. /// </summary> /// <param name="ts">Ts.</param> /// <param name="instance">Instance.</param> public static void SocialLinks(BaseTestSuite ts) { string url = "http://www.google.com/"; Selenium.PageObjects.DefaultPage page = new Selenium.PageObjects.DefaultPage(url); string exceptions; const int expected = 5; StringBuilder failures = new StringBuilder(); if (!page.VerifySocialShares(out exceptions, expected)) { failures.AppendLine(exceptions); } if (failures.ToString().Trim().Length > 0) { Assert.Fail(failures.ToString()); } }