Esempio n. 1
0
        public void TestMethod1()
        {
            LipsumLandingPage lipsum = new LipsumLandingPage();

            List <int> numOfWords = new List <int> {
                5, 20, -1, 0, 15, 50
            };

            for (int i = 0; i < numOfWords.Count; i++)
            {
                lipsum.GenerateLorem("words", numOfWords[i]);
                lipsum.WaitToLoad();
                LipsumResultParagraph result = new LipsumResultParagraph();

                string bodyText = result.GetBodyText();

                int j   = 0;
                int cnt = 1;
                while (j <= bodyText.Length - 1)
                {
                    if (bodyText[j] == ' ')
                    {
                        cnt++;
                    }
                    j++;
                }
                Assert.AreEqual(numOfWords[i], cnt);
                result.driver.Navigate().Back();
                lipsum.WaitToLoad();
            }
            lipsum.driver.Quit();
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            LipsumLandingPage lipsum = new LipsumLandingPage();

            List <string> paragraphs      = new List <string>();
            int           numOfParagraphs = 5;
            int           numOfRuns       = 2;
            int           cnt             = 0;

            //string text = "";
            for (int i = 0; i < numOfRuns; i++)
            {
                lipsum.StartWithChkbox();
                lipsum.GenerateLorem("paragraphs", numOfParagraphs);
                lipsum.WaitToLoad();
                LipsumResultParagraph result = new LipsumResultParagraph();

                //adding all paragraphs on a page to a list
                foreach (var element in result.driver.FindElements(By.TagName("p")))
                {
                    paragraphs.Add(element.Text.ToLower());
                }

                for (int j = 0; j < numOfParagraphs; j++)
                {
                    if (paragraphs[j].Contains("lorem"))
                    {
                        cnt++;
                    }
                }

                //for (int j = 0; j < numOfParagraphs; j++)
                //    text = result.GetParagraphText();
                //{
                //    if (text.ToLower().Contains("lorem"))
                //    {
                //        cnt++;
                //    }
                //}
                result.driver.Navigate().Back();
                paragraphs.Clear();
                lipsum.WaitToLoad();
            }
            Assert.IsTrue(cnt / numOfRuns >= 3, cnt / numOfRuns + " - less than three");
            lipsum.driver.Quit();
        }