def mark_major_marks_standart_comment(self,marks): comments = Comments(self.browser, self.logger) buttons = Buttons(self.browser, self.logger) for mark in marks: photo_href1 = self.get_photo2mark_href() self.click(mark) compliments = self.get_random_compliments() self.logger.log("Amount of compliments avaliable = " + str(len(compliments))) compliments_error_threshold = math.ceil(len(compliments)/2) self.logger.log("Compliments change error threshold = " + str(compliments_error_threshold)) error_count = 0 for compliment in compliments: self.click(compliment) sleep(3) try: comments.validate_high_mark_comment_value(compliment.text) except Exception: error_count += 1 if error_count >= compliments_error_threshold: raise TestFailedException("Faield standart comment sending functionality. " +\ "Error count during sending comments = " + str(error_count)) buttons.send_comment("topmark") photo_href2 = self.get_photo2mark_href() try: self.click( self.get_element_by_xpath(self._fb_popup_close_link_xpath)) except Exception: self.logger.log("Fb Popup was not found") try: print photo_href1 print photo_href2 assert photo_href1 != photo_href2 except AssertionError: raise TestFailedException("User photo hasn't changed")
def send_comment(self,element,value,comment_type): buttons = Buttons(self.browser, self.logger) self.enter_text(element,value) self.validate_high_mark_comment_value(value) buttons.send_comment(comment_type)