def test_ndp_checking_donor_by_fic_rc_a(self, query, st, row_index): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(UseFicDonorSearch='true') main_page.open() query = sql_query(query, stand=st) document_serie = query[0][0] document_number = query[0][1] expected = query[0][2] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", document_serie, document_number) 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_results_by_fic_is_on_the_page() assert main_page.ndp_results_by_fic_get_grid_values( 'РК', int(row_index)) == expected
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_ndp_checking_donor_by_fic_fullname_b(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(UseFicDonorSearch='true') main_page.open() query = sql_query( '''select top (1) PerC.IdentityDocSerie, PerC.IdentityDocNumber, PerC.LastName + ' ' + PerC.FirstName + ' ' + PerC.MiddleName OR1 from aistdb_fic.dbo.PersonCards PerC where len(PerC.LastName) > 0 and len(PerC.FirstName) > 0 and len(PerC.MiddleName) > 0 and len(PerC.IdentityDocSerie) > 0 and len(PerC.IdentityDocNumber) > 0''', stand= "DRIVER={SQL Server};SERVER=10.36.200.79;DATABASE=aistdb_fic;UID=sa;PWD=Mos111222" ) document_serie = query[0][0] document_number = query[0][1] expected = query[0][2] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", document_serie, document_number) 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_results_by_fic_is_on_the_page() main_page.ndp_results_by_fic_get_grid_values('ФИО', 0, mode='click') Driver.get().switch_to.window(Driver.get().window_handles[1]) assert main_page.query_to_fic_get_fullname() == expected
def test_validation_messages_of_donors_direction(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() change_product_settings(AutoDonorAutomaticApprobation='false') change_donor_settings(CheckAntierythrocyteDonationOrExamination='true') full_query = sql_query(query) donorid = str(full_query[0][0]) expected_message = 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] 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() assert main_page.get_alert_text( mode='none').split('\n')[0] == 'Направление запрещено.' assert (expected_message in main_page.get_alert_text( mode='none').split('\n')[1:]) == True
def test_donors_direction_warning_messages_a(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(CheckDonorInFicWhileDirection='false', CheckFiasAddressForDonor='true', CheckIncompleteAnalysis='true', AlwaysShowEpidAddress='true') 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, 'click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) main_page.loading_is_completed() assert expected_message in aistium.get_text( locators_list=locators, element_name='confirm_popup')
def test_ndp_checking_donor_by_fic_b(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(UseFicDonorSearch='true') main_page.open() query = sql_query( '''select top (1) PerC.IdentityDocSerie, PerC.IdentityDocNumber, substring(ltrim(PerC.RegNodeId), 1, 2) as OR1 from aistdb_fic.dbo.PersonCards PerC where len(PerC.RegNodeId) != 5 and len(PerC.LastName) > 0 and len(PerC.FirstName) > 0 and len(PerC.MiddleName) > 0 and len(PerC.IdentityDocType) > 0 and len(PerC.IdentityDocSerie) > 0''', stand='DRIVER={SQL Server};SERVER=10.36.200.79;DATABASE=aistdb_fic;UID=sa;PWD=Mos111222' ) document_serie = query[0][0] document_number = query[0][1] expected = query[0][2] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", document_serie, document_number) 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.
def test_ndp_checking_donor_by_fic_fullname_a(self, query, row_index): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(UseFicDonorSearch='true') main_page.open() query = sql_query( query, stand= "DRIVER={SQL Server};SERVER=10.36.200.79;DATABASE=aistdb_fic;UID=sa;PWD=Mos111222" ) document_serie = query[0][0] document_number = query[0][1] expected = query[0][2] main_page.newdonor_click() main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", document_serie, document_number) 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_results_by_fic_is_on_the_page() assert main_page.ndp_results_by_fic_get_grid_values( 'ФИО', int(row_index)) == expected
def test_donors_direction_warning_messages_b(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(CheckDonorInFicWhileDirection='false', CheckFiasAddressForDonor='true', CheckIncompleteAnalysis='true', AlwaysShowEpidAddress='true') full_query = sql_query( '''select top(1) PerC.UniqueId Ent, 'Донор отведён (тип отвода: Абсолютный).' OR1 from PersonCards PerC join AppointedDonationTypes AppD on PerC.UniqueId = AppD.DonorId join (select AppD.DonorId, max(AppD.DonationDate) MaxDate from AppointedDonationTypes AppD group by AppD.DonorId) Main on AppD.DonorId = Main.DonorId and AppD.DonationDate = Main.MaxDate join ref.DonationTypeParams DonTP on AppD.DonationTypeId = DonTP.DonationTypeId join ref.DonationTypes DonT on AppD.DonationTypeId = DonT.UniqueId join Deferrals Def on PerC.UniqueId = Def.DonorId and Def.RevokeDate is null join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId and DefT.BaseType = 1 where PerC.IsDeleted != 1 and PerC.BirthDateIsUndefined = 0 and PerC.DeathDate is null and PerC.UniqueId not in (select PrReg.DonorId from DonationProcessRegistry PrReg where PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState != 6) and PerC.UniqueId not in (select Don.DonorId from Donations Don where cast(Don.DonationDate as date) = cast(getdate() as date)) and PerC.UniqueId not in (select Def.DonorId from Deferrals Def join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId where ((DefT.BaseType = 2 and Def.RevokeDate is null) or (DefT.BaseType = 3 and (cast(Def.StopDate as date) >= cast(getdate() as date) or Def.StopDate is null)))) and PerC.Gender in (1,2) and PerC.IdentityDocId is not null and ((PerC.RegAddressId is not null and (PerC.RegAddressIsInactive = 0 or PerC.RegAddressIsInactive is null)) or (PerC.FactAddressId is not null and (PerC.FactAddressIsInactive = 0 or PerC.FactAddressIsInactive is null)) or (PerC.TempAddressId is not null and (PerC.TempAddressIsInactive = 0 or PerC.TempAddressIsInactive is null))) and DonTP.IsActive = 1 and DonT.DonationParams not in (4, 5, 6, 7, 12, 15) and (cast(AppD.NextDonationDate as date) <= cast(getdate() as date) or AppD.NextDonationDate is null) and DonT.ChargeType = 0 and PerC.UniqueId not in (select Don.DonorId from Donations Don where Don.ResultStatus != 5)''' ) 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, '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_no_btn') assert aistium.element_is_on_the_page( locators_list=locators, element_name='confirm_popup') == False 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
def test_donors_direction_warning_messages_с(self): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() change_donor_settings(CheckDonorInFicWhileDirection='false', CheckFiasAddressForDonor='true', CheckIncompleteAnalysis='true', AlwaysShowEpidAddress='true') change_sticker_settings(PrintRunner='false') full_query = sql_query( '''select top(1) PerC.UniqueId Ent, 'Донор отведён (тип отвода: Абсолютный).' OR1 from PersonCards PerC join AppointedDonationTypes AppD on PerC.UniqueId = AppD.DonorId join (select AppD.DonorId, max(AppD.DonationDate) MaxDate from AppointedDonationTypes AppD group by AppD.DonorId) Main on AppD.DonorId = Main.DonorId and AppD.DonationDate = Main.MaxDate join ref.DonationTypeParams DonTP on AppD.DonationTypeId = DonTP.DonationTypeId join ref.DonationTypes DonT on AppD.DonationTypeId = DonT.UniqueId join Deferrals Def on PerC.UniqueId = Def.DonorId and Def.RevokeDate is null join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId and DefT.BaseType = 1 where PerC.IsDeleted != 1 and PerC.BirthDateIsUndefined = 0 and PerC.DeathDate is null and PerC.UniqueId not in (select PrReg.DonorId from DonationProcessRegistry PrReg where PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState != 6) and PerC.UniqueId not in (select Don.DonorId from Donations Don where cast(Don.DonationDate as date) = cast(getdate() as date)) and PerC.UniqueId not in (select Def.DonorId from Deferrals Def join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId where ((DefT.BaseType = 2 and Def.RevokeDate is null) or (DefT.BaseType = 3 and (cast(Def.StopDate as date) >= cast(getdate() as date) or Def.StopDate is null)))) and PerC.Gender in (1,2) and PerC.IdentityDocId is not null and ((PerC.RegAddressId is not null and (PerC.RegAddressIsInactive = 0 or PerC.RegAddressIsInactive is null)) or (PerC.FactAddressId is not null and (PerC.FactAddressIsInactive = 0 or PerC.FactAddressIsInactive is null)) or (PerC.TempAddressId is not null and (PerC.TempAddressIsInactive = 0 or PerC.TempAddressIsInactive is null))) and DonTP.IsActive = 1 and DonT.DonationParams not in (4, 5, 6, 7, 12, 15) and (cast(AppD.NextDonationDate as date) <= cast(getdate() as date) or AppD.NextDonationDate is null) and DonT.ChargeType = 0 and PerC.UniqueId not in (select Don.DonorId from Donations Don where Don.ResultStatus != 5)''' ) 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, '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() 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]) > 0 payload = {'Login': BaseTest.login, 'Password': BaseTest.password} url = BaseTest.stand + '/Auth/LogOn' s = requests.Session() s.post(url, data=payload) body = {'donorId': donorid} s.post('http://10.32.200.142/Common/IsExaminationsSaved', data=body) body = { 'id': donorid, 'confirmed': 'true', 'sessionId': '', 'reason': 'автотест', 'fromQuickRegistryForm': 'false', 'recipientId': '', 'donationTypeId': '', 'noteType': 'Registration' } s.post(BaseTest.stand + '/Common/StepBackwardDonationProcess', data=body)
def test_donors_direction_e(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() donations_counts = { 'HonorableDonorSettings[0].DonationsCount': '10', 'HonorableDonorSettings[0].BloodAndComponentsCount': '5', 'HonorableDonorSettings[0].PlasmaCount': '5', 'HonorableDonorSettings[1].DonationsCount': '999', 'HonorableDonorSettings[1].BloodAndComponentsCount': '999', 'HonorableDonorSettings[1].PlasmaCount': '0', 'HonorableDonorSettings[2].DonationsCount': '999', 'HonorableDonorSettings[2].BloodAndComponentsCount': '999', 'HonorableDonorSettings[2].PlasmaCount': '0', 'HonorableDonorSettings[3].DonationsCount': '999', 'HonorableDonorSettings[3].BloodAndComponentsCount': '999', 'HonorableDonorSettings[3].PlasmaCount': '0' } change_donor_settings( **{str(k): v for k, v in donations_counts.items()}, NotifyRegistrarForHonorableDonor='true', CheckDonorInFicWhileDirection='false', CheckFiasAddressForDonor='false', CheckIncompleteAnalysis='false', AlwaysShowEpidAddress='false', CheckAntierythrocyteDonationOrExamination='false', ) change_product_settings(AutoDonorAutomaticApprobationProducts='true') change_sticker_settings(PrintRunner='false') full_query = sql_query(query) 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, 'click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) main_page.loading_is_completed() assert aistium.get_text( elements=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]) > 0 payload = {'Login': BaseTest.login, 'Password': BaseTest.password} url = BaseTest.stand + '/Auth/LogOn' s = requests.Session() s.post(url, data=payload) body = {'donorId': donorid} s.post('http://10.32.200.142/Common/IsExaminationsSaved', data=body) body = { 'id': donorid, 'confirmed': 'true', 'sessionId': '', 'reason': 'автотест', 'fromQuickRegistryForm': 'false', 'recipientId': '', 'donationTypeId': '', 'noteType': 'Registration' } s.post(BaseTest.stand + '/Common/StepBackwardDonationProcess', data=body)
def test_donors_direction_information_messages(self, query, test_data_set_number): main_page = DonorsModuleRegistryPage() main_page.clear_localstorage() full_query = sql_query(query) donor_id = str(full_query[0][0]) expected_message = str(full_query[0][1]) str_index = str(full_query[0][2]) donations_count = str(full_query[0][3]) blood_and_components_count = str(full_query[0][4]) plasma_count = str(full_query[0][4]) donations_counts = { 'HonorableDonorSettings[0].DonationsCount': '999', 'HonorableDonorSettings[0].BloodAndComponentsCount': '999', 'HonorableDonorSettings[0].PlasmaCount': '999', 'HonorableDonorSettings[1].DonationsCount': '999', 'HonorableDonorSettings[1].BloodAndComponentsCount': '999', 'HonorableDonorSettings[1].PlasmaCount': '999', 'HonorableDonorSettings[2].DonationsCount': '999', 'HonorableDonorSettings[2].BloodAndComponentsCount': '999', 'HonorableDonorSettings[2].PlasmaCount': '999', 'HonorableDonorSettings[3].DonationsCount': '999', 'HonorableDonorSettings[3].BloodAndComponentsCount': '999', 'HonorableDonorSettings[3].PlasmaCount': '999' } donations_counts['HonorableDonorSettings['+str_index+'].DonationsCount'] = donations_count donations_counts['HonorableDonorSettings['+str_index+'].BloodAndComponentsCount'] = blood_and_components_count donations_counts['HonorableDonorSettings['+str_index+'].PlasmaCount'] = plasma_count change_donor_settings(**{str(k): v for k, v in donations_counts.items()}, DonorsModuleRegistryPage='false', CheckFiasAddressForDonor='false', CheckIncompleteAnalysis='false', NotifyRegistrarForHonorableDonor='true') change_sticker_settings(PrintRunner='false') main_page.open() aistium.fill(donor_id, 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 = '"+donor_id+"' or IDoc.Number = '"+donor_id+"')) Main where Main.UniqueId = '"+donor_id+"'")[0][0] main_page.get_grid_values('UniqueId', ind, main_page.main_grid, 'click') main_page.loading_is_completed() aistium.click_on(elements=main_page.process_state_button) main_page.loading_is_completed() if aistium.get_background_color(locators_list=locators, element_name='popup_titlebar') == '#E19F50': aistium.click_on(locators_list=locators, element_name='confirm-popup-yes') else: pass assert main_page.get_alert_text() == expected_message assert aistium.get_text(elements=main_page.process_state_button) == 'Вернуть'