Beispiel #1
0
    def test_transfer_from_search_fields_to_ndp(self, search_line, lastname,
                                                firstname, middlename,
                                                expected_result1,
                                                expected_result2,
                                                expected_result3,
                                                test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

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

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, firstname,
                                                 middlename)

        main_page.extended_search_click('close')

        main_page.newdonor_click()

        assert aistium.get_value(
            locators_list=locators,
            element_name='last_name_field_ndp') == expected_result1

        assert aistium.get_value(
            locators_list=locators,
            element_name='first_name_field_ndp') == expected_result2

        assert aistium.get_value(
            locators_list=locators,
            element_name='middle_name_field_ndp') == expected_result3
    def test_extended_search_by_lastname_b(self, query, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query(query)

        donorid = str(full_query[0][0])

        lastname = full_query[0][1]

        ind = sql_query(
            "select Main.Nmb from (select row_number() over (order by PerC.BirthDate desc) Nmb, PerC.UniqueId from PersonCards PerC where PerC.IsDeleted != 1 and PerC.LastName like '%"
            + lastname + "%') Main where Main.UniqueId = '" + donorid +
            "'")[0][0]

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, '', '')

        aistium.click_on(elements=main_page.extended_search_button)

        main_page.loading_is_completed()

        assert main_page.get_grid_values('UniqueId', ind,
                                         main_page.main_grid) == donorid

        assert main_page.number_of_entities_at_grid_including_hidden(
        ) == sql_query(
            "select count ( * ) Q from PersonCards PerC where PerC.IsDeleted != 1 and PerC.LastName like '%"
            + lastname + "%'")[0][0]
	def test_donors_registry_extended_search_filters(self):

		full_name = sql_query("select top (1) PerC.LastName, PerC.FirstName from PersonCards PerC where PerC.Gender = '2' and PerC.LastName not like '%[a-zA-Z0-9]%' and PerC.FirstName not like '%[a-zA-Z0-9]%'")

		main_page = DonorsModuleRegistryPage()

		main_page.clear_localstorage()

		main_page.open()

		main_page.extended_search_click('open')

		main_page.filling_fio_in_extended_search(full_name[0][0], full_name[0][1])

		aistium.click_on(elements=main_page.extended_search_button)

		main_page.loading_is_completed()

		quantity = main_page.number_of_entities_at_grid()

		main_page.open()

		main_page.loading_is_completed()

		assert main_page.get_lastname_from_extended_search() == full_name[0][0]

		assert main_page.get_firstname_from_extended_search() == full_name[0][1]

		assert quantity == main_page.number_of_entities_at_grid()
    def test_extended_search_by_lastname_a(self, lastname, expected_result,
                                           test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, '', '')

        assert main_page.get_lastname_from_extended_search() == expected_result
    def test_extended_search_b(self):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query('''
			select top (1) PerC.LastName, PerC.FirstName, PerC.MiddleName, case when PerC.Gender = '1' then 'Мужской 'when PerC.Gender = '2' then 'Женский' end Gender,
			PerAd.FiasRegion, PerAd.FiasCity, PerAd.FiasStreet, PerAd.FiasHouse, 
			PerC.UniqueId, Don.Barcode,
			convert(varchar, dateadd(day, -1, PerC.BirthDate), 104) BirthDateS, convert(varchar, dateadd(day, 1, PerC.BirthDate), 104) BirthDatePo,
			convert(varchar, dateadd(day, -1, ApD.NextDonationDate), 104) NextDonationDateS, convert(varchar, dateadd(day, 1, ApD.NextDonationDate), 104) NextDonationDatePo,
			case
			when IDoc.DocType = 1 then 'Паспорт РФ'
			when IDoc.DocType = 2 then 'Военный билет'
			when IDoc.DocType = 3 then 'Загранпаспорт РФ'
			when IDoc.DocType = 4 then 'Паспорт СССР'
			when IDoc.DocType = 5 then 'Иные документы'
			when IDoc.DocType = 6 then 'Св-во о рождении'
			end DocType, IDoc.Serie, IDoc.Number
			from PersonCards PerC 
			join AppointedDonationTypes ApD on PerC.UniqueId = ApD.DonorId
			join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId
			join Donations Don on PerC.UniqueId = Don.DonorId
			join PersonAddresses PerAd on PerC.RegAddressId = PerAd.UniqueId
			where PerC.IsDeleted != 1 
			and PerC.LastName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%'
			and PerC.FirstName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%'
			and PerC.MiddleName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%'
			and PerC.Gender in ('1','2')
			and PerAd.FiasRegion is not null
			and PerAd.FiasArea is null
			and PerAd.FiasCity is not null
			and PerAd.FiasInnerArea is null
			and PerAd.FiasSettlement is null
			and PerAd.FiasStreet is not null
			and PerAd.FiasHouse is not null
			and ApD.NextDonationDate > dateadd(year, -10, getdate()) 
			and ApD.NextDonationDate < dateadd(year, 10, getdate())
			''')

        lastname, firstname, middlename, gender, region, city, street, house, donorid, barcode, birthdate_from, birthdate_to, next_donation_from, next_donation_to, document_type, document_serie, document_number = (
            full_query[0][0], full_query[0][1], full_query[0][2],
            full_query[0][3], full_query[0][4],
            full_query[0][5], full_query[0][6], full_query[0][7],
            str(full_query[0][8]), full_query[0][9], full_query[0][10],
            full_query[0][11], full_query[0][12], full_query[0][13],
            full_query[0][14], full_query[0][15], full_query[0][16])

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, firstname,
                                                 middlename)

        main_page.filling_gender_in_extended_search(gender)

        main_page.filling_region_in_extended_search(region)

        main_page.ndp_filling_city_in_extended_search(city)

        main_page.ndp_filling_street_in_extended_search(street)

        aistium.fill(house, elements=main_page.extended_fias_address_house)

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

        aistium.fill(barcode, elements=main_page.extended_donation_barcode)

        aistium.fill(birthdate_from,
                     elements=main_page.extended_birthdate_from)

        aistium.fill(birthdate_to, elements=main_page.extended_birthdate_to)

        aistium.fill(next_donation_from,
                     elements=main_page.extended_preregistration_from)

        aistium.fill(next_donation_to,
                     elements=main_page.extended_preregistration_to)

        main_page.filling_doc_type_in_extended_search(document_type)

        main_page.filling_doc_serie_in_extended_search(document_serie)

        main_page.filling_doc_number_in_extended_search(document_number)

        aistium.click_on(elements=main_page.extended_search_button)

        main_page.loading_is_completed()

        assert main_page.get_grid_values('UniqueId', 'active_cell',
                                         main_page.main_grid) == donorid

        main_page.extended_search_click('open')

        main_page.filling_doc_number_in_extended_search(document_number[::-1])

        aistium.click_on(elements=main_page.extended_search_close)

        assert main_page.is_extended_search_closed() == True

        assert main_page.get_grid_values(
            'Document', 1,
            main_page.main_grid).split(' ')[-1] == document_number

        main_page.extended_search_click('open')

        aistium.click_on(elements=main_page.extended_search_clear_button)

        assertions = [
            main_page.get_lastname_from_extended_search(),
            main_page.get_firstname_from_extended_search(),
            main_page.get_middlename_from_extended_search(),
            main_page.get_region_from_extended_search(),
            main_page.get_donorid_from_extended_search(),
            main_page.get_barcode_from_extended_search(),
            main_page.get_birth_date_from_from_extended_search(),
            main_page.get_birth_date_to_from_extended_search(),
            main_page.get_next_donation_from_from_extended_search(),
            main_page.get_next_donation_to_from_extended_search(),
            main_page.get_document_serie_from_extended_search(),
            main_page.get_document_number_from_extended_search(),
            main_page.get_document_type_from_extended_search()
        ]

        for assertion in assertions:

            assert assertion == ''

        assert main_page.get_gender_from_extended_search() == 'Пол'

        assert main_page.is_extended_search_button_disable() == 'true'
    def test_reset_search_filters_c(self):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query('''
			select top (1) PerC.LastName, PerC.FirstName, PerC.MiddleName, case when PerC.Gender = '1' then 'Мужской' when PerC.Gender = '2' then 'Женский' end Gender,
			PerAd.FiasRegion, PerC.UniqueId, Don.Barcode,
			convert(varchar, dateadd(day, -1, PerC.BirthDate), 104) BirthDateS, convert(varchar, dateadd(day, 1, PerC.BirthDate), 104) BirthDatePo,
			convert(varchar, dateadd(day, -1, ApD.NextDonationDate), 104) NextDonationDateS, convert(varchar, dateadd(day, 1, ApD.NextDonationDate), 104) NextDonationDatePo,
			case
			when IDoc.DocType = 1 then 'Паспорт РФ'
			when IDoc.DocType = 2 then 'Военный билет'
			when IDoc.DocType = 3 then 'Загранпаспорт РФ'
			when IDoc.DocType = 4 then 'Паспорт СССР'
			when IDoc.DocType = 5 then 'Иные документы'
			when IDoc.DocType = 6 then 'Св-во о рождении'
			end DocType, IDoc.Serie, IDoc.Number
			from PersonCards PerC 
			join AppointedDonationTypes ApD on PerC.UniqueId = ApD.DonorId
			join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId
			join Donations Don on PerC.UniqueId = Don.DonorId
			join PersonAddresses PerAd on PerC.RegAddressId = PerAd.UniqueId
			where PerC.IsDeleted != 1 
			and PerC.LastName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%' and PerC.FirstName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%' and PerC.MiddleName not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%'
			and PerC.Gender in ('1','2')
			and PerAd.FiasRegion is not null
			and PerAd.FiasArea is null
			and PerAd.FiasCity is not null
			and PerAd.FiasInnerArea is null
			and PerAd.FiasSettlement is null
			and PerAd.FiasStreet is not null
			and PerAd.FiasHouse is not null
			and ApD.NextDonationDate > dateadd(year, -10, getdate()) 
			and ApD.NextDonationDate < dateadd(year, 10, getdate())
			''')

        lastname, firstname, middlename, gender, region, donorid, barcode, birthdate_from, birthdate_to, next_donation_from, next_donation_to, document_type, document_serie, document_number = (
            full_query[0][0], full_query[0][1], full_query[0][2],
            full_query[0][3], full_query[0][4], full_query[0][5],
            full_query[0][6], full_query[0][7], full_query[0][8],
            full_query[0][9], full_query[0][10], full_query[0][11],
            full_query[0][12], full_query[0][13])

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, firstname,
                                                 middlename)

        main_page.filling_gender_in_extended_search(gender)

        main_page.filling_region_in_extended_search(region)

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

        aistium.fill(barcode, elements=main_page.extended_donation_barcode)

        aistium.fill(birthdate_from,
                     elements=main_page.extended_birthdate_from)

        aistium.fill(birthdate_to, elements=main_page.extended_birthdate_to)

        aistium.fill(next_donation_from,
                     elements=main_page.extended_preregistration_from)

        aistium.fill(next_donation_to,
                     elements=main_page.extended_preregistration_to)

        main_page.filling_doc_type_in_extended_search(document_type)

        main_page.filling_doc_serie_in_extended_search(document_serie)

        main_page.filling_doc_number_in_extended_search(document_number)

        aistium.click_on(elements=main_page.extended_search_button)

        main_page.loading_is_completed()

        main_page.reset_filters_click()

        main_page.loading_is_completed()

        assert main_page.number_of_entities_at_grid() == 0