예제 #1
0
    def test_ndp_validation_of_donation_type_second_case(
            self, expected_color_back, expected_color_text, expected_type,
            test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        query = "select top(1) DonT.Code+' '+DonT.Name from ref.DonationTypes DonT join ref.DonationTypeParams DonTP on DonT.UniqueId = DonTP.DonationTypeId where DonTP.IsActive = 1 and DonT.DonationParams not like '%4%' and DonT.ComponentType="

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980",
                                         "3608", "360471")

        main_page.select_gender('male')

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        main_page.if_donor_is_in_local_cabinet()

        main_page.ndp_filling_donation_type(
            sql_query(query + expected_type)[0][0])

        assert convert_to_hex(main_page.ndp_get_donation_type_color()).lower(
        ) == expected_color_back

        assert convert_to_hex(main_page.ndp_get_donation_type_text_color()
                              ).lower() == expected_color_text
    def test_deferral_type_color_and_type(self, expected_color, expected_type,
                                          test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page('Сидоров', "Алексей", "",
                                         "05.06.1980", "8914", "650235")

        main_page.select_gender('male')

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        main_page.if_donor_is_in_local_cabinet()

        main_page.ndp_second_page_loaded()

        if expected_type == 'Временный':
            main_page.ndp_filling_deferral(
                str(
                    sql_query(
                        "select top(1) DefT.Code+' '+DefT.Name Otvod from ref.DeferralTypes DefT join ref.DeferralTypeParams DefTP on DefT.UniqueId = DefTP.DeferralTypeId where DefTP.IsActive = 1 and DefT.BaseType = 3"
                    ))[3:-5])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
        elif expected_type == 'Контроль':
            main_page.ndp_filling_deferral(
                str(
                    sql_query(
                        "select top(1) DefT.Code+' '+DefT.Name Otvod from ref.DeferralTypes DefT join ref.DeferralTypeParams DefTP on DefT.UniqueId = DefTP.DeferralTypeId where DefTP.IsActive = 1 and DefT.BaseType = 2"
                    ))[3:-5])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
        elif expected_type == 'Абсолютный':
            main_page.ndp_filling_deferral(
                str(
                    sql_query(
                        "select top(1) DefT.Code+' '+DefT.Name Otvod from ref.DeferralTypes DefT join ref.DeferralTypeParams DefTP on DefT.UniqueId = DefTP.DeferralTypeId where DefTP.IsActive = 1 and DefT.BaseType = 1"
                    ))[3:-5])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
예제 #3
0
def get_background_color(elements=None, locators_list=None, element_name=None):
    if elements:
        return convert_to_hex(
            waiting_for_element_is_visible(
                elements=elements).value_of_css_property('background-color'))
    elif locators_list and element_name:
        return convert_to_hex(
            waiting_for_element_is_visible(
                locators_list=locators_list,
                element_name=element_name).value_of_css_property(
                    'background-color'))
예제 #4
0
    def test_grid_rh(self, query, expected_color, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query(query)

        donorid, rh = str(full_query[0][0]), full_query[0][1]

        main_page.clear_localstorage()

        main_page.open()

        aistium.fill(donorid, elements=main_page.quick_search_field)

        main_page.quick_search('click')

        main_page.loading_is_completed()

        ind = sql_query(
            "select Main.Nmb from (select row_number() over (order by PerC.BirthDate desc) Nmb, PerC.UniqueId from PersonCards PerC left join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId where PerC.IsDeleted != 1 and (PerC.UniqueId = '"
            + donorid + "' or IDoc.Number = '" + donorid +
            "')) Main where Main.UniqueId = '" + donorid + "'")[0][0]

        assert main_page.get_grid_values('Rh', ind, main_page.main_grid) == rh

        assert convert_to_hex(
            main_page.get_grid_values(
                'Rh', ind, main_page.main_grid,
                mode='background-color')) == expected_color