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_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_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
Example #4
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]
Example #5
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
Example #6
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
	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_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]
Example #9
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_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_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]
Example #12
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) == 'Вернуть'
Example #13
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
    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_type_color_and_type(self, expected_color, expected_type,
                                          test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

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

        if expected_type == 'Временный':
            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])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
        elif expected_type == 'Контроль':
            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])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
        elif expected_type == 'Абсолютный':
            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])
            assert aistium.get_value(
                locators_list=locators,
                element_name='ndp_deferral_type') == expected_type
            assert convert_to_hex(
                main_page.ndp_get_deferral_type_color()) == expected_color
Example #16
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]
Example #17
0
    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
Example #18
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
Example #19
0
    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
Example #20
0
    def test_ndp_validation_of_donation_type_second_case(
            self, expected_color_back, expected_color_text, expected_type,
            test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        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="

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980",
                                         "3608", "360471")

        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_donation_type(
            sql_query(query + expected_type)[0][0])

        assert convert_to_hex(main_page.ndp_get_donation_type_color()).lower(
        ) == expected_color_back

        assert convert_to_hex(main_page.ndp_get_donation_type_text_color()
                              ).lower() == expected_color_text
Example #21
0
    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_donors_registry_extended_search_filters(self):

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

		main_page = DonorsModuleRegistryPage()

		main_page.clear_localstorage()

		main_page.open()

		main_page.extended_search_click('open')

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

		aistium.click_on(elements=main_page.extended_search_button)

		main_page.loading_is_completed()

		quantity = main_page.number_of_entities_at_grid()

		main_page.open()

		main_page.loading_is_completed()

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

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

		assert quantity == main_page.number_of_entities_at_grid()
    def test_extended_search_by_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]
Example #24
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
Example #25
0
    def test_ndp_validation_of_donation_type_fourth_case(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        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%'"

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Алексей", '',
                                         "20.06.1980", "8929", "650250")

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

        main_page.ndp_filling_donation_type(sql_query(query)[0][0])

        assert main_page.ndp_get_donation_type() == sql_query(query)[0][0]

        main_page.ndp_donation_type_clear()

        main_page.ndp_donation_type_focus_out()

        main_page.ndp_filling_donation_type("э", mode='first_li')

        current_donation_type = main_page.ndp_get_donation_type()

        main_page.ndp_save_new_donor('success')

        assert main_page.get_donation_type_value_from_minicard(
        ) == current_donation_type
Example #26
0
    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_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')
Example #28
0
    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_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
Example #30
0
    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) == "Сидоров " + "Кирилл"