Пример #1
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
Пример #2
0
    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_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_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
Пример #5
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) == 'Вернуть'
Пример #6
0
    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_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]
Пример #8
0
    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
Пример #9
0
    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]
Пример #10
0
    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_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]
Пример #12
0
    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
Пример #13
0
    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')
Пример #15
0
    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]
Пример #16
0
    def test_donor_minicard_fio_c(self):
        main_page = DonorsModuleRegistryPage()

        donorid = str(
            sql_query(
                "select top(1) PerC.UniqueId Ent from PersonCards PerC 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 len(PerC.LastName) > 0 and len(PerC.FirstName) > 0 and len(PerC.MiddleName) > 0"
            )[0][0])

        donors_card_title_page = DonorsCardTitle(donorid)

        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()

        main_page.fio_minicard.click()

        donors_card_title_page.loading_is_completed()

        assert donors_card_title_page.get_url(
        ) == BaseTest.stand + '/Donor/Registration/Edit/' + donorid + '?showDeleted=False'
	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)
Пример #18
0
    def test_simple(self, query, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query(query)

        donor_id, fullname = str(full_query[0][0]), full_query[0][1]

        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()

        assert main_page.get_grid_values('UniqueId', 'active_cell',
                                         main_page.main_grid) == donor_id
Пример #19
0
    def test_ndp_job_position(self, job_position, 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_region('Москва г')

        main_page.ndp_filling_street('Перовская ул')

        aistium.fill('4', elements=main_page.reg_fias_address_house)

        aistium.fill(job_position, elements=main_page.job_position)

        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() == expected_result
Пример #20
0
    def test_simple(self):
        main_page = DonorsModuleRegistryPage()

        donor_number = 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(donor_number, elements=main_page.quick_search_field)

        main_page.quick_search('click')

        main_page.loading_is_completed()

        assert main_page.get_grid_values('UniqueId', 'active_cell',
                                         main_page.main_grid) == donor_number
Пример #21
0
    def test_simple_search_b(self, query, mode, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        donorid = str(sql_query(query)[0][0])

        main_page.clear_localstorage()

        main_page.open()

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

        main_page.quick_search(mode)

        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('UniqueId', ind,
                                         main_page.main_grid) == donorid
Пример #22
0
    def test_grid_document(self, query, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        full_query = sql_query(query)

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

        main_page.clear_localstorage()

        main_page.open()

        main_page.filling_quick_search(donorid)

        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('Document', ind,
                                         main_page.main_grid) == document
Пример #23
0
    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_ndp_moving_between_pages_second_step(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        change_general_settings(WorkWithSocialStatus='true')

        main_page.newdonor_click()

        main_page.ndp_filling_first_page('Сидоров', 'Иван', 'Петрович',
                                         '15.06.1980', '8933', '650245')

        main_page.select_gender('male')

        main_page.filling_identity_document_issue_date('20.11.2000')

        aistium.fill('А', elements=main_page.identity_document_issued_by)

        aistium.fill('19133561060', elements=main_page.snils_field)

        main_page.ndp_filling_birth_place('Б')

        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('52', elements=main_page.reg_fias_address_house)

        main_page.ndp_filling_contacts('123456789', '123456789', '*****@*****.**')

        aistium.fill('Работа', elements=main_page.ndp_job_place_field)

        aistium.fill('К', elements=main_page.job_position)

        aistium.fill('Рабочие', main_page.social_status_field)

        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])

        main_page.ndp_filling_donation_type(
            str(
                sql_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 = 1"
                ))[3:-5])

        aistium.click_on(elements=main_page.previous_step_ndp)

        main_page.ndp_first_page_clear()

        main_page.ndp_select_document_type('Загранпаспорт РФ')

        main_page.select_gender('female')

        main_page.ndp_filling_first_page('Сидорова', 'Иванка', 'Петровна',
                                         '15.08.1980', '89', '6502455')

        main_page.filling_identity_document_issue_date('20.11.2002')

        aistium.fill('Б', elements=main_page.identity_document_issued_by)

        aistium.fill('24559224384', elements=main_page.snils_field)

        main_page.ndp_filling_birth_place('3')

        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_fias_address_clear()

        main_page.ndp_contacts_clear()

        main_page.ndp_job_or_study_place_clear()

        aistium.click_on(elements=main_page.ndp_deferral_clear_button)

        main_page.ndp_donation_type_clear()

        main_page.ndp_filling_region('Москва г')

        main_page.ndp_filling_street('Кленовый б-р')

        aistium.fill('28', elements=main_page.reg_fias_address_house)

        main_page.ndp_filling_contacts('123456785', '123456783', '*****@*****.**')

        main_page.filling_job_or_study_place('Работа 2', 'К', 'Служащие')

        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])

        main_page.ndp_filling_donation_type(
            str(
                sql_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 = 2"
                ))[3:-5])

        aistium.click_on(elements=main_page.previous_step_ndp)

        main_page.ndp_first_page_check_values_of_mandatory_fields(
            'Сидорова', 'Иванка', '15.08.1980', '89', '6502455')

        aistium.get_value(locators_list=locators,
                          element_name='middle_name_field_ndp') == 'Петровна'

        aistium.get_value(
            locators_list=locators,
            element_name='identity_document_issue_date') == '20.11.2002'

        aistium.get_value(locators_list=locators,
                          element_name='identity_document_issued_by') == 'Б'

        aistium.get_value(locators_list=locators,
                          element_name='ndp_birth_place') == '3'

        aistium.get_value(locators_list=locators,
                          element_name='snils_field') == '24559224384'

        main_page.identity_document_issued_by_clear()

        aistium.fill('Бв', elements=main_page.identity_document_issued_by)

        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_get_contacts_values() == ('123456785', '123456783',
                                                '*****@*****.**')

        main_page.ndp_second_page_check_values_of_mandatory_fields() == (
            'Москва г', '', 'Кленовый б-р', '28')

        main_page.ndp_get_job_information() == ('Работа 2', 'К', 'Служащие')

        assert aistium.get_value(
            locators_list=locators, element_name='ndp_deferral_field'
        ) == 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]

        main_page.ndp_get_donation_type() == str(
            sql_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 = 2"
            ))[3:-5]

        main_page.ndp_phone_clear()

        main_page.ndp_filling_contacts('', '123456788', '')

        main_page.ndp_save_new_donor('success')

        assert aistium.get_text(
            elements=main_page.fio_minicard) == 'Сидорова Иванка Петровна'

        assert aistium.get_text(
            elements=main_page.minicard_phone) == '123456788'

        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()

        donors_card_title_page.issued_by() == 'Бв 20.11.2002'
Пример #25
0
    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'
Пример #26
0
    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_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_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_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) == 'Вернуть'
    def test_donors_creation_all_fields(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        change_general_settings(WorkWithSocialStatus='true')

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page('Петров', 'Константин', 'Семенович',
                                         '02.03.1980', '9360',
                                         '206519')  #mandatory fields only

        main_page.select_gender('male')

        if main_page.get_is_agree_persional_data_processing_value() != 'true':
            aistium.click_on(
                elements=main_page.is_agree_persional_data_processing)

        if main_page.get_is_message_agree_value() != 'true':
            aistium.click_on(elements=main_page.is_message_agree)

        main_page.filling_identity_document_issue_date('10.03.2000')

        aistium.fill('Учреждение выдачи паспортов',
                     elements=main_page.identity_document_issued_by)

        aistium.fill('14805696690', elements=main_page.snils_field)

        main_page.ndp_filling_birth_place('г. Москва')

        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)

        main_page.ndp_filling_building('366')

        main_page.ndp_filling_structure('16')

        main_page.ndp_filling_flat('80')

        main_page.ndp_filling_contacts('9252451340', '4956280991',
                                       '*****@*****.**')

        aistium.fill('ООО Работа', elements=main_page.ndp_job_place_field)

        aistium.fill('Специалист', elements=main_page.job_position)

        aistium.fill('Безработные, в т.ч. домохозяйки',
                     elements=main_page.social_status_field)

        main_page.ndp_filling_deferral('А Прием алкоголя')

        main_page.ndp_filling_donation_type('110 Безв. доноp кpови')

        main_page.ndp_save_new_donor('success')

        assert aistium.get_text(
            elements=main_page.fio_minicard) == 'Петров Константин Семенович'

        assert main_page.get_grid_values(
            'Fio', 1, main_page.main_grid) == 'Петров Константин Семенович'

        assert aistium.get_value(
            locators_list=locators,
            element_name='quick_search_field') == 'Петров Константин Семенович'

        assert main_page.get_gender_from_minicard() == 'М'

        assert main_page.get_birthdate_from_minicard() == '02.03.1980'

        assert main_page.get_document_serie_and_number(
        ) == '9360' + ' ' + '206519'

        assert aistium.get_text(
            elements=main_page.deferral_from_minicard) == 'Прием алкоголя'

        assert main_page.get_donation_type_value_from_minicard(
        ) == '110 Безв. доноp кpови'

        assert main_page.get_email_from_minicard() == '*****@*****.**'

        assert aistium.get_text(
            elements=main_page.minicard_mobile_phone) == '+7 925 245 13 40'

        assert aistium.get_text(
            elements=main_page.minicard_phone) == '+7 4956280991'

        assert main_page.get_accurate_address(
        ) == '111141, Москва г, Перова Поля 3-й проезд, д.21, корп.366, стр.16, кв. 80'

        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() == 'ООО Работа' '''https://aj.srvdev.ru/browse/AIST-16521'''

        assert donors_card_title_page.job() == 'Специалист'

        assert donors_card_title_page.social_status(
        ) == 'Статус: ' + 'Безработные, в т.ч. домохозяйки'