Example #1
0
 public void CheckRetry(HpgElement checkbox, int retryTimes = 3, int SecondsBetween = 1, bool assertion = true)
 {
     for (int i = 0; i < retryTimes; i++)
     {
         try
         {
             AutomationCore.base_tests.BaseTest.WriteReport("Checking box (#" + (i + 1).ToString() + ")");
             checkbox.Element.Now();
             checkbox.Element.Hover();
             checkbox.Element.Check();
             if (checkbox.Element.Selected)
             {
                 break;
             }
             checkbox.Element.SendKeys(OpenQA.Selenium.Keys.Space);
             if (checkbox.Element.Selected)
             {
                 break;
             }
             System.Threading.Thread.Sleep(SecondsBetween * 1000);
         }
         catch (Exception e)
         {
             AutomationCore.base_tests.BaseTest.WriteReport("Error checking box - " + e.Message);
         }
     }
     if (assertion)
     {
         HpgAssert.True(checkbox.Element.Selected, "Checkbox is checked");
     }
 }
Example #2
0
 public void EnterSavings(SavingsRow row, decimal value)
 {
     for (int i = 0; i < 5; i++)
     {
         if (EditDialog.Element.Exists(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         new HpgElement(row.Actions.Element.FindXPath(".//a")).Click();
     }
     HpgAssert.True(EditDialog.Element.Exists(new Options()
     {
         Timeout = TimeSpan.FromSeconds(3)
     }), "Verify Edit Savings dialog is open");
     EnterSavingsTextBox.Type(value.ToString());
     for (int i = 0; i < 5; i++)
     {
         if (EditDialog.Element.Missing(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         EnterSavingsSaveButton.Click(2);
     }
     HpgAssert.True(EditDialog.Element.Missing(new Options()
     {
         Timeout = TimeSpan.FromSeconds(3)
     }), "Verify Edit Savings dialog is no longer open");
 }
Example #3
0
 public void SubmitToSME(string smeName)
 {
     for (int i = 0; i < 5; i++)
     {
         if (AssignToSMEDialog.Element.Exists(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         SubmitButton.Click(2);
     }
     HpgAssert.True(AssignToSMEDialog.Element.Exists(), "Assign To SME dialog is present");
     SMEDropDown.SelectListOptionByText(smeName);
     AssignToSMESubmit.Click(3);
     for (int i = 0; i < 5; i++)
     {
         if (AssignToSMEDialog.Element.Missing(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         AssignToSMESubmit.Click(3);
     }
     HpgAssert.True(AssignToSMEDialog.Element.Missing(new Options()
     {
         Timeout = TimeSpan.FromSeconds(3)
     }), "Assign to SME dialog is no longer present");
 }
Example #4
0
 public void AddLinks(Dictionary <string, string> links, bool openCloseDialog = false)
 {
     if (openCloseDialog)
     {
         ShowRMIAddLinks();
     }
     foreach (KeyValuePair <string, string> link in links)
     {
         AddLink(link.Key, link.Value);
     }
     if (openCloseDialog)
     {
         AddLinksDialogSaveButton.Click(2);
         for (int i = 0; i < 5; i++)
         {
             if (AddLinksDialog.Element.Missing(new Options()
             {
                 Timeout = TimeSpan.FromSeconds(3)
             }))
             {
                 break;
             }
             AddLinksDialogSaveButton.Click(2);
         }
         HpgAssert.True(AddLinksDialog.Element.Missing(), "RMI Add Links dialog is no longer present");
     }
 }
Example #5
0
 public void GotoSubmitAnIdea()
 {
     TabSubmitAnIdea.Click();
     HpgAssert.Contains(pageHeader.Text, "Submit an Idea", "Verify 'Submit Idea' page is loaded");
     WaitForThrobber();
     HpgAssert.True(browser.FindId("ideaSubmit").Exists(), "Verify 'Submit Idea' page is loaded");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Submit Idea page");
 }
Example #6
0
 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 OpenEmailDialog()
 {
     LinkEmail.Click();
     WaitForThrobber();
     if (!browser.FindId("emailDialog").Exists())
     {
         LinkEmail.Click(2);
     }
     HpgAssert.True(browser.FindId("emailDialog").Exists(), "Email Dialog is open");
 }
        /// <summary>
        /// Verifies all attachments supplied in fileList dictionary parameter are present and href links are correct
        /// </summary>
        /// <param name="fileList">Dictionary containing linkname / filepath</param>
        public void VerifyAttachmentsArePresent(Dictionary <string, string> fileList)
        {
            List <HpgElement> attachments = GetAllAttachments();

            foreach (KeyValuePair <string, string> fileToTest in fileList)
            {
                HpgElement a = attachments.First(b => b.Text.Trim().Equals(fileToTest.Key));
                HpgAssert.True(a.Element.Exists(), "Verify attachment '" + fileToTest.Key + "' is present");
                HpgAssert.Contains(System.Web.HttpUtility.UrlDecode(a.Element["href"]), fileToTest.Value.Split('\\').Last(), "Verify attachment file is correct");
            }
        }
        public void VerifyLinksArePresent(Dictionary <string, string> linksList)
        {
            List <HpgElement> links = GetAllLinks();

            foreach (KeyValuePair <string, string> linkToTest in linksList)
            {
                HpgElement a = links.First(b => b.Text.Trim().Equals(linkToTest.Key));
                HpgAssert.True(a.Element.Exists(), "Verify link '" + linkToTest.Key + "' is present");
                HpgAssert.Contains(System.Web.HttpUtility.UrlDecode(a.Element["href"]), linkToTest.Value, "Verify link URL is correct");
            }
        }
Example #10
0
        //public void EditPage()
        //{
        //    for (int i = 0; i < 5; i++)
        //    {
        //        if (EditButton.Element.Exists(new Options() {Timeout = TimeSpan.FromSeconds(2)}))
        //        {
        //            EditButton.Click();
        //        }
        //        if (SaveDropDown.Element.Exists(new Options() { Timeout = TimeSpan.FromSeconds(2) }))
        //        {
        //            break;
        //        }
        //        System.Threading.Thread.Sleep(3000);
        //    }
        //    HpgAssert.True(EditButton.Element.Missing(), "Verify Edit Button was pressed and is no longer present.");
        //    HpgAssert.True(SaveDropDown.Element.Exists(), "Verify Multifunction Save button is now present");
        //}

        public void DisplaySoCDialog(int view)
        {
            for (int i = 0; i < 3; i++)
            {
                if (socDialog.Exists())
                {
                    break;
                }
                EditSoCButton(view).Click();
                System.Threading.Thread.Sleep(1000);
            }
            HpgAssert.True(socDialog.Exists(), "Verify SoC dialog is present");
        }
Example #11
0
 public void GoToPublishedIdeaNumber(string ideaNumber)
 {
     SendKeys.SendWait("{ESC}");
     SendKeys.SendWait("{ESC}");
     System.Threading.Thread.Sleep(2000);
     browser.Now();
     //browser.Visit("/Idea/Published/" + ideaNumber);
     browser.Visit("QualifiedIdea/Details/" + ideaNumber);
     browser.FindId("QualifiedIdea_IdeaId").Now();
     //HpgAssert.True(browser.FindXPath(".//*[@id='content']/div[4]/div/div[2]/div[1]/div/div/div[1]/h2").Text.Trim().StartsWith(ideaNumber), "Verify Published Idea Detail Page is displayed");
     HpgAssert.True(browser.FindId("QualifiedIdea_IdeaId").Text.Trim().Equals(ideaNumber), "Verify Published Idea Detail Page is displayed");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Published Idea " + ideaNumber);
 }
Example #12
0
 public void ShowRMIAddAttachments()
 {
     for (int i = 0; i < 5; i++)
     {
         if (AddAttachmentsDialog.Element.Exists(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         RMIAddAttachments.Click(2);
     }
     HpgAssert.True(AddAttachmentsDialog.Element.Exists(), "Request More Info - Add Attachments dialog is present");
 }
Example #13
0
 public void ShowAdditionalInfoTab()
 {
     for (int i = 0; i < 5; i++)
     {
         if (RMIDiv.Element.Exists(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         AdditionalInfoTab.Click(2);
     }
     HpgAssert.True(RMIDiv.Element.Exists(), "Additional Information (RMI) tab is shown");
 }
Example #14
0
 public void RMIShowAddLinks()
 {
     for (int i = 0; i < 5; i++)
     {
         if (AddLinksDialog.Element.Exists(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         RMIResponseAddLinks.Click(2);
     }
     HpgAssert.True(AddLinksDialog.Element.Exists(), "RMI Add Links dialog is present");
 }
Example #15
0
 public void RMISaveAttachmentsAndClose()
 {
     AddAttachmentsDialogSaveButton.Click(2);
     for (int i = 0; i < 5; i++)
     {
         if (AddAttachmentsDialog.Element.Missing(new Options()
         {
             Timeout = TimeSpan.FromSeconds(3)
         }))
         {
             break;
         }
         AddAttachmentsDialogSaveButton.Click(2);
     }
     HpgAssert.True(AddAttachmentsDialog.Element.Missing(), "Request More Info - Attachments are saved and dialog is no longer present");
 }
Example #16
0
            /// <summary>
            /// Checks the last SoC specified in socPath
            /// </summary>
            /// <param name="socPath">string '/' seperated path to the desired SoC</param>
            public void ApplySoC(string socPath, string hierarchy = "OCGDMF")
            {
                //hierarchy = Orginazation, Company, Group, Division, Market, Facility
                var        paths     = socPath.Split('/');
                SoC        node      = new SoC();
                HpgElement socParent = new HpgElement(_dialog);

                for (int i = 0; i < paths.Count() - 1; i++)
                {
                    node      = AvailableSoCs(socParent, paths[i].Trim()).Last(s => RegExRemove(s.Name.Text).ToLower().Equals(RegExRemove(paths[i]).ToLower()) && s.Hierarchy.ToUpper().Equals(hierarchy[i].ToString()));
                    socParent = node.row;
                    node.Name.Click();
                }
                node = AvailableSoCs(socParent, paths.Last()).Last(s => RegExRemove(s.Name.Text).ToLower().Equals(RegExRemove(paths.Last()).ToLower()) && s.Hierarchy.ToUpper().Equals(hierarchy[paths.Count() - 1].ToString()));
                node.Name.Click();
                node.Checkbox.Check();

                HpgAssert.True(SelectedSoCs().FindAll(s => RegExRemove(s.Name.Text).ToLower().Equals(RegExRemove(paths.Last()).ToLower()) && s.Hierarchy.ToUpper().Equals(hierarchy[paths.Count() - 1].ToString())).Any(), "Verify specified SoC has been selected");
            }
Example #17
0
 public void ClearRefinements()
 {
     ClearFilterButton.Click();
     WaitForThrobber();
     HpgAssert.True(!GetAllRefinements().Any(), "No refinements are applied");
 }
Example #18
0
 public void ClickAdminHeaderMenu()
 {
     AdminHeaderMenu.Element.FindLink("Admin").Hover();
     AdminHeaderMenu.Element.FindLink("Admin").Click();
     HpgAssert.True(AdminHeaderMenu.Element.FindXPath(".//li").Exists(), "Verify Admin Header Menu is displayed");
 }
Example #19
0
 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");
 }
 public void SearchFor(string q)
 {
     SearchBox.Type(q);
     SearchButton.Click();
     HpgAssert.True(browser.FindXPath("//div[@class='filterSummary']").HasContent("Search: " + q), "Verify search for '" + q + "' was performed");
 }