def check_adjusted_responses(self, *responses): self.actual_response_values = Utilities.get_values_as_a_list( responses[1]) self.expected_response_type = Utilities.get_values_as_a_list( responses[2])[0] total_turnover = self.get_adjusted_response( contributor_details.TOTAL_TURNOVER_QUESTION_ELEMENT) internet_sales = self.get_adjusted_response( contributor_details.INTERNET_SALES_QUESTION_ELEMENT) t_turnover = self.compare_values(total_turnover, 0) i_sales = self.compare_values(internet_sales, 1) ReportingHelper.check_single_message_matches( contributor_details.TOTAL_TURNOVER_QUESTION_ELEMENT, t_turnover, self.expected_response_type) ReportingHelper.check_single_message_matches( contributor_details.INTERNET_SALES_QUESTION_ELEMENT, i_sales, self.expected_response_type)
def check_multiple_comment_text_messages(self, question_codes): survey = question_codes[0] questions_list = question_codes[1] commodity_values = Utilities.get_values_as_a_list(question_codes[2]) if len(questions_list) > 1: count = 0 for question in questions_list: question_element = Utilities.get_question_code_element( survey, question) question_actual_text = SeleniumCore.get_attribute_element_text( By.ID, question_element) commodity_value = Utilities.convert_blank_data_value( commodity_values[count]) ReportingHelper.check_single_message_matches( question_element, question_actual_text, commodity_value)
def submit_values_for_survey_questions(self, questions_and_values): period = questions_and_values[0] period_start_date = questions_and_values[1] self.submit_default_period_dates(period, period_start_date) survey = questions_and_values[2] questions_list = questions_and_values[3] commodity_values = Utilities.get_values_as_a_list( questions_and_values[4]) if len(commodity_values) > 1 and type(questions_list) == list: self.submit_values_as_a_list_for_multiple_questions( survey, questions_list, commodity_values) elif len(commodity_values) == 1 and type(questions_list) == list: self.submit_single_value_for_multiple_questions( survey, questions_list, commodity_values[0]) else: self.submit_single_value_per_question(survey, questions_list, commodity_values[0])
def check_historic_data_matches_with_current_period_data( self, survey, question_codes, values, tab_name): self.switch_to_the_tab(tab_name) if len(question_codes) > 1: values = Utilities.get_values_as_a_list(values) count = 0 for value in values: question_row = GetContributorDetails(). \ get_question_code_row_details('tabId2', Utilities.get_question_code_element( survey, question_codes[count])) elements = contributor_details.CURRENT_PERIOD_COLUMN current_period_value = question_row.find_elements( By.XPATH, elements) ReportingHelper.check_elements_message_matches( question_codes[count], current_period_value, value) count += 1