def check_pop_ratio_of_ratios_validation(self, factor_type, operator_type,
                                             threshold_value, result):
        CheckMessagesContributorDetails(
        ).check_if_overall_validation_triggered()
        is_validation_triggered = False
        if factor_type == 'increase':
            value_one = int(cp_internet_sales) * int(pp_total_sales)
            value_two = int(cp_total_sales) * int(pp_internet_sales)
            is_validation_triggered = ReportingHelper.compare_the_values_with_operator(
                operator_type, value_one,
                int(threshold_value) * value_two)

        elif factor_type == 'decrease':
            value_one = int(cp_total_sales) * int(pp_internet_sales)
            value_two = int(cp_internet_sales) * int(pp_total_sales)
            is_validation_triggered = ReportingHelper.compare_the_values_with_operator(
                operator_type, value_one,
                int(threshold_value) * value_two)

        elif factor_type == 'not-applicable':
            is_validation_triggered = 'false'

        ReportingHelper.check_single_message_matches(
            'Q21', result,
            str(is_validation_triggered).lower())
 def run_the_validation_process(self, total_turnover_value,
                                exp_derived_value):
     SeleniumCore.set_current_data_text(
         self.QUESTION_TOTAL_TURNOVER_ELEMENT, total_turnover_value)
     CheckValuesContributorDetails().save_the_application()
     actual_derived_val = SeleniumCore.get_attribute_element_text(
         *RsiContributorDetailsPage.QUESTION_DERIVED_ELEMENT)
     ReportingHelper.check_single_message_matches('Q7034',
                                                  actual_derived_val,
                                                  exp_derived_value)
 def run_the_validation_process(self, threshold_primary_value,
                                exp_derived_value):
     SeleniumCore.set_current_data_text(
         details.THRESHOLD_PRIMARY_QUESTION_ELEMENT,
         threshold_primary_value)
     CheckValuesContributorDetails().save_the_application()
     actual_derived_val = SeleniumCore.get_attribute_element_text(
         By.ID, details.THRESHOLD_DERIVED_QUESTION_ELEMENT)
     ReportingHelper.check_single_message_matches('Q12', actual_derived_val,
                                                  exp_derived_value)
 def check_the_override_message(self, survey, question_code, exp_msg):
     exp_msg = GetContributorDetails().get_validation_message(
         survey, exp_msg)
     question_row = GetContributorDetails().get_question_code_row_details(
         contributor_details.CURRENT_DATA_TAB_ELEMENT, question_code)
     elements = contributor_details.ERROR_MESSAGES_COLUMN + contributor_details.ERROR_LABEL
     override_messages_elements = question_row.find_elements(
         By.XPATH, elements)
     ReportingHelper.check_elements_message_matches(
         question_code, override_messages_elements, exp_msg)
 def check_historic_data_back_periods(self, periods):
     table = self.driver.find_element_by_id("tabId2")
     rows = table.find_elements_by_tag_name("tr")
     periods = self.sort_periods_order(periods)
     for i in range(0, 1):
         cols = rows[i].find_elements_by_tag_name("th")
         count = 1
         for period in periods:
             ReportingHelper.check_single_message_matches(
                 'Question', cols[count].text, period)
             count += 1
Ejemplo n.º 6
0
    def run_the_validation_process(self, questions):
        questions_list = questions[0]
        comparing_question_value = Utilities.convert_blank_data_value(questions[1])
        derived_question_value = Utilities.convert_blank_data_value(questions[2])
        survey = Utilities.convert_blank_data_value(questions[3])

        comparing_question_element = Utilities.get_question_code_element(survey, questions_list[0])
        derived_question_element = Utilities.get_question_code_element(survey, questions_list[1])
        SeleniumCore.set_current_data_text(comparing_question_element, comparing_question_value)
        CheckValuesContributorDetails().save_the_application()
        actual_derived_val = SeleniumCore.get_attribute_element_text(By.ID, derived_question_element)
        if derived_question_value == '':
            derived_question_value = '0'
        ReportingHelper.check_single_message_matches(questions_list[1], actual_derived_val, derived_question_value)
 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)
Ejemplo n.º 8
0
 def select_the_form_row(self, reference, period, sic_code):
     table = SeleniumCore.wait_for_element_to_be_displayed(
         By.ID, "ResultsTable")
     rows = table.find_elements_by_tag_name("tr")
     # Ignore the first row
     for i in range(1, len(rows)):
         cols = rows[i].find_elements_by_tag_name("td")
         # Check to see the sic code exists
         if sic_code:
             ReportingHelper.check_single_message_matches(
                 reference, cols[i + 6].text, sic_code)
         # Check to see if any references appear that shouldn't be there
         if cols[1].text == reference and cols[2].text == period:
             view_form = rows[i].find_elements_by_tag_name("button")
             SeleniumCore.select_view_form(view_form[0])
             break
    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
Ejemplo n.º 10
0
    def check_values_are_not_equal(self, question, comparison_val_one,
                                   comparison_val_two, result):
        CheckMessagesContributorDetails(
        ).check_if_overall_validation_triggered()
        if comparison_val_one == 'blank' and comparison_val_two == 'blank':
            comparison_val_one = Utilities.convert_blank_data_value(
                comparison_val_one)
            comparison_val_two = Utilities.convert_blank_data_value(
                comparison_val_two)
            is_validation_exists = ReportingHelper.compare_strings(
                comparison_val_one, comparison_val_two)

        else:
            is_validation_exists = ReportingHelper.compare_values_are_not_equal(
                comparison_val_one, comparison_val_two)
        ReportingHelper.check_single_message_matches(
            question, result,
            str(is_validation_exists).lower())
Ejemplo n.º 11
0
    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)
Ejemplo n.º 12
0
    def check_values_movement_to_or_from_zero(self, question_codes,
                                              comparison_val_one,
                                              comparison_val_two, result):
        CheckMessagesContributorDetails(
        ).check_if_overall_validation_triggered()
        if len(question_codes) > 1:
            for question in question_codes:
                if comparison_val_one == 'blank' and comparison_val_two == 'blank':
                    value_one = Utilities.convert_blank_data_value(
                        comparison_val_one)
                    value_two = Utilities.convert_blank_data_value(
                        comparison_val_two)
                    is_validation_exists = ReportingHelper.compare_strings(
                        value_one, value_two)

                else:
                    is_validation_exists = ReportingHelper.compare_the_zero_movement_values(
                        comparison_val_one, comparison_val_two)
                ReportingHelper.check_single_message_matches(
                    question, result,
                    str(is_validation_exists).lower())
    def check_validation_message(self, survey, question_type, exp_msg,
                                 is_validation_exists):
        self.check_if_overall_validation_triggered()
        exp_msg = GetContributorDetails().get_validation_message(
            survey, exp_msg)

        no_of_msgs = GetContributorDetails(
        ).get_no_of_validation_error_messages_per_question(question_type)
        if len(no_of_msgs) == 0:
            if is_validation_exists == 'be':
                ReportingHelper.check_elements_message_matches(
                    question_type, no_of_msgs, exp_msg)
            elif is_validation_exists == 'not be':
                act_msg = ''
                ReportingHelper.check_multiple_messages_not_matches(
                    question_type, act_msg, exp_msg)
        elif len(no_of_msgs) > 0:
            if is_validation_exists == 'be':
                ReportingHelper.check_elements_message_matches(
                    question_type, no_of_msgs, exp_msg)
            elif is_validation_exists == 'not be':
                ReportingHelper.check_multiple_messages_not_matches(
                    question_type, no_of_msgs, exp_msg)
 def check_if_overall_validation_triggered(self):
     if GetContributorDetails().get_no_of_validation_error_messages() >= 0:
         ReportingHelper.check_single_message_not_matches(
             GetContributorDetails().get_validation_status().lower(),
             'form saved', '', 'Please check, Overall validation failed')
 def check_validation_msg_matches(self, operator_type, comparison_val_one,
                                  comparison_val_two, result):
     self.check_if_overall_validation_triggered()
     ReportingHelper.compare_the_messages(operator_type, comparison_val_one,
                                          comparison_val_two, result)
 def check_the_override_checkbox_displayed(self, question):
     question_row = GetContributorDetails().get_question_code_row_details(
         contributor_details.CURRENT_DATA_TAB_ELEMENT, question)
     check_boxes = question_row.find_elements(
         By.NAME, contributor_details.OVERRIDE_CHECKBOX_ELEMENT)
     ReportingHelper.compare_values(len(check_boxes), 1)