public void MySortBy(string columnName, string order = "ASCENDING") { SuperTest.WriteReport("Sorting by " + columnName + " " + order); HpgElement headerLink = new HpgElement(browser.FindId("myIdeasTable").FindLink(columnName)); HpgAssert.Exists(headerLink, "Verify header link exists"); headerLink.Click(); System.Threading.Thread.Sleep(20000); if (order.ToLower().Contains("desc")) { //Sort Descending while (!browser.Location.ToString().ToLower().Contains("desc")) { //Keep clicking until URL contains "desc" headerLink.Click(); System.Threading.Thread.Sleep(5000); } } else { //Sort Ascending while (browser.Location.ToString().ToLower().Contains("desc")) { //Keep clicking until URL does not contain "desc" headerLink.Click(); System.Threading.Thread.Sleep(5000); } } }
public new void UnCheck() { if (!Element.FindXPath("i")["class"].ToLower().Trim().Equals("icon-check-empty")) { Element.Click(); } HpgAssert.True(Element.FindXPath("i")["class"].ToLower().Trim().Equals("icon-check-empty"), string.Format("Checked a CheckBox({0})", Element.Text)); SuperTest.WriteReport(string.Format("Unchecked a CheckBox({0})", Element.Text)); }
public void goHomeHCADev(string username, string password) { AutomationCore.base_tests.BaseTest.WriteReport("Loggin into sbx-im.healthtrustpg.com..."); OpenQA.Selenium.Remote.RemoteWebDriver rwd = ((OpenQA.Selenium.Remote.RemoteWebDriver)browser.Native); rwd.Manage().Cookies.DeleteAllCookies(); SuperTest.SessConfiguration.AppHost = "http://sbx-im.healthtrustpg.com"; rwd.Manage().Window.Size = new Size(800, 600); rwd.Manage().Window.Maximize(); browser.Visit("http://sbx-im.healthtrustpg.com/Account/Login"); if (rwd.Capabilities.BrowserName.ToLower().Contains("internet")) { DateTime exitTime = DateTime.Now.AddMinutes(15); while (DateTime.Now <= exitTime) { //if (browser.HasDialog("")) if (true) { SuperTest.WriteReport("Enter credentials"); SendKeys.SendWait(username); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(2000); SendKeys.SendWait(password); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); } if (!browser.HasDialog("")) { break; } } } else { SuperTest.WriteReport("Enter credentials"); System.Threading.Thread.Sleep(10000); SendKeys.SendWait(username); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(2000); SendKeys.SendWait(password); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); } HpgAssert.False(browser.HasDialog(""), "Verify no dialog is present"); HpgAssert.Contains(pageHeader.Text, "Home Page", "Verify 'Home Page' is loaded"); }
public void SortIdeasBy(string columnName, string order = "ASCENDING") { SuperTest.WriteReport("Sorting by " + columnName + " " + order); AutomationCore.base_tests.BaseTest.AdjustMaxTimeout(240); var headerLink = browser.FindXPath("//a[contains(@id,'sortOrder') and .='" + columnName + "'][1]", new Options() { Match = Match.First }); //HpgElement headerLink = new HpgElement(browser.FindId("publishIdeasTable").FindLink(columnName)); //HpgAssert.True(headerLink.Element.Exists(), "Verify header link exists"); headerLink.SendKeys(OpenQA.Selenium.Keys.Home); headerLink.Hover(); headerLink.Hover(); System.Threading.Thread.Sleep(2000); headerLink.SendKeys(OpenQA.Selenium.Keys.Enter); //headerLink.Click(); System.Threading.Thread.Sleep(20000); if (order.ToLower().Contains("desc")) { //Sort Descending while (!headerLink.FindXPath("./..").Text.Contains("▼")) { headerLink.Hover(); headerLink.Hover(); System.Threading.Thread.Sleep(2000); headerLink.SendKeys(OpenQA.Selenium.Keys.Enter); //headerLink.Click(); System.Threading.Thread.Sleep(5000); } } else { //Sort Ascending while (!headerLink.FindXPath("./..").Text.Contains("▲")) { headerLink.Hover(); headerLink.Hover(); System.Threading.Thread.Sleep(2000); headerLink.SendKeys(OpenQA.Selenium.Keys.Enter); //headerLink.Click(); System.Threading.Thread.Sleep(5000); } } AutomationCore.base_tests.BaseTest.ResetMaxTimeout(); }
public void loginIdeaManagement(string baseURL = "http://sbx-im.healthtrustpg.com", string username = "", string password = "") { AutomationCore.base_tests.BaseTest.WriteReport("Loggin into " + baseURL + "..."); OpenQA.Selenium.Remote.RemoteWebDriver rwd = ((OpenQA.Selenium.Remote.RemoteWebDriver)browser.Native); rwd.Manage().Cookies.DeleteAllCookies(); SuperTest.SessConfiguration.AppHost = baseURL; rwd.Manage().Window.Size = new Size(800, 600); System.Threading.Thread.Sleep(2000); rwd.Manage().Window.Maximize(); if (!string.IsNullOrEmpty(username)) { browser.Visit(baseURL + "/Account/Login"); if (rwd.Capabilities.BrowserName.ToLower().Contains("internet")) { DateTime exitTime = DateTime.Now.AddMinutes(15); while (DateTime.Now <= exitTime) { //if (browser.HasDialog("")) if (true) { SuperTest.WriteReport("Enter credentials into " + rwd.Capabilities.BrowserName); SendKeys.SendWait(username); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(2000); if (Control.IsKeyLocked(Keys.CapsLock)) { SendKeys.SendWait("{CAPSLOCK}" + password); } else { SendKeys.SendWait(password); } System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); } if (!browser.HasDialog("")) { break; } } } else { SuperTest.WriteReport("Enter credentials into " + rwd.Capabilities.BrowserName); System.Threading.Thread.Sleep(10000); SendKeys.SendWait(username); System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(2000); if (Control.IsKeyLocked(Keys.CapsLock)) { SendKeys.SendWait("{CAPSLOCK}" + password); } else { SendKeys.SendWait(password); } System.Threading.Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); } try { HpgAssert.True(browser.HasNoDialog(""), "Verify no dialog is present"); } catch (Exception) { System.Threading.Thread.Sleep(60000); } HpgAssert.True(browser.HasNoDialog(""), "Verify no dialog is present"); } //HpgAssert.Contains(pageHeader.Text, "Home Page", "Verify 'Home Page' is loaded"); //TODO: Determine if home page header text is coming back or not. HpgAssert.True(browser.FindXPath("//a[@class='logo']/img").Exists(), "Verify page is loaded"); }