Пример #1
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) == "Сидоров " + "Афанасий"
Пример #2
0
    def test_document_serie_validation(self, document_type, document_serie,
                                       document_number, expected_result,
                                       test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_select_document_type(document_type)

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

        main_page.select_gender('male')

        assert aistium.get_value(
            locators_list=locators,
            element_name='document_serie_field_ndp') == expected_result

        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()
    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
Пример #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]
Пример #5
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_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]
Пример #7
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
	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]
Пример #9
0
    def test_ndp_document_date_validation_messages(self, date_issue, issued_by,
                                                   expected_result,
                                                   test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980",
                                         "8910", "650231")

        main_page.select_gender('male')

        aistium.fill(issued_by, elements=main_page.identity_document_issued_by)

        main_page.filling_identity_document_issue_date(date_issue)

        main_page.identity_document_issued_date_focusout()

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        assert main_page.get_validation_message_text() == expected_result
Пример #10
0
    def test_ndp_snils(self, snils, expected_result, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980",
                                         "8910", "650231")

        main_page.select_gender('male')

        aistium.fill(snils, elements=main_page.snils_field)

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        main_page.if_donor_is_in_local_cabinet()

        main_page.ndp_second_page_loaded()

        aistium.click_on(elements=main_page.previous_step_ndp)

        assert aistium.get_value(locators_list=locators,
                                 element_name='snils_field') == expected_result
Пример #11
0
	def test_email_validation(self, email, expected_result, test_data_set_number):
		main_page = DonorsModuleRegistryPage()

		main_page.clear_localstorage()

		main_page.open()

		main_page.newdonor_click()

		main_page.ndp_filling_first_page("Сидоров", "Кирилл", '', "01.06.1980", '8910', '650231')
		
		main_page.select_gender('male')

		aistium.click_on(elements=main_page.next_step_ndp)

		main_page.loading_is_completed()

		main_page.if_donor_is_in_local_cabinet()

		main_page.ndp_second_page_loaded()

		main_page.ndp_filling_contacts('', '', email)

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

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

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

		main_page.ndp_save_new_donor('success')

		assert main_page.get_email_from_minicard() == expected_result
	def test_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()
Пример #13
0
    def test_filling_birthdate(self, birthdate, expected_result,
                               test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", birthdate,
                                         "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()

        aistium.click_on(elements=main_page.previous_step_ndp)

        if 'today' in expected_result:

            assert aistium.get_value(
                locators_list=locators,
                element_name='birthdate_field_ndp') == date_calculation(
                    expected_result)

        else:

            assert aistium.get_value(
                locators_list=locators,
                element_name='birthdate_field_ndp') == expected_result
Пример #14
0
	def test_ndp_homephone(self, homephone, expected_result, test_data_set_number):
		main_page = DonorsModuleRegistryPage()

		main_page.clear_localstorage()

		main_page.open()

		main_page.newdonor_click()

		main_page.ndp_filling_first_page("Сидоров", "Кирилл", "", "01.06.1980", "8910", "650231")

		main_page.select_gender('male')

		aistium.click_on(elements=main_page.next_step_ndp)

		main_page.loading_is_completed()

		main_page.if_donor_is_in_local_cabinet()

		main_page.ndp_second_page_loaded()

		main_page.ndp_filling_contacts("", homephone, "")

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

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

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

		main_page.ndp_save_new_donor('success')

		assert aistium.get_text(elements=main_page.minicard_phone) == expected_result
Пример #15
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
Пример #16
0
    def test_ndp_validation_of_donation_type_fifth_case(
            self, donation_type, 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",
                                         "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()

        assert main_page.ndp_filling_donation_type(
            donation_type, mode='does_not_exists') == True

        main_page.ndp_donation_type_focus_out()

        assert main_page.ndp_get_donation_type() == ''

        main_page.ndp_save_new_donor('success')
    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') == ''
Пример #18
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) == 'Вернуть'
Пример #19
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) == 'Сидоров Алексей'
Пример #21
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_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
Пример #23
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]
Пример #24
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) == "Сидоров " + "Дмитрий"
Пример #25
0
    def test_gender_validation_messages(self, middlename, expected_result,
                                        test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Кирилл", middlename,
                                         "01.06.1980", "8910", "650231")

        aistium.click_on(elements=main_page.next_step_ndp)

        assert main_page.get_validation_message_text() == expected_result
Пример #26
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) == "Сидоров " + "Кирилл"
Пример #27
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
Пример #28
0
    def test_ndp_validation_of_donation_type_first_case(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        query = sql_query(
            "select DonT.Code+' '+DonT.Name from ref.DonationTypes DonT join ref.DonationTypeParams DonTP on DonT.UniqueId = DonTP.DonationTypeId where DonTP.IsActive = 1 and DonT.DonationParams not like '%4%' order by DonT.Code"
        )

        donation_types_db = []

        main_page.newdonor_click()

        main_page.ndp_filling_first_page("Сидоров", "Павел", '', "11.06.1980",
                                         "8920", "650241")

        main_page.select_gender('male')

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        main_page.if_donor_is_in_local_cabinet()

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

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

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

        aistium.click_on(elements=main_page.donation_type_select_row)

        for t in query:
            donation_types_db.append(t[0])

        assert main_page.ndp_donation_types_list_on_form() == donation_types_db

        main_page.ndp_filling_donation_type('001 на лабораторные исследования')

        assert main_page.ndp_get_donation_type(
        ) == '001 На лабораторные исследования'

        main_page.ndp_save_new_donor('success')

        assert aistium.get_text(
            elements=main_page.fio_minicard) == "Сидоров " + "Павел"
Пример #29
0
    def test_ndp_checking_donor_by_fic_fullname_b(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        change_donor_settings(UseFicDonorSearch='true')

        main_page.open()

        query = sql_query(
            '''select top (1) PerC.IdentityDocSerie, PerC.IdentityDocNumber, PerC.LastName + ' ' + PerC.FirstName + ' ' + PerC.MiddleName OR1
			from aistdb_fic.dbo.PersonCards PerC
			where len(PerC.LastName) > 0
			and len(PerC.FirstName) > 0
			and len(PerC.MiddleName) > 0
			and len(PerC.IdentityDocSerie) > 0
			and len(PerC.IdentityDocNumber) > 0''',
            stand=
            "DRIVER={SQL Server};SERVER=10.36.200.79;DATABASE=aistdb_fic;UID=sa;PWD=Mos111222"
        )

        document_serie = query[0][0]

        document_number = query[0][1]

        expected = query[0][2]

        main_page.newdonor_click()

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

        main_page.select_gender('male')

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        main_page.if_donor_is_in_local_cabinet()

        main_page.ndp_results_by_fic_is_on_the_page()

        main_page.ndp_results_by_fic_get_grid_values('ФИО', 0, mode='click')

        Driver.get().switch_to.window(Driver.get().window_handles[1])

        assert main_page.query_to_fic_get_fullname() == expected
    def test_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]