Ejemplo n.º 1
0
 def validate_search_users_in_search_age(self,age_interval):
     search = SearchBox(self.browser,self.logger)
     profile_ages = search.get_users_profile_age_dict()
     for profile in profile_ages:
         try:
             self.logger.log("\r\nComparing " + str(profile_ages[profile]) + " in " + str(age_interval))
             if age_interval[1] >= self.max_filter_age:
                 self.logger.log("More than Max")
                 if profile_ages[profile] < age_interval[0]:
                     raise TestFailedException("Failed to validate user age \r\n Found age = " + str(profile_ages[profile]) +
                                               "\r\n Expected interval: " + str(age_interval) + " LESS THAN MINIMUM \r\n" +
                                                 " User profile = " + profile)
             else:
                 if profile_ages[profile] < age_interval[0] or profile_ages[profile] > age_interval[1]:
                     raise TestFailedException("Failed to validate user age \r\n Found age = " + str(profile_ages[profile]) +
                                               "\r\n Expected interval: " + str(age_interval) + "\r\n" +
                                               " User profile = " + profile)
         except Exception:
             raise TestFailedException("Failed to validate user age in interval: \n\r" + traceback.format_exc())
Ejemplo n.º 2
0
 def validate_in_search_goal(self,goal,online=True):
     search_box = SearchBox(self.browser,self.logger)
     try:
         online_count = 0
         for i in range(search_box.get_users_amount()):
             curr_user_xpath = search_box.get_users_xpath() + "[" + str(i+1) + "]"
             user = self.get_element_by_xpath(curr_user_xpath)
             self.hover(user)
             self.logger.log("Validating " + str(search_box.get_user_profile(curr_user_xpath)) + "\r\n")
             if online:
                 try:
                     self.wait4xpath(settings.wait_for_element_time,curr_user_xpath + search_box.get_user_online_xpath())
                 except Exception:
                     self.logger.log("FAILED 2FIND ONLINE")
                     online_count += 1
                     if online_count == self._search_treshold:
                         raise TestFailedException("Didn't find ONLINE status from 3 users")
             self.logger.log("validating user goal status in search")
             self.wait4xpath(settings.wait_for_element_time,curr_user_xpath + search_box.get_user_goal_xpath(goal))
     except Exception as e:
         raise TestFailedException("Failed to validate user from filter search with goal = " + str(goal) + "\n\r" +
                                       traceback.format_exc())