public static void ITC_CheckHelpText(IWebDriver driver)
        {
            var studyName = GenericFunctions.goAndGet("STUDYID");


            using (var conn = new SqlConnection(GenericFunctions.goAndGet("DBCONNECTION")))
            {
                conn.Open();

                string helpText;
                using (var command = new SqlCommand("select help_text from tbl_study where name = '" + studyName + "'"))
                {
                    command.CommandType = System.Data.CommandType.Text;
                    command.Connection  = conn;

                    var obj = command.ExecuteScalar();
                    helpText = obj.ToString();
                    helpText = helpText.Replace("<b>", "");
                    helpText = helpText.Replace("</b>", "");
                    helpText = helpText.Replace("<u>", "");
                    helpText = helpText.Replace("</u>", "");
                    helpText = helpText.Replace("<i>", "");
                    helpText = helpText.Replace("</i>", "");
                    helpText = helpText.Replace("</b>", "");
                    //help_text = help_text.Replace("<br>", "\n");
                    helpText = helpText.Replace("<center>", "");
                    helpText = helpText.Replace("</center>", "");
                }

                conn.Close();
                GenericFunctions.ClickElement(driver.FindElement(By.XPath("//div/a/img")), driver);
                GenericFunctions.CheckTextIsOnPage(helpText, driver);
                GenericFunctions.ClickElement(driver.FindElement(By.XPath("//span[@class='ui-icon ui-icon-closethick']")), driver);
            }
        }
        public static void ITC_ViewSubject(int SubjectID, IWebDriver driver)
        {
            string mySubId   = SubjectID.ToString();
            string StudyName = GenericFunctions.goAndGet("STUDYID");
            string SiteName  = GenericFunctions.goAndGet("SITEID");

            GenericFunctions.ClickOnLink("My Subjects", driver);
            GenericFunctions.Wait(12);
            Functions.Reporting.ReportScreenshot("View_Subjects", driver);

            //GenericFunctions.Type(mySubId, "subjectId", driver);
            //GenericFunctions.ClickOnButton("searchBtn", driver);
            //GenericFunctions.waitforElement(mySubId, driver);

            GenericFunctions.ClickElement(driver.FindElement(By.XPath("//*[@id=\"edit" + _dbActions.GetRowIdForSubject(SubjectID, driver) + "\"]")), driver);

            GenericFunctions.Wait(2);
            GenericFunctions.CheckTextIsOnPage("Subject Details", driver);
            GenericFunctions.CheckTextIsOnPage("Site", driver);
            GenericFunctions.CheckTextIsOnPage("Subject Identifier", driver);
            GenericFunctions.CheckTextIsOnPage("Language", driver);
            GenericFunctions.CheckTextIsOnPage("Email", driver);
            GenericFunctions.CheckTextIsOnPage("Event Schedule", driver);

            Functions.Reporting.ReportScreenshot("View_Subjectsched", driver);
        }
 public static void ITC_ViewSubSched(int SubjectID, IWebDriver driver)
 {
     ITC_ViewSubject(SubjectID, driver);
     GenericFunctions.ClickOnText("Event Schedule", driver);
     GenericFunctions.CheckTextIsOnPage("Subject Schedule", driver);
     GenericFunctions.CheckTextIsOnPage("Click schedule icons to view message details.", driver);
     ITC_CheckScheduleKey(driver);
     GenericFunctions.CheckTextIsOnPage("Baseline Schedule", driver);
     GenericFunctions.CheckTextIsOnPage("Non-Baseline Schedule", driver);
     GenericFunctions.ClickElement(driver.FindElement(By.XPath("//span[@class='ui-close']")), driver);
     Functions.Reporting.ReportScreenshot("View_Subject_Sched", driver);
 }
        public static void ITC_EditSubject(int SubjectID, IWebDriver driver)
        {
            string StudyName = GenericFunctions.goAndGet("STUDYID");
            string SiteName  = GenericFunctions.goAndGet("SITEID");

            GenericFunctions.ClickOnButton("editBtn", driver);
            GenericFunctions.Wait(5);
            Functions.Reporting.ReportScreenshot("Edit_", driver);
            GenericFunctions.Clear("SubjectEMail", driver);
            GenericFunctions.Type(SubjectID + "@email-modified.com", "SubjectEMail", driver);

            //ClickElement(driver.FindElement(By.XPath("//*[@id=\"patientEditSaveButton\"]/span")));
            GenericFunctions.ClickElement(driver.FindElement(By.XPath("//*[@id=\"patientEditSaveButton\"]")), driver);
            GenericFunctions.Wait(20);

            var InputtedSecretQuestion = "In what city or town does your nearest sibling live?";
            var getSecretQuestion      = driver.FindElement(By.Id("Patient_SecurityQuestion")).GetAttribute("value");
            //var getSecretQuestion = driver.FindElement(By.Id("SecurityQuestionDropDownList")).GetAttribute("value");

            var InputtedSecretQuestionAnswer = "Nottingham";
            var getSecretQuestionAnswer      = driver.FindElement(By.Id("Patient_SecurityQuestionAnswer")).GetAttribute("value");

            if (getSecretQuestion.Equals(InputtedSecretQuestion) && (getSecretQuestionAnswer.Equals(InputtedSecretQuestionAnswer)))
            {
                GenericFunctions.ReportTheTestPassed("The secret question (" + getSecretQuestion + ") and secret answer (" + getSecretQuestionAnswer + ")  are correct ");
                _startUp.TestPasses++;
                _startUp.Passes++;
            }
            else
            {
                GenericFunctions.ReportTheTestFailed("The secret question is incorrect. The expected question is: " + InputtedSecretQuestion + "The actual question is: " + getSecretQuestion);
                GenericFunctions.ReportTheTestFailed("The secret question answer is incorrect. The expected question answer is: " + InputtedSecretQuestionAnswer + "The actual question is: " + getSecretQuestionAnswer);
                _startUp.TestFails++;
                _startUp.Fails++;
            }

            GenericFunctions.Wait(2);
            GenericFunctions.ClickOnLink("Subject Administration", driver);
            GenericFunctions.Wait(5);
            Functions.Reporting.ReportScreenshot("Edit", driver);
        }
        public static void ITC_Withdraw(int SubjectID, IWebDriver driver)
        {
            string sEnv = GenericFunctions.goAndGet("ENVIRONMENT");
            int    IntSubjectID;

            //This is no longer needed. WC
            IntSubjectID = _dbActions.GetRowIdForSubject(SubjectID, driver);

            GenericFunctions.ClickOnLink("Subject Administration", driver);

            GenericFunctions.Wait(10);
            //((IJavaScriptExecutor)driver).ExecuteScript("window.alert = function(){}");
            ((IJavaScriptExecutor)driver).ExecuteScript("window.confirm = function(){return true;}");
            GenericFunctions.ClickElement(driver.FindElement(By.XPath("//td[2]/a[@id='edit" + SubjectID + "']")), driver);
            GenericFunctions.Wait(5);
            Functions.Reporting.ReportScreenshot("Withdraw", driver);

            //IAlert alert = driver.SwitchTo().Alert();
            //alert.Accept(); //for two buttons, choose the affirmative one

            GenericFunctions.Wait(2);
            GenericFunctions.CheckTextIsOnPage("Subject " + SubjectID + " has been successfully withdrawn from the study.", driver);
        }
 public void ITC_LogOff(IWebDriver driver)
 {
     GenericFunctions.ClickElement(driver.FindElement(By.LinkText("Log Off")), driver);
 }