예제 #1
0
        public static void LoginToGather()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();

            //Go to Gather
            driver.Navigate().GoToUrl("https://engagement.int.ert.com");

            //Check a few pieces of text on the login page
            GenericFunctions.CheckTextIsOnPageNew("Username", driver);
            GenericFunctions.CheckTextIsOnPageNew("Password", driver);
            GenericFunctions.CheckTextIsOnPageNew("Forgot Password", driver);
            GenericFunctions.CheckTextIsOnPageNew("Forgot Username", driver);
            GenericFunctions.CheckTextIsOnPageNew("LOGIN", driver);
            GenericFunctions.CheckTextIsOnPageNew("Terms & Conditions", driver);
            GenericFunctions.CheckTextIsOnPageNew("Privacy Policy", driver);

            //Enter login credentials
            GenericFunctions.Type("ccraiser.studyall", "Username", driver);
            GenericFunctions.Type("User1234", "Password", driver);
            GenericFunctions.Wait(3);

            //Login
            GenericFunctions.ClickOnButton("login-submit-button", driver);
            GenericFunctions.Wait(3);

            //Select the tabs at the top of the page.
            GenericFunctions.ClickOnLink("Reporting", driver);
            GenericFunctions.Wait(3);
            GenericFunctions.ClickOnLink("Change Control", driver);

            //Close Browser
            GenericFunctions.Wait(5);
            driver.Quit();
        }
예제 #2
0
        public static void ITC_CheckLastEventDate(int sub, string expectedDate, IWebDriver driver)
        {
            ////Search for subject

            string subID = sub.ToString();

            GenericFunctions.Wait(2);
            GenericFunctions.ClickOnLink("My Subjects", driver);
            GenericFunctions.waitforElement("subjectId", driver);
            driver.FindElement(By.Id("subjectId")).Clear();
            driver.FindElement(By.Id("subjectId")).SendKeys(subID);
            GenericFunctions.Wait(2);
            GenericFunctions.ClickOnButton("searchBtn", driver);
            GenericFunctions.CheckTextIsOnPage(subID, driver);
            GenericFunctions.Wait(2);
            //Get last event date
            string EventDate = driver.FindElement(By.XPath("//*[@id='Grid']/div[2]/table/tbody/tr/td[6]")).Text;


            Functions.Reporting.ReportScreenshot("AlertEmail", driver);

            //Compare actual last event date to expected last event date
            if (expectedDate.Equals(EventDate))
            {
                GenericFunctions.ReportTheTestPassed("The last event date (" + EventDate + ") is correct");
                _startUp.TestPasses++;
                _startUp.Passes++;
            }
            else
            {
                GenericFunctions.ReportTheTestFailed("The last event date is incorrect. The expected date is: " + expectedDate + " The actual date is: " + EventDate);
                _startUp.TestFails++;
                _startUp.Fails++;
            }
        }
예제 #3
0
        public static void WhileTest()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("file:///C:/Ranjit/Automation/TrainingTasks/AddingInLogic/TestPages/While.html");
            int counter = 0;


            while (!driver.FindElement(By.Id("TheImgId")).Displayed)
            {
                Console.WriteLine(counter.ToString());
                GenericFunctions.Wait(1);

                if (counter == 60)
                {
                    break;
                }

                counter++;
            }

            GenericFunctions.ClickOnLink("Click me", driver);

            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }
예제 #4
0
        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);
        }
예제 #5
0
 //[Test]
 public void WhiteBeltTraining()
 {
     _startUp.driver.Navigate().GoToUrl("https://test.itc.excointouch.com/");
     GenericFunctions.CheckTextIsOnPage("Enter your username and password:"******"Reports", _startUp.driver);
     GenericFunctions.CheckTextIsOnPage("Username", _startUp.driver);
     GenericFunctions.Type("abrown", "UserName", _startUp.driver);
     GenericFunctions.Type("Password", "Password", _startUp.driver);
     GenericFunctions.ClickOnButton("logonBtn", _startUp.driver);
     GenericFunctions.SelectFromList("DEMO1", "studyId", _startUp.driver);
     GenericFunctions.CheckTextIsOnPage("Subject Enrolment", _startUp.driver);
     GenericFunctions.ClickOnLink("Reporting", _startUp.driver);
 }
예제 #6
0
        public static void NavigateAroundAnotherSite()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();

            //Go to Training HTML
            driver.Navigate().GoToUrl("file:///C:/Ranjit/Automation/TrainingTasks/IntroductionToAutomation/Testng.html");
            GenericFunctions.Wait(2);

            //Click on a hyperlink
            GenericFunctions.ClickOnLink("Click Me", driver);
            GenericFunctions.Wait(2);

            //Navigate Back
            driver.Navigate().Back();
            GenericFunctions.Wait(2);

            //Select a value from a Dropdown
            GenericFunctions.SelectFromList("Audi", "CarsList", driver);
            GenericFunctions.Wait(2);

            //Tick / Untick a checkbox
            GenericFunctions.TickCheckBox("Bike", driver);
            GenericFunctions.Wait(2);
            GenericFunctions.UnTickCheckBox("Bike", driver);
            GenericFunctions.Wait(2);

            //Check text is on a page.
            GenericFunctions.CheckTextIsOnPageNew("Login", driver);
            GenericFunctions.CheckTextIsOnPageNew("Username:"******"Password:"******"What transport do you have?", driver);
            GenericFunctions.CheckTextIsOnPageNew("What car do you have?", driver);

            //Check text is not on a page.
            GenericFunctions.CheckTextIsNotOnPageNew("Elephant", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Tiger", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Dog", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Cat", driver);

            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }
예제 #7
0
        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);
        }
예제 #8
0
        public static void TrainingTest()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();

            // Load the test page
            driver.Navigate().GoToUrl("https://bbc.co.uk");
            GenericFunctions.ClickOnLink("Sport", driver);
            GenericFunctions.ClickOnLink("About the BBC", driver);
            //GenericFunctions.UnTickCheckBox
            GenericFunctions.Wait(5);
            driver.Quit();

            //Type
            //TickCheckBox
            //UnTickCheckbox - By.Id
            //SelectFromList
            //ClickOnButton
            //ClickOnLink
            //CheckTextIsOnPage
            //CheckTextIsNotOnPage
        }
예제 #9
0
        public static void IFTest()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("file:///C:/Ranjit/Automation/TrainingTasks/AddingInLogic/TestPages/IF.html");


            string UserRole = driver.FindElement(By.Id("ShowText")).Text;

            if (UserRole == "Study User")
            {
                GenericFunctions.ClickOnLink("Link 1", driver);
            }
            else if (UserRole == "Site User")
            {
                GenericFunctions.ClickOnLink("Link 2", driver);
            }


            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }
예제 #10
0
        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);
        }
예제 #11
0
        public static void SwitchTest()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("file:///C:/Ranjit/Automation/TrainingTasks/AddingInLogic/TestPages/Switch.html");


            string System = driver.FindElement(By.Id("ShowText")).Text;

            GenericFunctions.Wait(3);

            switch (System)
            {
            case "25%":
                GenericFunctions.ClickOnLink("Link 1", driver);
                break;

            case "50%":
                GenericFunctions.ClickOnLink("Link 2", driver);
                break;

            case "75%":
                GenericFunctions.ClickOnLink("Link 3", driver);
                break;

            case "100%":
                GenericFunctions.ClickOnLink("Link 4", driver);
                break;

            default:
                break;
            }

            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }