Ejemplo n.º 1
0
        public void LoginAs(string username, string password = "")
        {
            if (!browser.HasDialog(""))
            {
                browser.Visit("/Home/Contact");
            }
            DateTime exitTime = DateTime.Now.AddMinutes(15);

            while (DateTime.Now <= exitTime)
            {
                if (browser.HasDialog(""))
                {
                    SendKeys.SendWait(username);
                    System.Threading.Thread.Sleep(2000);
                    SendKeys.Send("[TAB]");
                    System.Threading.Thread.Sleep(2000);
                    SendKeys.Send(password);
                    System.Threading.Thread.Sleep(2000);
                    SendKeys.Send("[ENTER]");
                }
                if (!browser.HasDialog(""))
                {
                    break;
                }
            }
            HpgAssert.False(browser.HasDialog(""));
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
 public void GoToPackageIdea(int ideaNumber)
 {
     browser.Visit("/QualifiedIdea/Create/" + ideaNumber.ToString());
     System.Threading.Thread.Sleep(10000);
     HpgAssert.AreEqual(ideaNumber.ToString(), browser.FindId("Idea_IdeaId").Text.Trim(), "Verify Package Idea Page is displayed");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Idea " + ideaNumber);
 }
Ejemplo n.º 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");
     }
 }
Ejemplo n.º 5
0
 public void GoToIdeaNumber(string ideaNumber)
 {
     browser.Visit("/Idea/Details/" + ideaNumber);
     System.Threading.Thread.Sleep(10000);
     HpgAssert.AreEqual(ideaNumber, browser.FindXPath("//div[@id='StandardDetails']/h3[.='Idea Number']/following-sibling::p[1]").Text.Trim(), "Verify Idea Detail Page is displayed");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Idea " + ideaNumber);
 }
Ejemplo n.º 6
0
 public void GotoDashboard()
 {
     browser.Visit("/Dashboard");
     WaitForThrobber(600);
     HpgAssert.Contains(pageHeader.Text, "My Dashboard", "Verify Dashboard is loaded");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Dashboard");
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Clicks submit, verifys success dialog, accepts success dialog.
 /// </summary>
 public void SubmitIdea()
 {
     SubmitSubmitButton.Click();
     //HpgAssert.True(browser.HasContent("Your Idea was submitted successfully.", new Options() { Timeout = TimeSpan.FromMinutes(2) }), "Verify success message is present");
     HpgAssert.AreEqual("submitted", browser.FindId("status").Text.Trim().ToLower(), "Verify idea was submitted successfully");
     //browser.AcceptModalDialog();
 }
Ejemplo n.º 8
0
 public void GotoHomePage()
 {
     browser.Visit("/");
     WaitForThrobber();
     HpgAssert.Contains(pageHeader.Text, "Streetwise", "Verify Home Page is loaded");
     AutomationCore.base_tests.BaseTest.WriteReport("Navigated to Home Page");
 }
Ejemplo n.º 9
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");
     }
 }
Ejemplo n.º 10
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");
 }
Ejemplo n.º 11
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");
 }
Ejemplo n.º 12
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");
 }
Ejemplo n.º 13
0
 public void GotoAllIdeas()
 {
     //TabAllIdeas.Click();
     browser.Visit("/Idea/GetAllIdeas");
     //TODO: Change to an ID after the pages have been updated with IDs
     WaitForThrobber(240);
     HpgAssert.Contains(pageHeader.Text, "All Ideas", "Verify 'All Ideas' page is loaded");
 }
Ejemplo n.º 14
0
 public void GotoMyIdeas()
 {
     //TabMyIdeas.Element.Hover();
     //TabMyIdeas.Click();
     browser.Visit("/Idea/GetMyIdeas");
     WaitForThrobber();
     HpgAssert.Contains(pageHeader.Text, "My Ideas", "Verify 'My Ideas' page is loaded");
 }
Ejemplo n.º 15
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));
 }
Ejemplo n.º 16
0
        public void SubmitIdea(int ideaNumber)
        {
            //int rAff = ExecuteStatement(
            //    string.Format(
            //    "INSERT INTO HPG_IdeaManagementSBX.dbo.QualifiedIdeas ([IdeaId] ,[Title] ,[Description] ,[StatusId] ,[MembershipTypeId] ,[CategoryId] ,[DepartmentId] ,[ImpactLevel] ,[EffortLevel] ,[PublishedDate] ,[CreatedDate] ,[UpdatedDate]) VALUES ({0}), (SELECT [Title] FROM Ideas WHERE IdeaID = {0}), (SELECT [Description] FROM Ideas WHERE IdeaID = {0}), 2, 3, 1, 1, 1, 1, GETDATE(), GETDATE(), GETDATE());",
            //    ideaNumber));
            int rAff = ExecuteStatement("UPDATE Ideas SET StatusID = 2 WHERE IdeaId = " + ideaNumber.ToString() + ";");

            HpgAssert.AreEqual("1", rAff.ToString(), "Verify 1 record (idea) updated to Accepted");
        }
Ejemplo n.º 17
0
 public void OpenEmailDialog()
 {
     LinkEmail.Click();
     WaitForThrobber();
     if (!browser.FindId("emailDialog").Exists())
     {
         LinkEmail.Click(2);
     }
     HpgAssert.True(browser.FindId("emailDialog").Exists(), "Email Dialog is open");
 }
Ejemplo n.º 18
0
 public void AssertBaseElements()
 {
     HpgAssert.Exists(HealthtrustLogo, "The Healthtrust logo could not be found.");
     HpgAssert.Exists(HomeButton, "The home button could not be found.");
     HpgAssert.AreEqual(TabPublishedIdeas.Text, "PUBLISHED IDEAS", "The 'Published Ideas' tab is missing or not displayed correctly.");
     HpgAssert.AreEqual(TabAllIdeas.Text, "ALL IDEAS", "The 'All Ideas' tab is missing or not displayed correctly.");
     HpgAssert.AreEqual(TabMyIdeas.Text, "MY IDEAS", "The 'My Ideas' tab is missing or not displayed correctly.");
     HpgAssert.AreEqual(TabSubmitAnIdea.Text, "SUBMIT AN IDEA", "The 'Submit an Idea' tab is missing or not displayed correrctly.");
     HpgAssert.Exists(pageFooter, "The footer is missing or not displayed properly.");
 }
Ejemplo n.º 19
0
 public void AssertPageElements(ExecuteAutomationLogin executeAutomationLogin)
 {
     HpgAssert.AreEqual(executeAutomationLogin.LoginLink.Text, "LOGIN");
     HpgAssert.AreEqual(executeAutomationLogin.PageTitle.Text, "Execute Automation Selenium Test Site");
     HpgAssert.AreEqual(executeAutomationLogin.LoginTitle.Text, "Login");
     HpgAssert.AreEqual(executeAutomationLogin.UserNameLbl.Text, "UserName  ");
     HpgAssert.AreEqual(executeAutomationLogin.PasswordLbl.Text, "Password    ");
     HpgAssert.Exists(executeAutomationLogin.UserNameTxtFld);
     HpgAssert.Exists(executeAutomationLogin.PasswordTxtFld);
     HpgAssert.Exists(executeAutomationLogin.LoginBtn);
 }
Ejemplo n.º 20
0
 public void SoftDeleteIdeas(int[] IdeaIDs, bool validate = true)
 {
     if (IdeaIDs.Any())
     {
         int raff = ExecuteStatement("UPDATE Ideas SET Deleted = 'TRUE' WHERE IdeaId IN (" + string.Join(",", IdeaIDs) + ");");
         if (validate)
         {
             HpgAssert.AreEqual(IdeaIDs.Count().ToString(), raff.ToString(), "Verify all records were marked as deleted.");
         }
     }
 }
Ejemplo n.º 21
0
        /// <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");
            }
        }
Ejemplo n.º 22
0
        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");
            }
        }
Ejemplo n.º 23
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);
 }
Ejemplo n.º 24
0
 public void goHomeHCADev(bool useCredentials)
 {
     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/");
     HeaderLoginLink.Click();
     HpgAssert.False(browser.HasDialog(""), "Verify no dialog is present");
     HpgAssert.Contains(pageHeader.Text, "Home Page", "Verify 'Home Page' is loaded");
 }
Ejemplo n.º 25
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");
        }
Ejemplo n.º 26
0
 public void AssertPageElements()
 {
     HpgAssert.Exists(login.HealthtrustLogo, "The Healthtrust logo is missing or not displayed properly.");
     HpgAssert.Exists(login.CoretrustLogo, "The Coretrust logo is missing or not displayed properly.");
     HpgAssert.AreEqual(login.LoginTxt.Text, "Login", "The 'Login' text is missing or not displayed properly.");
     HpgAssert.AreEqual(login.EmailOrUserIDTxt.Text, "Email or User ID", "The 'Email or User ID' text is missing or not displayed properly.");
     HpgAssert.Exists(login.UserNameTxtField, "The username text field is missing or not displayed properly.");
     HpgAssert.AreEqual(login.PasswordTxt.Text, "Password Forgot password?", "The 'Password' text is missing or not displayed properly.");
     HpgAssert.AreEqual(login.ForgotPasswordLnk.Text, "Forgot password?", "The 'Forgot Password' text is missing or not displayed properly.");
     HpgAssert.Exists(login.PasswordTxtField, "The Password text field is missing or not displayed properly.");
     HpgAssert.Exists(login.RememberEmailOrUserIDCheckBox, "The 'Remember Email or User ID' check box is missing or not displayed properly.");
     HpgAssert.AreEqual(login.RememberEmailOrUserIDTxt.Text, "Remember Email or User ID", "The 'Remember Email or User ID' check box is missng or not displayed properly.");
     HpgAssert.Exists(login.loginButton, "The Login button is missing or not displayed properly.");
     HpgAssert.Exists(login.Footer, "The Footer is missing or does not exist.");
 }
Ejemplo n.º 27
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");
 }
Ejemplo n.º 28
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");
 }
Ejemplo n.º 29
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");
 }
Ejemplo n.º 30
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");
 }