コード例 #1
0
        public void ApplyQuestionFilter()
        {
            string searchText = "restaurant";
            SearchResults <string, string> getsearchresults = new SearchResults <string, string>();
            List <string> entity = new List <string>();

            entity.Add("14");
            int   count = 0;
            Login login = new Login(driver, LoginType.Facebook);

            login.SignIn();
            FrilpHome home = new FrilpHome(driver);

            SeleniumHelper.ImplicitWait(driver, TimeSpan.FromSeconds(15));
            home.Search.SendKeys(searchText);
            SeleniumHelper.ImplicitWait(driver, TimeSpan.FromSeconds(25));
            home.SelectAutoCompleteSearch(searchText);
            FrilpBusiness business = new FrilpBusiness(driver);

            business.WaitForResults(searchText, TimeSpan.FromSeconds(20));
            home.ActivityTab.Click();
            FrilpActivity activity = new FrilpActivity(driver);

            activity.QuestionFilter.Click();
            count            = SeleniumHelper.ScrollWebPageGetCount(driver, By.ClassName("d_activity_list_item"));
            getsearchresults = activity.GetInvalidSearchResults(entity, count);
            Assert.IsFalse(getsearchresults.duplicateandInvalidItems.Count > 0 || getsearchresults.invalidItems.Count > 0);
        }
コード例 #2
0
 public void AskQuestion()
 {
     try
     {
         string questiontext = "Looking for a Chinese Restaurant";
         string category     = "restaurant";
         string location     = "Adyar";
         string user         = "******";
         Login  login        = new Login(driver, LoginType.Facebook);
         login.SignIn();
         FrilpHome home = new FrilpHome(driver);
         home.ActivityTab.Click();
         FrilpActivity activity = new FrilpActivity(driver);
         activity.QuestionFilter.Click();
         SeleniumHelper.ExplicitWait(driver, By.XPath("//div[@class='nav-top']//li[@id='link_ask']"), TimeSpan.FromSeconds(25));
         home.AskQuestion.Click();
         //driver.FindElement(By.XPath("//div[@class='nav-top']//li[@id='link_ask']")).Click();
         FrilpAskQuestion postquestion = new FrilpAskQuestion(driver);
         postquestion.MessageBox.SendKeys(questiontext);
         postquestion.Category.SendKeys(category);
         postquestion.SelectCategory(category);
         postquestion.Location.SendKeys(location);
         postquestion.SelectLocation(location);
         postquestion.TagUser.SendKeys(user);
         postquestion.SelectUser(user);
         postquestion.AskButton.Click();
         postquestion.OkButton.Click();
         Assert.IsTrue(postquestion.WaitForPublishedQuestion(questiontext));
     }
     catch (WebDriverTimeoutException ex)
     {
         Assert.Fail(ex.Message);
     }
     catch (NoSuchElementException ex)
     {
         Assert.Fail(ex.Message);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
コード例 #3
0
        public bool WaitForPublishedQuestion(string text)
        {
            bool          isvisible = false;
            int           limit     = 0;
            FrilpActivity activity  = new FrilpActivity(_driver);

            while (!isvisible)
            {
                SeleniumHelper.ImplicitWait(_driver, TimeSpan.FromSeconds(5));
                isvisible = _driver.FindElements(By.XPath(string.Format("//div[contains(@class,'postcontent')]/p[contains(text(),'{0}')]", text))).Count > 0;
                activity.QuestionFilter.Click();
                limit++;
                if (limit > 30)
                {
                    isvisible = true;
                }
            }
            if (limit > 30)
            {
                return(false);
            }
            return(true);
        }