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_extended_search_by_donation_barcode_b(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query = sql_query(query) donorid = str(full_query[0][0]) barcode = 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 join Donations Don on PerC.UniqueId = Don.DonorId where PerC.IsDeleted != 1 and Don.Barcode like '%' + replace('"+barcode+"', '=7', '') + '%' group by PerC.UniqueId, PerC.BirthDate) Main where Main.UniqueId = '"+donorid+"'")[0][0] main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') aistium.fill(barcode, elements=main_page.extended_donation_barcode) 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 (distinct PerC.UniqueId) from PersonCards PerC join Donations Don on PerC.UniqueId = Don.DonorId where PerC.IsDeleted != 1 and Don.Barcode like '%' + replace('"+barcode+"', '=7', '') + '%'")[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_gender_c(self, gender, query, test_data_set_number): main_page = DonorsModuleRegistryPage() donorid = str(sql_query(query)[0][0]) 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.Gender = case when '" + gender + "' = 'Мужской' then '1' else '2' end) Main where Main.UniqueId = '" + donorid + "'")[0][0] main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') main_page.filling_gender_in_extended_search(gender) 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.Gender = case when '" + gender + "' = 'Мужской' then '1' else '2' end")[0][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_reset_search_filters_e(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() simple_search_donorid = str( sql_query( "select top (1) PerC.UniqueId Ent from PersonCards PerC where PerC.Gender = '1' and PerC.IsDeleted != '1'" )[0][0]) aistium.fill(simple_search_donorid, elements=main_page.quick_search_field) main_page.quick_search('press_enter') main_page.loading_is_completed() extended_search_donorid = str( sql_query( "select top (1) PerC.UniqueId Ent from PersonCards PerC where PerC.Gender = '2' and PerC.IsDeleted != '1'" )[0][0]) main_page.extended_search_click('open') aistium.fill(extended_search_donorid, elements=main_page.extended_registry_number) aistium.click_on(elements=main_page.extended_search_button) main_page.loading_is_completed() assert aistium.get_value(locators_list=locators, element_name='quick_search_field') == ''
def test_extended_search_a(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') assert main_page.is_extended_search_button_disable() == 'true'
def test_extended_search_by_donation_barcode_a(self, barcode, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') aistium.fill(barcode, elements=main_page.extended_donation_barcode) assert main_page.get_barcode_from_extended_search() == expected_result
def test_extended_search_by_gender_a(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') assert main_page.get_genders_listbox_from_extended_search() == [ 'Пол', 'Женский', 'Мужской' ]
def test_extended_search_by_document_serie_b(self, document_type, query, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query = sql_query(query) donorid = str(full_query[0][0]) document_serie = str(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 join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId where PerC.IsDeleted != 1 and IDoc.Serie = '" + document_serie + "' and cast(IDoc.DocType as varchar) like case when '" + document_type + "' = '' then '%' when '" + document_type + "' = 'Паспорт РФ' then '1' when '" + document_type + "' = 'Военный билет' then '2' when '" + document_type + "' = 'Загранпаспорт РФ' then '3' when '" + document_type + "' = 'Паспорт СССР' then '4' when '" + document_type + "' = 'Иные документы' then '5' when '" + document_type + "' = 'Св-во о рождении' then '6' end) Main where Main.UniqueId = '" + donorid + "'")[0][0] main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') main_page.filling_doc_type_in_extended_search(document_type) main_page.filling_doc_serie_in_extended_search(document_serie) 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 join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId where PerC.IsDeleted != 1 and IDoc.Serie = '" + document_serie + "' and cast(IDoc.DocType as varchar) like case when '" + document_type + "' = '' then '%' when '" + document_type + "' = 'Паспорт РФ' then '1' when '" + document_type + "' = 'Военный билет' then '2' when '" + document_type + "' = 'Загранпаспорт РФ' then '3' when '" + document_type + "' = 'Паспорт СССР' then '4' when '" + document_type + "' = 'Иные документы' then '5' when '" + document_type + "' = 'Св-во о рождении' then '6' end")[0][0]
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_by_document_type_a(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') assert main_page.get_document_types_listbox_from_extended_search() == [ '', 'Паспорт РФ', 'Военный билет', 'Загранпаспорт РФ', 'Паспорт СССР', 'Иные документы', 'Св-во о рождении' ]
def test_extended_search_by_gender_b(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') main_page.filling_gender_in_extended_search('Женский') main_page.filling_gender_in_extended_search('Пол') assert main_page.is_extended_search_button_disable() == 'true'
def test_extended_search_by_document_type_b(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') main_page.filling_doc_type_in_extended_search('Паспорт РФ') main_page.filling_doc_type_in_extended_search( '') #вот здесь падает http://joxi.ru/a2XlR6kty8qGW2 assert main_page.is_extended_search_button_disable() == 'true'
def test_extended_search_by_next_donation_date_b( self, query_next_donation_date_from, query_next_donation_date_to, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query_from = sql_query(query_next_donation_date_from) next_donation_date_from = str(full_query_from[0][1]) full_query_to = sql_query(query_next_donation_date_to) next_donation_date_to = str(full_query_to[0][1]) donorid = str(full_query_from[0][0]) if donorid == '': donorid = str(full_query_to[0][0]) #ind = str(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.BirthDate between case when '"+birthdate_from+"' = '' then '01.01.1753' else '"+birthdate_from+"' end and case when '"+birthdate_to+"' = '' then '31.12.9999' else '"+birthdate_to+"' end group by PerC.UniqueId, PerC.BirthDate) Main where Main.UniqueId = '"+donorid+"'")[0][0]) main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') aistium.fill(next_donation_date_from, elements=main_page.extended_preregistration_from) aistium.fill(next_donation_date_to, elements=main_page.extended_preregistration_to) 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(distinct PerC.UniqueId) Q from PersonCards PerC join AppointedDonationTypes ApD on PerC.UniqueId = ApD.DonorId join (select ApD.DonorId, max(ApD.DonationDate) DD from AppointedDonationTypes ApD group by ApD.DonorId) ApDMax on ApD.DonorId = ApDMax.DonorId and ApD.DonationDate = ApDMax.DD where PerC.IsDeleted != 1 and ApD.NextDonationDate between case when '" + next_donation_date_from + "' = '' then '01.01.1753' else '" + next_donation_date_from + "' end and case when '" + next_donation_date_to + "' = '' then '31.12.9999' else '" + next_donation_date_to + "' end")[0][0]
def test_extended_search_by_document_serie_a(self, document_type, document_serie, 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_doc_type_in_extended_search(document_type) main_page.filling_doc_serie_in_extended_search(document_serie) assert main_page.get_document_serie_from_extended_search( ) == expected_result
def test_extended_search_by_next_donation_date_a(self, next_donation_date, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') if 'today' in next_donation_date: aistium.fill(date_calculation(next_donation_date), elements=main_page.extended_preregistration_from) aistium.fill(date_calculation(next_donation_date), elements=main_page.extended_preregistration_to) else: aistium.fill(next_donation_date, elements=main_page.extended_preregistration_from) aistium.fill(next_donation_date, elements=main_page.extended_preregistration_to) if 'today' in expected_result: assert main_page.get_next_donation_from_from_extended_search( ) == date_calculation(expected_result) assert main_page.get_next_donation_to_from_extended_search( ) == date_calculation(expected_result) else: assert main_page.get_next_donation_from_from_extended_search( ) == expected_result assert main_page.get_next_donation_to_from_extended_search( ) == expected_result
def test_extended_search_by_birthdate_validation_messages( self, birthdate_from, birthdate_to, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') aistium.fill(birthdate_from, elements=main_page.extended_birthdate_from) aistium.fill(birthdate_to, elements=main_page.extended_birthdate_to) aistium.click_on(elements=main_page.extended_search_button) main_page.loading_is_completed() assert main_page.get_alert_text() == expected_result
def test_extended_search_by_donor_number_b(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query = sql_query(query) number = str(full_query[0][0]) main_page.clear_localstorage() main_page.open() main_page.extended_search_click('open') aistium.fill(number, elements=main_page.extended_registry_number) aistium.click_on(elements=main_page.extended_search_button) main_page.loading_is_completed() assert main_page.get_grid_values('UniqueId', 1, main_page.main_grid) == number assert main_page.number_of_entities_at_grid_including_hidden() == 1
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