def element_has_css_class_name(self, xpath, css_class_name, result_should_be_true): print_debug_info("Calling [element_has_css_class_name].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: actual_result = self.get_page_object().get_element(xpath, Global.PageTimeout.QUICK_IGNORE) \ .get_attribute('class').find(css_class_name) >= 0 if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] doesn't have CSS class ['%s']." % \ (BasicAssertion.checkpoint_counter, xpath, css_class_name)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] has an unexpected CSS class ['%s']." % \ (BasicAssertion.checkpoint_counter, xpath, css_class_name)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_element_blurb_id(self, xpath, blurb_id, result_should_be_true): print_debug_info("Calling [check_element_blurb_id].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: actual_blurb_id = self.get_page_object().get_element(xpath, Global.PageTimeout.QUICK_IGNORE)\ .get_attribute('data-blurb-id') actual_result = actual_blurb_id == blurb_id if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] doesn't have blurb id ['%s'], actually it's ['%s']." % \ (BasicAssertion.checkpoint_counter, xpath, blurb_id, actual_blurb_id)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] has an unexpected blurb id ['%s']." % \ (BasicAssertion.checkpoint_counter, xpath, blurb_id)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def elements_should_be_existing_with_expected_number( self, xpath="\\", expected_number=15): # 15,this default number, is the maximum number of words can be displayed on one page. print_debug_info( "Calling[elements_should_be_existing_with_expected_number].") return self.page_assertion_obj.check_element_count( xpath, expected_number)
def element_is_displayed_with_text(self, xpath, expected_text, exact_match): print_debug_info("Calling [element_is_displayed_with_text].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: element = self.get_page_object().get_element( xpath, Global.PageTimeout.QUICK_IGNORE) is_visible = self._check_element_visibility(xpath, element) if not is_visible: return [False, str(BasicAssertion.checkpoint_counter)] actual_text = element.text if exact_match: actual_result = (expected_text == actual_text) else: try: actual_result = actual_text.find(expected_text) >= 0 except TimeoutException: actual_result = False if not actual_result: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] should display ['%s'], but actually displays ['%s']."\ % (BasicAssertion.checkpoint_counter, xpath, expected_text, actual_text)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_element_count(self, xpath, expected_number): print_debug_info("Calling [check_element_count].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: element_count = 0 try: elements = self.get_page_object().get_elements(xpath) if elements: element_count = len(elements) actual_result = element_count == expected_number else: actual_result = False except TimeoutException: actual_result = False if actual_result == False: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] The actual number of elements ['%s'] is [%s]; the expected number is [%s]." \ % (BasicAssertion.checkpoint_counter, xpath, str(element_count), str(expected_number))) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def element_is_displayed(self, xpath, result_should_be_true): print_debug_info("Calling [element_is_displayed].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: try: if self.get_page_object().element_exists( xpath, Global.PageTimeout.QUICK_IGNORE): actual_result = self.get_page_object().get_element(xpath, Global.PageTimeout.QUICK_IGNORE)\ .is_displayed() else: actual_result = False except TimeoutException: actual_result = False if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] not displayed." % (BasicAssertion.checkpoint_counter, xpath)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] displayed." % (BasicAssertion.checkpoint_counter, xpath)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def is_text_existing(self, text, result_should_be_true): print_debug_info("Calling [is_text_existing].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: # xpath here is just a search pattern for getting all text on the page combined as a string xpath = "//*[contains(., '')]" try: actual_result = self.get_page_object().get_element_text( xpath).replace('\n', ' ').find(text) >= 0 except TimeoutException: actual_result = False if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Text ['%s'] not found." % (BasicAssertion.checkpoint_counter, text)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Text ['%s'] found." % (BasicAssertion.checkpoint_counter, text)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_lesson_block_status(self, status, expected_status_string): print_debug_info("Calling [check_lesson_block_status].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: page_object = self.get_page_object(Global.PageType.UNIT_PAGE) if page_object: actual_result = page_object.get_lesson_block_view_string_by_status( status) if actual_result != expected_status_string: if status == 'active': BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Active lesson index string is [%s], but expecting is [%s]."\ % (BasicAssertion.checkpoint_counter, actual_result, expected_status_string)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Inactive lesson index string is [%s], but expecting is [%s]."\ % (BasicAssertion.checkpoint_counter, actual_result, expected_status_string)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, \ Global.PageType.UNIT_PAGE)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_element_text_by_blurb_id(self, xpath, blurb_id, result_should_be_true): print_debug_info("Calling [check_element_text_by_blurb_id].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: expected_text = ServiceHelper.get_blurb_translation(blurb_id) actual_text = self.get_page_object().get_element_text(xpath) actual_result = actual_text == expected_text if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] should display ['%s'], but actually displays ['%s']."\ % (BasicAssertion.checkpoint_counter, xpath, expected_text, actual_text)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] displays an unexpected text['%s']."\ % (BasicAssertion.checkpoint_counter, xpath, expected_text)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_activity_container_summary_navigator_status( self, result_should_be_true): print_debug_info( "Calling [check_activity_container_summary_navigator_status].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: page_object = self.get_page_object(Global.PageType.LESSON_PAGE) if page_object: actual_result = page_object.get_summary_navigator_status() if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Summary navigator status is ['Normal']."\ % (BasicAssertion.checkpoint_counter)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Summary navigator status is ['Passed']."\ % (BasicAssertion.checkpoint_counter)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, \ Global.PageType.ACTIVITY_CONTAINER_PAGE)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def is_on_right_page(self, expected_partial_url, result_should_be_true, pattern='contains'): print_debug_info("Calling [is_on_right_page].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: current_url = self.get_page_object().current_url actual_result = False if pattern == 'endwith': actual_result = current_url.endswith(expected_partial_url) else: actual_result = current_url.find(expected_partial_url) >= 0 if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Isn't on the right page. Expected URL should contains '%s', but current URL is %s." \ % (BasicAssertion.checkpoint_counter, expected_partial_url, current_url)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Isn't on the right page. Expected URL should not contain '%s', but current URL is %s." \ % (BasicAssertion.checkpoint_counter, expected_partial_url, current_url)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_lesson_step_status(self, step_index, expected_status): print_debug_info("Calling [check_lesson_step_status].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: page_object = self.get_page_object(Global.PageType.LESSON_PAGE) if page_object: actual_result = page_object.get_step_status_by_step_index( step_index) if actual_result != expected_status: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Step status is ['%s'] actually, and expected status is ['%s']."\ % (BasicAssertion.checkpoint_counter, actual_result, expected_status)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, \ Global.PageType.LESSON_PAGE)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def element_should_not_be_displayed_same_value_as_blurb_id( self, xpath="\\", blurb_id=""): print_debug_info( "Calling [element_should_not_be_displayed_same_value_as_blurb_id]." ) return self.page_assertion_obj.check_element_text_by_blurb_id( xpath, blurb_id, False)
def check_activity_navigator_status_by_page_type(self, page_type, status, \ expected_indexer_string, result_should_be_true): print_debug_info( "Calling [check_activity_container_activity_navigator_status].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: page_object = self.get_page_object(page_type) if page_object: actual_indexer_string = page_object.get_activity_index_string_by_status( status) actual_result = actual_indexer_string == expected_indexer_string if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Not all activity [%s] are [%s]."\ % (BasicAssertion.checkpoint_counter, expected_indexer_string, status)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Activity [%s] are [%s]."\ % (BasicAssertion.checkpoint_counter, expected_indexer_string, status)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, page_type)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def activity_container_passed_navigator_indexer_should_not_be( self, expected_indexer_string): print_debug_info( "Calling [activity_container_passed_navigator_indexer_should_not_be]." ) return self.page_assertion_obj.check_activity_navigator_status_by_page_type( \ Global.PageType.ACTIVITY_CONTAINER_PAGE, 'passed', expected_indexer_string, False)
def check_epaper_is_expanded(self, result_should_be_true): print_debug_info("Calling [check_epaper_is_expanded].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: if re.search(Global.WebElementStatus.REG_EXPANDED,\ self.get_page_object().get_element_attribute_value_by_name(EPAPER_CONTAINER_XPATH, 'class')): actual_result = True else: actual_result = False if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] ePaper is [Not expanded]." % (BasicAssertion.checkpoint_counter)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] ePaper is [Expanded]." % (BasicAssertion.checkpoint_counter)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_activity_navigator_status(self, result_should_be_true): print_debug_info("Calling [check_activity_navigator_status].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) def load_activity_navigator_status(): #search for the presence of a passed pattern match = re.search(Global.WebElementStatus.REG_PASSED, \ element_parent_of_current_navigation_balloon.get_attribute('class')) if (result_should_be_true and match) or (not result_should_be_true and not match): return True else: return False try: page_object = self.get_page_object(Global.PageType.ACTIVITY_PAGE) if page_object: activity_id = page_object.activity.activity_id element_current_navigation_balloon = page_object.get_element(\ CURRENT_ACTIVITY_NAVIGATION_PATTERN % activity_id, Global.PageTimeout.QUICK_IGNORE) element_parent_of_current_navigation_balloon = \ element_current_navigation_balloon.find_element_by_xpath("..") actual_result = result_should_be_true retry = 0 while not load_activity_navigator_status(): time.sleep(Global.PageTimeout.RETRY_INTERVAL) retry += 1 print "Retry times #%s for checking status of activity navigator after %s seconds..." \ % (retry, Global.PageTimeout.RETRY_INTERVAL) if retry > Global.RetryTimes.MAX: actual_result = not result_should_be_true break if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Activity Navigation State is [Normal]." % (BasicAssertion.checkpoint_counter)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Activity Navigation State is [Passed]." % (BasicAssertion.checkpoint_counter)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, Global.PageType.ACTIVITY_PAGE)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def _terminate_when_checkpoint_raise_exception(error_message, message_parameters=()): print_debug_info( "Calling [_terminate_when_checkpoint_raise_exception].") message_parameters = ( BasicAssertion.checkpoint_counter, ) + message_parameters BasicAssertion._append_assertion_error_message(error_message % message_parameters) return [False, str(BasicAssertion.checkpoint_counter)]
def _check_element_visibility(self, xpath, element=None): print_debug_info("Calling [_check_element_visibility].") if not element: element = self.get_page_object().get_element( xpath, Global.PageTimeout.QUICK_IGNORE) if not element.is_displayed(): BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] not displayed when checking visibility." % \ (BasicAssertion.checkpoint_counter, xpath)) return False else: return True
def collect_checkpoint_results(self): print_debug_info("Calling [collect_checkpoint_results].") ''' Reset assertion checkpoint index counter after statistics complate ''' BasicAssertion.checkpoint_counter = 0 if BasicAssertion.errors: errorMessage = '' for err in BasicAssertion.errors: errorMessage = errorMessage + err + '\n' ''' Reset assertion errors after statistics complate ''' BasicAssertion.errors = list() raise AssertionError(errorMessage)
def element_is_enabled(self, xpath, result_should_be_true): print_debug_info("Calling [element_is_enabled].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: element = self.get_page_object().get_element( xpath, Global.PageTimeout.QUICK_IGNORE) is_visible = self._check_element_visibility(xpath, element) if not is_visible: return [False, str(BasicAssertion.checkpoint_counter)] value = self.get_page_object().get_element_attribute_value_by_name( xpath, 'class') pattern = Global.WebElementStatus.REG_DISABLED if re.search(pattern, value) or not element.is_enabled(): actual_result = False else: actual_result = True if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] disabled." % (BasicAssertion.checkpoint_counter, xpath)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Element ['%s'] enabled." % (BasicAssertion.checkpoint_counter, xpath)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_lesson_attribute_value(self, lesson_index, attribute_name, \ expected_attribute_value, result_should_be_true): print_debug_info("Calling [check_lesson_attribute_value].") if not self._is_ready_to_check: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_NOT_READY_TO_CHECK) try: page_object = self.get_page_object(Global.PageType.UNIT_PAGE) if page_object: actual_attribute_value = str(getattr(page_object.lesson_page_objects[int(lesson_index) - 1], \ attribute_name)) actual_result = actual_attribute_value == expected_attribute_value if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Lesson #%s's %s is ['%s'] actually, but expecting is ['%s']." \ % (BasicAssertion.checkpoint_counter, lesson_index, attribute_name, \ actual_attribute_value, expected_attribute_value)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] Lesson #%s's %s is ['%s'] actually, but expecting is not ['%s']." \ % (BasicAssertion.checkpoint_counter, lesson_index, attribute_name, \ actual_attribute_value, expected_attribute_value)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] else: BasicAssertion._append_assertion_error_message( \ ERROR_MESSAGE_NOT_ON_RIGHT_PAGE % (BasicAssertion.checkpoint_counter, \ Global.PageType.UNIT_PAGE)) return [False, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def check_specific_node_is_passed(self, course_query_string, result_should_be_true): print_debug_info("Calling [check_specific_node_is_passed].") try: actual_result = ServiceHelper.get_course_structure_state(Global.COOKIES['cookies'], \ course_query_string) if actual_result != result_should_be_true: if result_should_be_true: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] '%s' should be passed."\ % (BasicAssertion.checkpoint_counter, course_query_string)) else: BasicAssertion._append_assertion_error_message(\ "[Checkpoint #%s] '%s' should be not passed."\ % (BasicAssertion.checkpoint_counter, course_query_string)) return [False, str(BasicAssertion.checkpoint_counter)] else: return [True, str(BasicAssertion.checkpoint_counter)] except Exception, e: return BasicAssertion._terminate_when_checkpoint_raise_exception( \ ERROR_MESSAGE_EXCEPTION_HAPPENS, (str(e),))
def current_activity_navigation_status_should_be_passed(self): print_debug_info( "Calling [current_activity_navigation_status_should_be_passed].") return self.page_assertion_obj.check_activity_navigator_status(True)
def element_should_not_have_css_class_name(self, xpath="\\", css_class_name=""): print_debug_info("Calling [element_should_not_have_css_class_name].") return self.page_assertion_obj.element_has_css_class_name( xpath, css_class_name, False)
def innertext_of_element_should_contain(self, xpath="\\", text=""): print_debug_info("Calling [innertext_of_element_should_contain].") return self.page_assertion_obj.element_is_displayed_with_text( xpath, text, False)
def element_should_be_disabled(self, xpath="\\"): print_debug_info("Calling [element_should_be_disabled].") return self.page_assertion_obj.element_is_enabled(xpath, False)
def element_should_be_displayed(self, xpath="\\"): print_debug_info("Calling [element_should_be_displayed].") return self.page_assertion_obj.element_is_displayed(xpath, True)
def current_url_should_not_contain(self, partial_url): print_debug_info("Calling [current_url_should_not_contain].") return self.page_assertion_obj.is_on_right_page(partial_url, False)
def current_url_should_end_with(self, partial_url): print_debug_info("Calling [current_url_should_end_with].") return self.page_assertion_obj.is_on_right_page( partial_url, True, 'endwith')