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
def test_donor_minicard_diseases_grid_create_date(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() full_query = sql_query(query) donorid = str(full_query[0][0]) expected_result = str(full_query[0][1]) 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] main_page.get_grid_values('№', ind, 'click') main_page.loading_is_completed() aistium.click_on(elements=main_page.diseases_button) main_page.loading_is_completed() assert main_page.get_grid_values( 'CreateDate', 1, main_page.diseases_grid) == expected_result
def test_step_backward_donation_process_alerts(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() full_query = sql_query(query) donorid = str(full_query[0][0]) expected_message = str(full_query[0][1]) 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] main_page.get_grid_values('UniqueId', ind, main_page.main_grid, mode='click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) assert expected_message == main_page.get_alert_text()
def test_email_validation(self, email, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", '8910', '650231') 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() main_page.ndp_filling_contacts('', '', email) main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street("Перовская ул") aistium.fill('4', elements=main_page.reg_fias_address_house) main_page.ndp_save_new_donor('success') assert main_page.get_email_from_minicard() == expected_result
def test_ndp_document_date_validation_messages(self, date_issue, issued_by, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980", "8910", "650231") main_page.select_gender('male') aistium.fill(issued_by, elements=main_page.identity_document_issued_by) main_page.filling_identity_document_issue_date(date_issue) main_page.identity_document_issued_date_focusout() aistium.click_on(elements=main_page.next_step_ndp) main_page.loading_is_completed() assert main_page.get_validation_message_text() == expected_result
def test_grid_phenotype_с(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() change_general_settings(UsePhenotypeShortFormat='true') full_query = sql_query(query) donorid, expected_result = str(full_query[0][0]), full_query[0][1] phenotype = convert_phenotype(expected_result) 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('Phenotype', ind, main_page.main_grid) == phenotype
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_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_ndp_validation_of_social_status_and_job_info_d(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_general_settings(WorkWithSocialStatus='true') query = sql_query( "select SocSt.Name from ref.SocialStatuses SocSt where SocSt.IsActive = 1 and SocSt.Name like '%ц%'" ) social_statuses_db = [] for s in query: social_statuses_db.append(s[0]) main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Афанасий", '', "04.06.1980", "8913", "650234") 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_region("Москва г") main_page.ndp_filling_street("Перовская ул") aistium.fill('7', elements=main_page.reg_fias_address_house) aistium.click_on(elements=main_page.social_status_select_row) main_page.ndp_choose_social_status_from_list("Рабочие") main_page.ndp_social_status_clear() main_page.ndp_typing_social_status('ц') assert main_page.ndp_social_statuses_list_on_form( ) == social_statuses_db main_page.ndp_choose_social_status_from_list( "Младший медицинский персонал") main_page.ndp_social_status_focusout() assert main_page.ndp_get_job_information( )[2] == 'Младший медицинский персонал' main_page.ndp_save_new_donor('success') assert aistium.get_text( elements=main_page.fio_minicard) == "Сидоров " + "Афанасий"
def test_donor_minicard_job_place_a(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query = sql_query(query) donorid = str(full_query[0][0]) expected_result = str(full_query[0][1]) change_donor_settings(ShowJobInfo='true') 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] main_page.get_grid_values('UniqueId', ind, main_page.main_grid, 'click') main_page.loading_is_completed() if expected_result == '': assert aistium.element_is_on_the_page(locators_list='minicard_job_place_label',element_name='minicard_job_place_label') == False else: assert main_page.minicard_get_job_place() == expected_result
def test_simple_search_d(self): main_page = DonorsModuleRegistryPage() donorid = str( sql_query( "select top (1) PerC.UniqueId from PersonCards PerC join IdentityDocs IDoc on IDoc.UniqueId = PerC.IdentityDocId where convert(nvarchar(10), PerC.UniqueId) not in (select IDoc.Number from IdentityDocs IDoc) and PerC.IsDeleted != 1" )[0][0]) 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.is_grid_row_selected(ind) == True assert main_page.link_to_donor_card( ) == BaseTest.stand + '/Donor/Registration/Edit/' + donorid + '?showDeleted=False'
def test_ndp_snils(self, snils, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980", "8910", "650231") main_page.select_gender('male') aistium.fill(snils, elements=main_page.snils_field) 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() aistium.click_on(elements=main_page.previous_step_ndp) assert aistium.get_value(locators_list=locators, element_name='snils_field') == expected_result
def test_ndp_homephone(self, homephone, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980", "8910", "650231") 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() main_page.ndp_filling_contacts("", homephone, "") main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street('Перовская ул') aistium.fill('4', elements=main_page.reg_fias_address_house) main_page.ndp_save_new_donor('success') assert aistium.get_text(elements=main_page.minicard_phone) == expected_result
def test_ndp_moving_between_pages_first_step(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page('Сидоров', 'Кирилл', '', '01.06.1980', '8910', '650231') 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() main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street('Перовская ул') aistium.fill('46', elements=main_page.reg_fias_address_house) aistium.click_on(elements=main_page.previous_step_ndp) main_page.ndp_first_page_check_values_of_mandatory_fields( 'Сидоров', 'Кирилл', '01.06.1980', '8910', '650231') 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() main_page.ndp_second_page_check_values_of_mandatory_fields() == ( 'Москва г', '', 'Перовская ул', '46') main_page.ndp_save_new_donor('success') main_page.loading_is_completed() assert aistium.get_text( elements=main_page.fio_minicard) == 'Сидоров Кирилл' assert main_page.get_gender_from_minicard() == 'М' assert main_page.get_birthdate_from_minicard() == '01.06.1980' assert main_page.get_document_serie_and_number( ) == '8910' + ' ' + '650231' assert main_page.get_accurate_address( ) == 'Москва г, Перовская ул, д.46'
def test_grid_donor_id(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() full_query = sql_query(query) donor_id, fullname, lastname, firstname, middlename = str( full_query[0][0]), full_query[0][1], full_query[0][2], full_query[ 0][3], full_query[0][4] main_page.clear_localstorage() main_page.open() aistium.fill(fullname, 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 where PerC.IsDeleted != 1 and PerC.LastName like '" + lastname + "%' and PerC.FirstName like '" + firstname + "%' and PerC.MiddleName like '" + middlename + "%') Main where Main.UniqueId = " + donor_id)[0][0] assert main_page.get_grid_values('UniqueId', ind, main_page.main_grid) == donor_id
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_step_backward_donation_process_d(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() full_query = sql_query( '''select top(1) PerC.UniqueId Ent, 'Донору введены результаты осмотра/анализов. Продолжить возврат?' OR1 from ref.SystemSettings SysSet, PersonCards PerC join DonationProcessRegistry PrReg on PerC.UniqueId = PrReg.DonorId where PerC.IsDeleted != 1 and PrReg.OrgId = SysSet.CurrentOrganizationId and PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState = 1 and PrReg.MobileTeamSessionId is null and PerC.UniqueId not in (select Ex.DonorId from Examinations Ex where cast(Ex.ExamDate as date) = cast(getdate() as date))''' ) donorid = str(full_query[0][0]) 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] main_page.get_grid_values('UniqueId', ind, main_page.main_grid, mode='click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) main_page.loading_is_completed() aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn') main_page.loading_is_completed() aistium.fill('автотест', elements=main_page.reason_back_donation_input) assert aistium.get_text(main_page.process_state_button) == 'Вернуть' assert len( sql_query( "select PrReg.Id from DonationProcessRegistry PrReg, ref.SystemSettings SysSet where PrReg.DonorId = '" + donorid + "' and PrReg.OrgId = SysSet.CurrentOrganizationId and PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState = 1 and PrReg.MobileTeamSessionId is null" )) > 0 assert aistium.element_is_on_the_page( locators_list=locators, element_name='confirm_popup') == False assert aistium.get_text(main_page.process_state_button) == 'Вернуть'
def test_job_place_enter_value(self): i = 1 sel = 'a' while len(sel) > 0: place_ent = str( sql_query( "select ls.Pl from (select row_number() over (order by PerC.UniqueId asc) as rank, PerC.JobInfo + ' ООО' Pl from PersonCards PerC where len(PerC.JobInfo) < 57 and PerC.JobInfo not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^]%') ls where ls.rank = '" + str(i) + "'"))[3:-5] sel = str( sql_query( "select top (1) PerC.JobInfo from PersonCards PerC where PerC.JobInfo = '" + place_ent + "'"))[3:-5] i = i + 1 main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page('Сидоров', "Анатолий", "", "01.06.1980", "2910", "650231") 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() main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street('Перова Поля 3-й проезд') aistium.fill('21', elements=main_page.reg_fias_address_house) aistium.fill(place_ent, elements=main_page.ndp_job_place_field) main_page.ndp_save_new_donor('success') main_page.loading_is_completed() grid_donor_id = main_page.get_grid_values('UniqueId', 'active_cell', main_page.main_grid) donors_card_title_page = DonorsCardTitle(grid_donor_id) donors_card_title_page.open() assert donors_card_title_page.job_place() == place_ent
def test_edit_and_save_deferral(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() deferrals_db = [] 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() main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street('Перовская ул') aistium.fill('13', elements=main_page.reg_fias_address_house) 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]) aistium.click_on(elements=main_page.ndp_deferral_clear_button) main_page.ndp_filling_deferral('Ф', '') for deferral in sql_query( "select DefT.Code+' '+DefT.Name Otvod from ref.DeferralTypes DefT join ref.DeferralTypeParams DefTP on DefT.UniqueId = DefTP.DeferralTypeId where DefTP.IsActive = 1 and DefT.Code+' '+DefT.Name like '%ф%' order by DefT.Code" ): deferrals_db.append(str(deferral)[2:-4]) assert main_page.ndp_deferral_list_on_form() == deferrals_db main_page.ndp_deferrals_press_enter() assert aistium.get_value( locators_list=locators, element_name='ndp_deferral_field') == deferrals_db[0] main_page.ndp_save_new_donor('success') assert aistium.get_text( elements=main_page.fio_minicard) == 'Сидоров Алексей'
def test_deferral(self, deferral_system_name, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() deferrals_gui = [] deferrals_db = [] 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_filling_region('Москва г') main_page.ndp_filling_street('Перовская ул') aistium.fill('8', elements=main_page.reg_fias_address_house) assert main_page.is_deferral_type_field_disabled() == ('true', 'true') active_deferrals = sql_query( "select DefT.Code+' '+DefT.Name Otvod from ref.DeferralTypes DefT join ref.DeferralTypeParams DefTP on DefT.UniqueId = DefTP.DeferralTypeId where DefTP.IsActive = 1 order by DefT.Code asc" ) for defer in main_page.ndp_deferrals_listbox(): deferrals_gui.append( self.driver.execute_script( "return jQuery(arguments[0]).text();", defer)) for deferral in active_deferrals: deferrals_db.append(deferral[0]) assert deferrals_gui == deferrals_db main_page.ndp_filling_deferral(deferral_system_name) main_page.ndp_save_new_donor('success') assert expected_result.upper() in aistium.get_text( elements=main_page.deferral_from_minicard).upper() assert aistium.get_text( elements=main_page.fio_minicard) == 'Сидоров Алексей'
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_ndp_validation_of_social_status_and_job_info_a(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_general_settings(WorkWithSocialStatus='true') main_page.open() query = sql_query( "select SocSt.Name from ref.SocialStatuses SocSt where SocSt.IsActive = 1 order by SocSt.Name asc" ) social_statuses_db = [] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Дмитрий", '', "31.05.1980", "8909", "650229") 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_region("Москва г") main_page.ndp_filling_street("Перовская ул") aistium.fill("2", elements=main_page.reg_fias_address_house) aistium.click_on(elements=main_page.social_status_select_row) for s in query: social_statuses_db.append(s[0]) assert main_page.ndp_social_statuses_list_on_form( ) == social_statuses_db main_page.ndp_choose_social_status_from_list('Рабочие') main_page.ndp_social_status_focusout() assert main_page.ndp_get_job_information()[2] == 'Рабочие' main_page.ndp_save_new_donor('success') assert aistium.get_text( elements=main_page.fio_minicard) == "Сидоров " + "Дмитрий"
def test_simple_search_f(self, string, expected_result, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() aistium.fill(string, elements=main_page.quick_search_field) assert aistium.get_value( locators_list=locators, element_name='quick_search_field') == expected_result
def test_ndp_validation_of_social_status_and_job_info_e( self, social_status, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_general_settings(WorkWithSocialStatus='true') query = sql_query( "select SocSt.Name from ref.SocialStatuses SocSt where SocSt.IsActive = 1 and SocSt.Name like '%ц%'" ) social_statuses_db = [] for s in query: social_statuses_db.append(s[0]) main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", "8910", "650231") 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_region("Москва г") main_page.ndp_filling_street("Перовская ул") aistium.fill('4', elements=main_page.reg_fias_address_house) main_page.ndp_typing_social_status(social_status) assert main_page.ndp_social_status_listbox_is_empty() main_page.ndp_social_status_focusout() assert main_page.ndp_get_job_information()[2] == '' main_page.ndp_save_new_donor('success') assert aistium.get_text( elements=main_page.fio_minicard) == "Сидоров " + "Кирилл"
def test_gender_and_middlename_confirm_yes(self, middlename, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() main_page.newdonor_click() main_page.ndp_filling_first_page('Машинный', 'Проверкаполаиотчества', middlename, '10.12.1977', '2013', '312313') if middlename[-2:] == 'ич' or middlename[-4:] == 'оглы': main_page.select_gender('female') aistium.click_on(elements=main_page.next_step_ndp) assert aistium.get_text( locators_list=locators, element_name='confirm_popup' ) == 'Пол донора не соответствует отчеству. Продолжить?' aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn') aistium.click_on(elements=main_page.next_step_ndp ) #https://aj.srvdev.ru/browse/AIST-15978 saved_gender = 'Ж' elif middlename[-2:] == 'на' or middlename[-4:] == 'кызы': main_page.select_gender('male') aistium.click_on(elements=main_page.next_step_ndp) assert aistium.get_text( locators_list=locators, element_name='confirm_popup' ) == 'Пол донора не соответствует отчеству. Продолжить?' aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn') aistium.click_on(elements=main_page.next_step_ndp ) #https://aj.srvdev.ru/browse/AIST-15978 saved_gender = 'М' main_page.if_donor_is_in_local_cabinet() main_page.ndp_second_page_loaded() main_page.ndp_filling_region('Москва г') main_page.ndp_filling_street('Строителей ул') aistium.fill('13', elements=main_page.reg_fias_address_house) main_page.ndp_save_new_donor('success') assert main_page.get_gender_from_minicard() == saved_gender
def test_ndp_job_place_verify_list(self): main_page = DonorsModuleRegistryPage() main_page.open() place_ent = str( sql_query( "select top (1) lower(substring(PerC.JobInfo, 2, 3)) Ent from PersonCards PerC where len(PerC.JobInfo) > 5 and PerC.JobInfo not like '%[a-zA-Z0-9?!_+=*\/%()}{<>^%' and substring(PerC.JobInfo, 4, 1) != ' '" ))[3:-5] places_db = [] places_s = [] main_page.newdonor_click() main_page.ndp_filling_first_page('Сидоров', "Анатолий", "", "01.06.1980", "2910", "650231") 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() aistium.fill(place_ent, elements=main_page.ndp_job_place_field) for place in sql_query( "select upper(PerC.JobInfo) JobInfo from PersonCards PerC where PerC.JobInfo like '%" + place_ent + "%'"): places_db.append(place[0]) places_db = list(OrderedDict(zip(places_db, repeat(None)))) places_db.sort() for place_s in main_page.ndp_place_list_on_form(): places_s.append(str(place_s).upper()) job_place_need = places_s[0] places_s.sort() assert places_s == places_db
def test_step_backward_donation_process_warning_messages_c(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() full_query = sql_query( '''select top(1) PerC.UniqueId Ent from ref.SystemSettings SysSet, PersonCards PerC join DonationProcessRegistry PrReg on PerC.UniqueId = PrReg.DonorId join Examinations Ex on PerC.UniqueId = Ex.DonorId where PerC.IsDeleted != 1 and PrReg.OrgId = SysSet.CurrentOrganizationId and PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState = 1 and PrReg.MobileTeamSessionId is null and cast(Ex.ExamDate as date) = cast(getdate() as date)''' ) donorid = str(full_query[0][0]) 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] main_page.get_grid_values('UniqueId', ind, main_page.main_grid, mode='click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) main_page.loading_is_completed() aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn') main_page.loading_is_completed() aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn') assert main_page.element_is_on_page( main_page.edit_reason_back_donation_window) == True
def test_ndp_validation_of_donation_type_first_case(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() main_page.open() query = sql_query( "select 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%' order by DonT.Code" ) donation_types_db = [] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Павел", '', "11.06.1980", "8920", "650241") 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_region("Москва г") main_page.ndp_filling_street("Перовская ул") aistium.fill('14', elements=main_page.reg_fias_address_house) aistium.click_on(elements=main_page.donation_type_select_row) for t in query: donation_types_db.append(t[0]) assert main_page.ndp_donation_types_list_on_form() == donation_types_db main_page.ndp_filling_donation_type('001 на лабораторные исследования') assert main_page.ndp_get_donation_type( ) == '001 На лабораторные исследования' main_page.ndp_save_new_donor('success') assert aistium.get_text( elements=main_page.fio_minicard) == "Сидоров " + "Павел"
def test_simple(self): main_page = DonorsModuleRegistryPage() document_number = sql_query("select top (1) IDoc.Number Nm from IdentityDocs IDoc join PersonCards PerC on IDoc.UniqueId = PerC.IdentityDocId where len(IDoc.Number) > 3 and IDoc.Number not like '%[а-яА-Яa-zA-Z?!_+=*\/%()}{<>^]%' and IDoc.Number not in (select convert(nvarchar(10), PerC.UniqueId) from PersonCards PerC) and PerC.IsDeleted != 1")[0][0] main_page.clear_localstorage() main_page.open() aistium.fill(document_number, elements=main_page.quick_search_field) main_page.quick_search('click') main_page.loading_is_completed() assert document_number in main_page.get_grid_values('Document', 1, main_page.main_grid)
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]