Esempio n. 1
0
 def submit_sales_value(self, period, period_start_date, survey, value,
                        question):
     value = Utilities.convert_blank_data_value(value)
     question_element = Utilities.get_question_code_element(
         survey, question)
     self.submit_default_period_dates(period, period_start_date)
     SeleniumCore.set_current_data_text(question_element, value)
Esempio n. 2
0
 def submit_period_dates(self, start_date=None, end_date=None):
     if start_date or end_date is not None:
         st_date = Utilities.convert_blank_data_value(start_date)
         en_date = Utilities.convert_blank_data_value(end_date)
         self.set_period_start_date(st_date)
         self.set_period_end_date(en_date)
     else:
         self.submit_default_period_dates()
 def submit_cp_sales_values(self, validation_type, internet_sales,
                            total_sales):
     global cp_internet_sales, cp_total_sales
     cp_internet_sales = Utilities.convert_blank_data_value(internet_sales)
     cp_total_sales = Utilities.convert_blank_data_value(total_sales)
     self.set_internet_sales_value(validation_type, cp_internet_sales)
     self.set_total_turnover_sales_value(validation_type, cp_total_sales)
     CheckValuesContributorDetails().save_the_application()
Esempio n. 4
0
 def submit_period_dates(self, period, start_date, end_date):
     RsiDateAdjustedResponseValidation.period = period
     RsiDateAdjustedResponseValidation.start_date = Utilities.convert_blank_data_value(
         start_date)
     RsiDateAdjustedResponseValidation.end_date = Utilities.convert_blank_data_value(
         end_date)
     SubmitContributorDetails().submit_period_dates(
         RsiDateAdjustedResponseValidation.start_date,
         RsiDateAdjustedResponseValidation.end_date)
 def submit_pp_sales_values(self, validation_type, internet_sales,
                            total_sales):
     global pp_internet_sales, pp_total_sales
     pp_internet_sales = Utilities.convert_blank_data_value(internet_sales)
     pp_total_sales = Utilities.convert_blank_data_value(total_sales)
     self.set_internet_sales_value(validation_type, pp_internet_sales)
     self.set_total_turnover_sales_value(validation_type, pp_total_sales)
     CheckValuesContributorDetails().save_the_application()
     SeleniumCore.close_the_current_window()
Esempio n. 6
0
 def submit_single_value_for_multiple_questions(self, survey,
                                                questions_list,
                                                commodity_value):
     for question in questions_list:
         question_element = Utilities.get_question_code_element(
             survey, question)
         commodity_value = Utilities.convert_blank_data_value(
             commodity_value)
         SeleniumCore.set_current_data_text(question_element,
                                            commodity_value)
 def submit_cp_sales_values(self, period, period_start_date, internet_sales,
                            total_sales):
     global cp_internet_sales, cp_total_sales
     cp_internet_sales = Utilities.convert_blank_data_value(internet_sales)
     cp_total_sales = Utilities.convert_blank_data_value(total_sales)
     SubmitContributorDetails().submit_default_period_dates(
         period, period_start_date)
     self.set_internet_sales_value(cp_internet_sales)
     self.set_total_turnover_sales_value(cp_total_sales)
     CheckValuesContributorDetails().save_the_application()
 def submit_pp_sales_values(self, period, period_start_date, internet_sales,
                            total_sales):
     global pp_internet_sales, pp_total_sales
     pp_internet_sales = Utilities.convert_blank_data_value(internet_sales)
     pp_total_sales = Utilities.convert_blank_data_value(total_sales)
     SubmitContributorDetails().submit_default_period_dates(
         period, period_start_date)
     self.set_internet_sales_value(pp_internet_sales)
     self.set_total_turnover_sales_value(pp_total_sales)
     CheckValuesContributorDetails().save_the_application()
     SeleniumCore.close_the_current_window()
Esempio n. 9
0
 def submit_values_as_a_list_for_multiple_questions(self, survey,
                                                    questions_list,
                                                    commodity_values):
     if len(questions_list) > 1:
         count = 0
     for question in questions_list:
         question_element = Utilities.get_question_code_element(
             survey, question)
         SeleniumCore.set_current_data_text(
             question_element,
             Utilities.convert_blank_data_value(commodity_values[count]))
         if len(commodity_values) > 1:
             count += 1
Esempio n. 10
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)
    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
Esempio n. 13
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())
Esempio n. 14
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())
Esempio n. 15
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)
Esempio n. 16
0
    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])
Esempio n. 17
0
def after_scenario(context, scenario):
    # take screenshot if test failed
    Utilities.take_screen_shot(scenario)
    SeleniumCore.close_the_current_window()
    LoginPage().logout()
Esempio n. 18
0
def before_all(context):
    Utilities.delete_screenshots_folder()
    Browser.url()
    context.created_users = {}
    context.cognito = Cognito()
Esempio n. 19
0
 def submit_single_value_per_question(self, survey, questions_list,
                                      commodity_value):
     question_element = Utilities.get_question_code_element(
         survey, questions_list)
     SeleniumCore.set_current_data_text(question_element, commodity_value)
 def check_for_blank_validation(self, operator_type, value_one, value_two,
                                result):
     value_one = Utilities.convert_blank_data_value(value_one)
     val_two = Utilities.convert_blank_data_value(value_two)
     self.check_validation_msg_matches(operator_type, value_one, val_two,
                                       result)