コード例 #1
0
 public void test()
 {
     HiddenButton.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #2
0
 public void test()
 {
     if (letters.Text.Equals("AAA"))
     {
         SetMethods.EnterText(enterCount, "3");
     }
     if (letters.Text.Equals("BBB"))
     {
         SetMethods.EnterText(enterCount, "4");
     }
     if (letters.Text.Equals("CCC"))
     {
         SetMethods.EnterText(enterCount, "2");
     }
     if (letters.Text.Equals("DDD"))
     {
         SetMethods.EnterText(enterCount, "5");
     }
     if (letters.Text.Equals("EEE"))
     {
         SetMethods.EnterText(enterCount, "1");
     }
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #3
0
        public void test()
        {
            generateTXT.Click();
            string text = GetMethods.GetTextValue(generateTXT);

            Console.WriteLine(text);
            Regex regex = new Regex(@"\d+");
            Match match = regex.Match(text);

            if (match.Success)
            {
                SetMethods.EnterText(firstNum, match.Value);
            }
            match = match.NextMatch();
            if (match.Success)
            {
                SetMethods.EnterText(secNum, match.Value);
            }
            match = match.NextMatch();
            if (match.Success)
            {
                SetMethods.EnterText(thirdNum, match.Value);
            }
            firstNum.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #4
0
        /*public void test()
         * {
         *      string script = System.IO.File.ReadAllText(@"C:\Users\long\Documents\test9.js");
         *      script += "simulateHTML5DragAndDrop(arguments[0], arguments[1])";
         *      IJavaScriptExecutor executor = (IJavaScriptExecutor)PropertiesCollection.driver;
         *      executor.ExecuteScript(script, toscabot, box);
         * }*/

        public void test()
        {
            int order = 1;

            while (order < 7)
            {
                for (int i = 2; i < 8; i++)
                {
                    IWebElement start  = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[1]/div/table/tbody/tr[" + i + "]"));
                    IWebElement finish = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]"));
                    string      id     = GetMethods.GetTextTask(start);
                    if (order == Convert.ToInt32(id))
                    {
                        /*string script = System.IO.File.ReadAllText(@"C:\Users\long\Documents\test9.js");
                         * script += "simulateHTML5DragAndDrop(arguments[0], arguments[1])";
                         * IJavaScriptExecutor executor = (IJavaScriptExecutor)PropertiesCollection.driver;
                         * executor.ExecuteScript(script, start, finish);*/

                        Actions action = new Actions(PropertiesCollection.driver);
                        action.DragAndDrop(start, finish).Build().Perform();
                        order++;
                        break;
                    }
                }
            }
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #5
0
 public void test()
 {
     Button.SendKeys(Keys.Enter);
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #6
0
 public void test()
 {
     SetMethods.EnterText(numberBox, "00618971341641");
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #7
0
        public void test()
        {
            DateTime tomorrow  = DateTime.Now.AddDays(1);
            string   date      = tomorrow.ToString("d");
            string   finalDate = "";
            Regex    dayMonth  = new Regex(@"\d{1,2}");
            Regex    year      = new Regex(@"\d{4}");
            Match    match     = dayMonth.Match(date);

            if (match.Success)
            {
                finalDate = finalDate + match.Value + ".";
            }
            match = match.NextMatch();
            if (match.Success)
            {
                finalDate = finalDate + match.Value + ".";
            }
            match = year.Match(date);
            if (match.Success)
            {
                finalDate = finalDate + match.Value;
            }
            SetMethods.EnterText(dateBox, finalDate);
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #8
0
 public void test()
 {
     Generate.Click();
     RedLine.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #9
0
 public void test()
 {
     Thread.Sleep(500);
     SecondBtn.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #10
0
 public void test()
 {
     ClickMeFirst.Click();
     ClickMeThen.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #11
0
        public void test()
        {
            Actions action = new Actions(PropertiesCollection.driver);

            action.MoveToElement(Button, 400, 0).Click().Build().Perform();
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #12
0
        public void test()
        {
            string total = Convert.ToInt32(firstInt.Text) + Convert.ToInt32(secInt.Text) + "";

            SetMethods.EnterText(result, total);
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #13
0
        public void test()
        {
            Actions actions = new Actions(PropertiesCollection.driver);

            actions.KeyDown(Keys.LeftControl).Click(selFunctional).Click(selGUI).Click(selE2E).Click(selExp).KeyUp(Keys.LeftControl).Build().Perform();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #14
0
 public void test()
 {
     Password.Click();
     PasswordA.Click();
     SetMethods.EnterText(PasswordA, "ABC");
     ClickMe.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #15
0
 public void test()
 {
     ClickMe.Click();
     PropertiesCollection.driver.SwitchTo().Window(PropertiesCollection.driver.WindowHandles.Last());
     Thread.Sleep(800);
     PropertiesCollection.driver.Close();
     PropertiesCollection.driver.SwitchTo().Window(PropertiesCollection.driver.WindowHandles.First());
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #16
0
        public void test()
        {
            calculateBtn.Click();
            WebDriverWait waitForElement = new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(50));

            waitForElement.Until(ExpectedConditions.ElementToBeClickable(By.Id("two")));
            Thread.Sleep(500);
            sendBtn.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #17
0
        public void test()
        {
            string text = ClickMe.Text;

            while (!(text.Equals("ENOUGH")))
            {
                ClickMe.Click();
                text = ClickMe.Text;
            }
            ClickMe.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #18
0
        public void test()
        {
            Regex  regex = new Regex(@"\d+\.*\d*");
            string text  = alertText.Text;
            Match  match = regex.Match(text);

            if (match.Success)
            {
                SetMethods.EnterText(enterAmount, match.Value);
            }
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #19
0
        public void test()
        {
            int  num1 = Convert.ToInt32(firstInt.Text);
            int  num2 = Convert.ToInt32(secInt.Text);
            char op   = Convert.ToChar(symbol.Text);

            Console.WriteLine(op);
            string sum = "" + operation(num1, num2, op);

            SetMethods.EnterText(result, sum);
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #20
0
        public void test()
        {
            // Locate javascript
            string script = System.IO.File.ReadAllText(@"C:\Users\long\Documents\test9.js");

            script += "simulateHTML5DragAndDrop(arguments[0], arguments[1])";

            // Implement javascript to drag and drop
            IJavaScriptExecutor executor = (IJavaScriptExecutor)PropertiesCollection.driver;

            executor.ExecuteScript(script, toscabot, box);

            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #21
0
 public void test()
 {
     GenerateBtn.Click();
     Cp1.Click();
     Cp2.Click();
     Cp3.Click();
     Cp4.Click();
     Cp5.Click();
     Cp6.Click();
     Cp7.Click();
     Cp8.Click();
     Cp9.Click();
     Cp10.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #22
0
        public void test()
        {
            booksBtn.Click();
            string text = GetMethods.GetTextValue(XMLText);

            Console.WriteLine(text);

            // Copy and save into an XML file
            using (StreamWriter sw = File.CreateText(@"C:\Users\long\Documents\xmldoc.xml"))
            {
                sw.WriteLine(text);
            }

            // Read from the saved XML file
            XmlTextReader reader = new XmlTextReader(@"C:\Users\long\Documents\xmldoc.xml");
            string        ISBN   = "";

            while (reader.Read())
            {
                if (reader.NodeType.ToString().Equals("Element"))
                {
                    if (reader.Name.Equals("title"))
                    {
                        reader.Read();
                        if (reader.NodeType.ToString().Equals("Text"))
                        {
                            if (reader.Value.ToString().Equals("Testing Computer Software"))
                            {
                                // Read until ISBN row is reached
                                for (int i = 0; i < 12; i++)
                                {
                                    reader.Read();
                                }
                                ISBN = reader.Value.ToString();
                                break;
                            }
                        }
                    }
                }
            }
            SetMethods.EnterText(result, ISBN);
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #23
0
        public void test()
        {
            generate.Click();
            Regex  year1 = new Regex(@"\d{4}");
            Regex  monthDay = new Regex(@"\d{1,2}");
            string date1 = GetMethods.GetTextValue(dateGenerated);
            string date2, finalDate = "";

            Match match = monthDay.Match(date1);

            if (match.Success)
            {
                if (Convert.ToInt32(match.Value) == 11)
                {
                    date2     = "-01-01";
                    match     = year1.Match(date1);
                    finalDate = (Convert.ToInt32(match.Value) + 1) + date2;
                }
                if (Convert.ToInt32(match.Value) == 12)
                {
                    date2     = "-02-01";
                    match     = year1.Match(date1);
                    finalDate = (Convert.ToInt32(match.Value) + 1) + date2;
                }
                else
                {
                    if ((Convert.ToInt32(match.Value) + 2 + "").Length == 1)
                    {
                        date2 = "-0" + (Convert.ToInt32(match.Value) + 2) + "-01";
                    }
                    else
                    {
                        date2 = "-" + (Convert.ToInt32(match.Value) + 2) + "-01";
                    }
                    match     = year1.Match(date1);
                    finalDate = Convert.ToInt32(match.Value) + date2;
                }
            }
            SetMethods.EnterText(dateSolution, finalDate);
            done.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #24
0
        public void test()
        {
            generateBtn.Click();
            string number;

            for (int i = 1; i < 13; i++)
            {
                IWebElement column1 = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[" + i + "]/div[1]"));
                string      name    = column1.Text;
                if (name.Equals("order id"))
                {
                    IWebElement column2 = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[" + i + "]/div[2]"));
                    number = column2.Text;
                    SetMethods.EnterText(enterID, number);
                }
            }
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #25
0
        public void test()
        {
            // Focuses on small window to scroll
            PropertiesCollection.driver.SwitchTo().Frame(PropertiesCollection.driver.FindElement(By.Id("container")));

            // Implement javascript to scroll window
            IJavaScriptExecutor js = (IJavaScriptExecutor)PropertiesCollection.driver;

            js.ExecuteScript("window.scrollBy(0,200)");

            SetMethods.EnterText(TextBox, "Tosca");

            // Focus back on entire html page
            PropertiesCollection.driver.SwitchTo().DefaultContent();

            SubmitBtn.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #26
0
        public void test()
        {
            int  i       = 1;
            bool notDone = true;

            while (notDone)
            {
                IWebElement bubble = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div/div[" + i + "]"));
                int         num1   = Convert.ToInt32(PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div/div[" + i + "]/div[1]")).Text);
                int         num2   = Convert.ToInt32(PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div/div[" + i + "]/div[2]")).Text);
                if (num1 > num2)
                {
                    Swap.Click();
                    Thread.Sleep(250);
                    Next.Click();
                    Thread.Sleep(250);
                    i++;
                }
                else
                {
                    Next.Click();
                    Thread.Sleep(250);
                    i++;
                }
                Console.WriteLine(i);
                if (i == 9 && Done.Text.Equals("KEEP SORTING"))
                {
                    i = 1;
                    Thread.Sleep(150);
                }
                if (!(Done.Text.Equals("KEEP SORTING")))
                {
                    notDone = false;
                }
            }
            Done.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #27
0
        public void test()
        {
            int count = 1;

            try
            {
                while (count < 100)
                {
                    IWebElement row = PropertiesCollection.driver.FindElement(By.XPath("//*[@id=\"rowCountTable\"]/tbody/tr[" + count + "]"));
                    count++;
                }
            }
            catch (NoSuchElementException e)
            {
                count = count - 1;
            }
            SetMethods.EnterText(rowCount, "" + count);
            DoneBtn.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #28
0
        public void test()
        {
            ClickMe.Click();
            string              text       = GetMethods.GetTextValue(GenerateText);
            SelectElement       selectList = new SelectElement(ddl);
            IList <IWebElement> options    = selectList.Options;

            for (int j = 2; j < options.Count; j++)
            {
                string optionText = options[j].Text.ToString();
                Console.WriteLine("{0} : {1}", text, optionText);
                if (text.Equals(optionText))
                {
                    SetMethods.SelectDropDown(ddl, optionText);
                    break;
                }
            }
            Submit.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
コード例 #29
0
 public void test()
 {
     if (FN1.Text.Equals("John") && LN1.Text.Equals("Doe"))
     {
         editBtn1.Click();
     }
     if (FN2.Text.Equals("John") && LN2.Text.Equals("Doe"))
     {
         editBtn2.Click();
     }
     if (FN3.Text.Equals("John") && LN3.Text.Equals("Doe"))
     {
         editBtn3.Click();
     }
     if (FN4.Text.Equals("John") && LN4.Text.Equals("Doe"))
     {
         editBtn4.Click();
     }
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }
コード例 #30
0
        public void test()
        {
            // Add 2 years to current date
            DateTime christmasDay = DateTime.Now.AddYears(2);
            int      month        = christmasDay.Month;
            int      day          = christmasDay.Day;

            // Find number of months to add to current month
            christmasDay = christmasDay.AddMonths(12 - month);

            // Find number of days to add or subtract from current day
            if (day > 25)
            {
                christmasDay = christmasDay.AddDays(-(day - 25));
            }
            else
            {
                christmasDay = christmasDay.AddDays(25 - day);
            }
            SetMethods.EnterText(EnterDay, "" + christmasDay.DayOfWeek);
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }