示例#1
0
        public static void screenVSC7(AndroidDriver driver)
        {
            int i;
            int i2;
            // create collection of Radio Groups
            var vCollection = driver.FindElementsByClassName("android.widget.RadioGroup");
            var vCollRadio  = driver.FindElementsByClassName("android.widget.RadioButton");

            //Loop through Radio Group collection
            for (i = 0; i < (vCollection.Count()); i++)
            {
                vCollRadio = vCollection[i].FindElements(By.ClassName("android.widget.RadioButton"));
                //Check the NO option is selected - If no select it
                for (i2 = 0; i2 < (vCollRadio.Count()); i2++)
                {
                    if (vCollRadio[i2].Text == "No" && vCollRadio[i2].GetAttribute("checked").ToString() == "false")
                    {
                        vCollRadio[i2].Click();
                    }
                }
            }
            //Set up touch screen scrolling
            RemoteTouchScreen touch = new RemoteTouchScreen(driver);

            do
            {
                //scroll to ensure next radio group is present
                touch.Flick(150, -1);
                Thread.Sleep(500);
                // create collection of Radio Groups
                vCollection = driver.FindElementsByClassName("android.widget.RadioGroup");
                //Loop through Radio Group collection
                for (i = 0; i < (vCollection.Count()); i++)
                {
                    vCollRadio = vCollection[i].FindElements(By.ClassName("android.widget.RadioButton"));
                    //Check the NO option is selected - If no select it
                    for (i2 = 0; i2 < (vCollRadio.Count()); i2++)
                    {
                        if (vCollRadio[i2].Text == "No" && vCollRadio[i2].GetAttribute("checked").ToString() == "false")
                        {
                            vCollRadio[i2].Click();
                        }
                    }
                }
            } while (IsElementPresent("Next", driver) == false);

            //select NEXT
            driver.FindElementByName("Next").Click();
        }
示例#2
0
        public static void screenISRD6(AndroidDriver driver)
        {
            //scroll to ensure next button is present
            RemoteTouchScreen touch = new RemoteTouchScreen(driver);

            do
            {
                Thread.Sleep(500);
                touch.Flick(500, -1);
                Thread.Sleep(500);
            } while (IsElementPresent("Next", driver) == false);

            //select NEXT
            driver.FindElementByName("Next").Click();
        }
        public void AddNewItem()
        {
            var driver = StartApp();
            // tap on second item
            var         el1 = driver.FindElementByAccessibilityId("Add");
            TouchAction a   = new TouchAction(driver);

            a.Tap(el1);
            el1.Click();
            var elItemText = driver.FindElementByAccessibilityId("ItemText");

            elItemText.Clear();
            elItemText.SendKeys("This is a new Item");

            var elItemDetail = driver.FindElementByAccessibilityId("ItemDescription");

            elItemDetail.Clear();
            elItemDetail.SendKeys("These are the details");

            var elSave = driver.FindElementByAccessibilityId("Save");

            elSave.Click();

            WaitForProgressbarToDisapear(driver);

            var     touchScreen = new RemoteTouchScreen(driver);
            Boolean found       = false;
            var     maxretries  = 5;
            int     count       = 0;

            while (!found && count++ < maxretries)
            {
                // Good value typically goes around 160 - 200 pixels with diminishing delta on the bigger values
                touchScreen.Flick(0, 180);
                try
                {
                    var el3 = driver.FindElementByName("This is a new Item");
                    found = el3 != null;
                }
                catch (Exception)
                { }
            }
            Assert.IsTrue(found);


            driver.CloseApp();
        }
示例#4
0
        public static void screenLog(AndroidDriver driver)
        {
            //work out which log screen this is
            var    vCollection = driver.FindElementsByClassName("android.widget.TextView");
            string screenName  = vCollection[2].Text.ToString();

            switch (screenName)
            {
            case "Other Complaints or Illnesses:":
                //Console.WriteLine("LOG SCREEN:  OCI");
                driver.FindElementByName("TAP TO ADD").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                merckVRC.screenER(driver);
                driver.FindElementByName("Next").Click();
                break;

            case "Non-study vaccinations:":
                //Console.WriteLine("LOG SCREEN:  NSV");
                driver.FindElementByName("TAP TO ADD").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                driver.FindElementByName("Next").Click();
                break;

            case "Medications":
                //Console.WriteLine("LOG SCREEN:  MEDICATIONS");
                driver.FindElementByName("TAP TO ADD").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                driver.FindElementByName("Next").Click();
                break;

            case "Injection Site Complaints":
                //Console.WriteLine("LOG SCREEN:  ISCd6");
                driver.FindElementByName("TAP TO ADD").Click();
                orangutan.goBananas(driver);
                merckVRC.screenER(driver);
                driver.FindElementByName("Next").Click();
                driver.FindElementByName("Next").Click();
                break;

            case "Vaccine Specific Complaints:":
                //Console.WriteLine("LOG SCREEN:  VSR");
                driver.FindElementByName("TAP TO ADD").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                orangutan.goBananas(driver);
                // scroll down to ensure
                RemoteTouchScreen touch = new RemoteTouchScreen(driver);
                do
                {
                    Thread.Sleep(500);
                    touch.Flick(500, -1);
                    Thread.Sleep(500);
                } while(IsElementPresent("Next", driver) == false);
                driver.FindElementByName("Next").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                orangutan.goBananas(driver);
                // scroll down to ensure
                //RemoteTouchScreen touch1 = new RemoteTouchScreen(driver);
                do
                {
                    Thread.Sleep(500);
                    touch.Flick(500, -1);
                    Thread.Sleep(500);
                } while(IsElementPresent("Next", driver) == false);
                driver.FindElementByName("Next").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                orangutan.goBananas(driver);
                driver.FindElementByName("Next").Click();
                screenVSC7(driver);
                driver.FindElementByName("Next").Click();
                break;
            }
        }
示例#5
0
        public static string enrolSubject(string loginPIN, string subjectID, string centreID, AndroidDriver driver)
        {
            string sTempPIN = "false";

            //login as site admin

            //standroid.GetScreenShot(driver, "test");
            //standroid.takeScreenshot(driver);



            driver.FindElementByClassName("android.widget.EditText").SendKeys(loginPIN);
            driver.FindElementByName("Next").Click();
            //select New Subject
            GenericFunctions.Wait(5);
            driver.FindElementByName("New Subject").Click();
            //enter new subject enrollment details
            GenericFunctions.Wait(1);

            //standroid.GetScreenShot(driver, "screenshot");

            orangutan.CaptureElementCollection("android.widget.EditText", driver);
            var fields = driver.FindElementsByClassName("android.widget.EditText");

            fields[0].SendKeys(centreID);
            fields[1].SendKeys(centreID);
            fields[2].SendKeys(subjectID);
            fields[3].SendKeys(subjectID);
            //flick screen to get next question in view
            var touch = new RemoteTouchScreen(driver);

            GenericFunctions.Wait(1);
            touch.Flick(500, -1);
            GenericFunctions.Wait(1);
            touch.Flick(500, -1);
            GenericFunctions.Wait(1);
            //select 'No' to replacement phone question
            driver.FindElementByName("No").Click();
            //select Next to confirm enrolment form details
            driver.FindElementByName("Next").Click();
            GenericFunctions.Wait(1);

            //Capture the temporary PIN and SUBMIT
            orangutan.CaptureElementCollection("android.widget.TextView", driver);
            fields   = driver.FindElementsByClassName("android.widget.TextView");
            sTempPIN = fields[6].Text;
            //check it captured it correctly
            if (sTempPIN.Length != 4)
            {
                //didn't capture it correctly - return false
                sTempPIN = "false";
            }
            //Console.WriteLine("sTempPIN = " + sTempPIN);
            driver.FindElementByName("Submit").Click();
            //Select Next in the enrolment confirmation screen
            Thread.Sleep(1000);

            //standroid.GetScreenShot(driver, "screenshot");

            driver.FindElementByName("Next").Click();
            //Logout of the site admin side
            Thread.Sleep(1000);

            //standroid.GetScreenShot(driver, "screenshot");

            driver.FindElementByName("Logout").Click();

            //standroid.GetScreenShot(driver, "screenshot");

            return(sTempPIN);
        }
 public void Flick(int speedX, int speedY)
 {
     _touchScreen.Flick(speedX, speedY);
 }
示例#7
0
 public void Flick(int speedX, int speedY, int delay)
 {
     _touchScreen.Flick(speedX, speedY);
     System.Threading.Thread.Sleep(delay);
 }