Ejemplo n.º 1
0
class TestAgreeCheckboxes(BaseTest):

	@allure.step('1. Проверка установленного по умолчанию значения "Получено согласие на обработку данных"')
	@pytest.mark.parametrize('expected_result, test_data_set_number', get_data('data_test_is_agree_persional_data_processing_default_value.csv'))
	def test_is_agree_persional_data_processing_default_value(self, 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')

		main_page.check_is_agree_persional_data_processing(expected_result)

	@allure.step('2. Проверка установленного по умолчанию значения "Получено согласие на e-mail и смс рассылку"')
	@pytest.mark.parametrize('expected_result, test_data_set_number', get_data('data_test_is_message_agree_default_value.csv'))
	def test_is_message_agree_default_value(self, 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')

		main_page.check_is_message_agree(expected_result)

	@allure.step('3. Проверка работы флагов и перехода на вторую страницу поп-апа при различных комбинациях"')
	@pytest.mark.parametrize('is_agree_persional_data_processing, is_message_agree, expected_result1, expected_result2, test_data_set_number', get_data('data_test_agreement_checkboxes.csv'))
	def test_agree_checkboxes(self, is_agree_persional_data_processing, is_message_agree, expected_result1, expected_result2, 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')

		if is_agree_persional_data_processing == 'false':
			aistium.click_on(elements=main_page.is_agree_persional_data_processing)

		if is_message_agree == 'false':
			aistium.click_on(elements=main_page.is_message_agree)

		aistium.click_on(elements=main_page.next_step_ndp)

		main_page.loading_is_completed()

		main_page.ndp_second_page_loaded()

		main_page.check_is_agree_persional_data_processing(expected_result1)

		main_page.check_is_message_agree(expected_result2)
class TestExtendedSearchByLastname(BaseTest):
    @allure.step(
        '1. МД. Регистратура. Валидация поля "Фамилия" в расширенном поиске.')
    @pytest.mark.parametrize(
        'lastname, expected_result, test_data_set_number',
        get_data('data_test_extended_search_by_lastname_a.csv'))
    def test_extended_search_by_lastname_a(self, lastname, expected_result,
                                           test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        main_page.filling_fio_in_extended_search(lastname, '', '')

        assert main_page.get_lastname_from_extended_search() == expected_result

    @allure.step(
        '2. МД. Регистратура. Валидация поля "Фамилия" в расширенном поиске.')
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_extended_search_by_lastname_b.csv'))
    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]
Ejemplo n.º 3
0
class TestExtendedSearchByDonorNumber(BaseTest):
    @allure.step(
        '1. МД. Поиск донора по Поиск донора по № в регистратуре (расширенный поиск в регистратуре донорского отделения)'
    )
    @pytest.mark.parametrize(
        'number, expected_result, test_data_set_number',
        get_data('data_test_extended_search_by_donor_number_a.tsv',
                 expansion='tsv'))
    def test_extended_search_by_donor_number_a(self, number, expected_result,
                                               test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        main_page.open()

        main_page.extended_search_click('open')

        aistium.fill(number, elements=main_page.extended_registry_number)

        assert main_page.get_donorid_from_extended_search() == expected_result

    @allure.step(
        '2. МД. Поиск донора по Поиск донора по № в регистратуре(расширенный поиск в регистратуре донорского отделения)'
    )
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_extended_search_by_donor_number_b.csv'))
    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
class TestFirstnameValidation(BaseTest):
    @allure.step('Валидация поля Имя при добавлении донора')
    @pytest.mark.parametrize(
        'firstname, expected_result, test_data_set_number',
        get_data('data_test_firstname_validation.csv'))
    def test_firstname_validation_message(self, firstname, expected_result,
                                          test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

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

        main_page.select_gender('male')

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

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.if_donor_is_in_local_cabinet()

        main_page.ndp_second_page_loaded()
Ejemplo n.º 5
0
class TestNdpBirthPlace(BaseTest):
    @allure.step('Валидация поля Место рождения при добавлении донора')
    @pytest.mark.parametrize(
        'birth_place, expected_result, test_data_set_number',
        get_data('data_test_ndp_birth_place.csv'))
    def test_ndp_birth_place(self, birth_place, 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')

        main_page.ndp_filling_birth_place(birth_place)

        assert aistium.get_value(
            locators_list=locators,
            element_name='ndp_birth_place') == 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()
Ejemplo n.º 6
0
class TestLastnameValidation(BaseTest):
    @allure.step(
        'Проверка правильности сохранения поля "Фамилия" и перехода на следующую страницу поп-апа'
    )
    @pytest.mark.parametrize('lastname, expected_result, test_data_set_number',
                             get_data('data_test_lastname_validation.csv'))
    def test_lastname_validation_message(self, lastname, expected_result,
                                         test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        main_page.ndp_filling_first_page(lastname, "Кирилл", "", "01.06.1980",
                                         "8910", "650231")

        main_page.select_gender('male')

        assert aistium.get_value(
            locators_list=locators,
            element_name='last_name_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()
Ejemplo n.º 7
0
class TestNdpValidationOfDocumentType(BaseTest):
    @allure.step('1. Проверка значения по умолчанию')
    @pytest.mark.parametrize(
        'expected_result, test_data_set_number',
        get_data('data_test_ndp_validation_of_document_type_default.csv'))
    def test_ndp_validation_of_document_type_default(self, expected_result,
                                                     test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        assert main_page.ndp_get_document_type_value() == expected_result

    @allure.step('2. Проверка значений в списке для выбора')
    def test_ndp_validation_of_document_type_list(self):
        main_page = DonorsModuleRegistryPage()

        main_page.open()

        main_page.newdonor_click()

        assert main_page.ndp_get_document_type_listbox() == [
            'Паспорт РФ', 'Военный билет', 'Загранпаспорт РФ', 'Паспорт СССР',
            'Иные документы', 'Св-во о рождении'
        ]
Ejemplo n.º 8
0
class TestGridDonorId(BaseTest):
    @allure.step(
        'МД. Отображение поля № в гриде (регистратура донорского отделения)')
    @pytest.mark.parametrize('query, test_data_set_number',
                             get_data('data_test_grid_donor_id.csv'))
    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
class TestDonorMinicardDiseasesGridComment(BaseTest):

	@allure.step('МД. Поле Комментарий в гриде, Заболевания донора (карточка донора в регистратуре донорского отделения)')
	@pytest.mark.parametrize('query, test_data_set_number', get_data('data_test_donor_minicard_diseases_grid_comment.csv'))
	def test_donor_minicard_diseases_grid_comment(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('Comment', 1, main_page.diseases_grid) == expected_result
Ejemplo n.º 10
0
class TestDocumentSerieValidation(BaseTest):
    @allure.step('Проверка поля "Серия" документа при создании донора')
    @pytest.mark.parametrize(
        'document_type, document_serie, document_number, expected_result, test_data_set_number',
        get_data('data_test_document_serie_validation.tsv', expansion='tsv'))
    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()
Ejemplo n.º 11
0
class TestSimpleSearchByFullname(BaseTest):
    @allure.step(
        'Поиск донора по ФИО (быстрый поиск в регистратуре донорского отделения)'
    )
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_simple_search_by_fullname.csv'))
    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
Ejemplo n.º 12
0
class TestGridDocument(BaseTest):
    @allure.step(
        'МД. Отображение поля Документ в гриде (регистратура донорского отделения)'
    )
    @pytest.mark.parametrize('query, test_data_set_number',
                             get_data('data_test_grid_document.csv'))
    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
Ejemplo n.º 13
0
class TestNdpDocumentDateValidationMessages(BaseTest):
    @allure.step(
        'Проверка валидационных сообщений для поля даты выдачи документа, удостоверяющего личность'
    )
    @pytest.mark.parametrize(
        'date_issue, issued_by, expected_result, test_data_set_number',
        get_data('data_test_ndp_document_date_validation_messages.csv'))
    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
Ejemplo n.º 14
0
class TestGenderValidation(BaseTest):
    @allure.step('Валидация выбранного пола')
    @pytest.mark.parametrize(
        'middlename, gender, expected_result, test_data_set_number',
        get_data('data_test_gender_validation.csv'))
    def test_gender_validation(self, middlename, gender, 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")

        main_page.select_gender(gender)

        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.check_saved_gender(expected_result) == expected_result
class TestDocumentSerieValidationMessages(BaseTest):
    @allure.step(
        'Валидационные сообщения поля "Серия" документа при создании донора')
    @pytest.mark.parametrize(
        'document_type, document_serie, document_number, expected_result, test_data_set_number',
        get_data('data_test_document_serie_validation_messages.csv'))
    def test_document_serie_validation_messages(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')

        aistium.click_on(elements=main_page.next_step_ndp)

        main_page.loading_is_completed()

        assert main_page.get_validation_message_text() == expected_result
Ejemplo n.º 16
0
class TestGridRh(BaseTest):
    @allure.step(
        'МД. Отображение поля RH в гриде (регистратура донорского отделения)')
    @pytest.mark.parametrize('query, expected_color, test_data_set_number',
                             get_data('data_test_grid_rh.csv'))
    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
class TestBirthDateValidationMessages(BaseTest):
    @allure.step(
        'Валидация поля Дата рождения (запрещающие сообщения) при добавлении донора'
    )
    @pytest.mark.parametrize(
        'birthdate, expected_result, test_data_set_number',
        get_data('data_test_birthdate_validation_messages.csv'))
    def test_birthdate_validation_messages(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)

        if expected_result == 'Дата рождения ограничена настройками системы: от ':

            assert main_page.get_validation_message_text(
            ) == expected_result + date_calculation(
                'today - sys_max_age') + '.'

        else:

            main_page.get_validation_message_text() == expected_result
Ejemplo n.º 18
0
class TestNdpSnils(BaseTest):
    @allure.step(
        'Проверка поля "СНИЛС": ввод значений и сравнение с ожидаемым результатом'
    )
    @pytest.mark.parametrize('snils, expected_result, test_data_set_number',
                             get_data('data_test_ndp_snils.csv'))
    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
class TestDonorCardGender(BaseTest):

	@allure.step('МД. Пол донора (карточка донора в регистратуре донорского отделения) (автотест)')
	@pytest.mark.parametrize('query, expected_result, test_data_set_number', get_data('data_test_donor_minicard_gender.csv'))
	def test_donor_minicard_gender(self, query, expected_result, 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('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()

		assert main_page.get_gender_from_minicard() == expected_result
Ejemplo n.º 20
0
class TestExtendedSearchByNextDonationDateValidationMessages(BaseTest):
    @allure.step(
        '1. МД. Поиск донора по Дате следующей донации (запрещающие сообщения) (расширенный поиск в регистратуре донорского отделения)'
    )
    @pytest.mark.parametrize(
        'next_donation_date_from, next_donation_date_to, expected_result, test_data_set_number',
        get_data(
            'data_test_extended_search_by_next_donation_date_validation_messages.csv'
        ))
    def test_extended_search_by_next_donation_date_validation_messages(
            self, next_donation_date_from, next_donation_date_to,
            expected_result, test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        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_alert_text() == expected_result
class TestDeferralTypeColorAndType(BaseTest):
    @allure.step('2. Проверка на цвета и значения типов отводов')
    @pytest.mark.parametrize(
        'expected_color, expected_type, test_data_set_number',
        get_data('data_test_deferral_type_color_and_type.csv'))
    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
Ejemplo n.º 22
0
class TestBirthDateValidation(BaseTest):

	@allure.step('Валидация поля Дата рождения (предупреждающие сообщения) при добавлении донора, проверка текста предупреждающего сообщения, подверждение - нет')
	@pytest.mark.parametrize('birthdate, test_data_set_number', get_data('data_test_birthdate_validation_no.csv'))
	def test_birthdate_validation_confirm_no(self, birthdate, 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)

		assert aistium.get_text(locators_list=locators, element_name='confirm_popup') == 'Возраст донора меньше рекомендуемого для сдачи донаций. Продолжить?'

		aistium.click_on(locators_list=locators, element_name='confirm_popup_no_btn')

		assert main_page.is_birthdate_field_focused() == True

	@allure.step('Валидация поля Дата рождения (предупреждающие сообщения) при добавлении донора, проверка текста предупреждающего сообщения, подверждение - да')
	@pytest.mark.parametrize('birthdate, test_data_set_number', get_data('data_test_birthdate_validation_yes.csv'))
	def test_birthdate_validation_confirm_yes(self, birthdate, 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)

		assert aistium.get_text(locators_list=locators, element_name='confirm_popup') == 'Возраст донора меньше рекомендуемого для сдачи донаций. Продолжить?'

		aistium.click_on(locators_list=locators, element_name='confirm_popup_yes_btn')

		main_page.if_donor_is_in_local_cabinet()

		main_page.ndp_second_page_loaded()
class TestExtendedSearchByDonationBarcode(BaseTest):

	@allure.step('1. МД. Поиск донора по Штрихкоду донации (расширенный поиск в регистратуре донорского отделения)')
	@pytest.mark.parametrize('barcode, expected_result, test_data_set_number', get_data('data_test_extended_search_by_donation_barcode_a.tsv', expansion='tsv'))
	def test_extended_search_by_donation_barcode_a(self, barcode, expected_result, test_data_set_number):
		main_page = DonorsModuleRegistryPage()

		main_page.clear_localstorage()

		main_page.open()

		main_page.extended_search_click('open')

		aistium.fill(barcode, elements=main_page.extended_donation_barcode)

		assert main_page.get_barcode_from_extended_search() == expected_result

	@allure.step('2. МД. Поиск донора по Штрихкоду донации (расширенный поиск в регистратуре донорского отделения)')
	@pytest.mark.parametrize('query, test_data_set_number', get_data('data_test_extended_search_by_donation_barcode_b.csv'))
	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]
Ejemplo n.º 24
0
class TestDeferralsGridCreatedColumn(BaseTest):
    @allure.step(
        '1. МД. Поле Создан в гриде, Отводы донора (карточка донора в регистратуре донорского отделения)'
    )
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_deferrals_grid_created_column.csv'))
    def test_deferral_grid_created_column(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_result = str(full_query[0][1])

        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('Fio',
                                  ind,
                                  main_page.main_grid,
                                  mode='click')

        main_page.loading_is_completed()

        main_page.deferrals_button.click()

        main_page.loading_is_completed()

        aistium.click_on(elements=main_page.deferral_only_active_tick)

        main_page.get_grid_values('CreateDate',
                                  1,
                                  main_page.deferrals_grid,
                                  mode='click')

        assert main_page.get_grid_values('CreateDate',
                                         1,
                                         main_page.deferrals_grid,
                                         mode='get_value') == expected_result
Ejemplo n.º 25
0
class TestValidationMessagesOfDonorsDirection(BaseTest):
    @allure.step(
        '1. МД. Регистратура. Проверка текста запрещающих сообщений при направлении донора.'
    )
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_validation_messages_of_donors_direction.csv'))
    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
class TestDeferralIncorrectInput(BaseTest):
    @allure.step(
        '5. Проверка на ввод некорректных значений в поле "Отвод" и сохранение донора'
    )
    @pytest.mark.parametrize('incorrect_value, test_data_set_number',
                             get_data('data_test_deferral_incorrect_input.csv')
                             )
    def test_deferral_incorrect_input(self, incorrect_value,
                                      test_data_set_number):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

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

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

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

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

        main_page.ndp_filling_deferral(incorrect_value, 'incorrect_input')

        main_page.is_deferral_listbox_empty()

        main_page.ndp_deferrals_press_enter()

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

        main_page.ndp_save_new_donor('success')

        assert aistium.get_text(
            elements=main_page.fio_minicard) == 'Сидоров Алексей'
Ejemplo n.º 27
0
class TestNdpJobPlaceEnterValue(BaseTest):
    @allure.step(
        '4. Ввод в Место работы/учёбы различных символов валидных типов')
    @pytest.mark.parametrize(
        'job_place, expected_result, test_data_set_number',
        get_data('data_test_ndp_job_place.csv'))
    def test_ndp_job_place(self, job_place, 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", "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('Перовская ул')

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

        aistium.fill(job_place, 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() == expected_result
Ejemplo n.º 28
0
class TestNdpJobPosition(BaseTest):
    @allure.step(
        'Валидация поля Должность (Место работы/учебы) при добавлении донора')
    @pytest.mark.parametrize(
        'job_position, expected_result, test_data_set_number',
        get_data('data_test_ndp_job_position.csv'))
    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
class TestNdpJobPositionMessage(BaseTest):
    @allure.step(
        'Валидация поля Должность (Место работы/учебы) (запрещающие сообщения) при добавлении донора'
    )
    @pytest.mark.parametrize(
        'job_position, expected_result, test_data_set_number',
        get_data('data_test_ndp_job_position_message.csv'))
    def test_ndp_job_position_message(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('Перовская ул')

        main_page.ndp_filling_house('4')

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

        main_page.ndp_save_new_donor('success')

        main_page.loading_is_completed()

        assert main_page.get_validation_message_text() == expected_result
class TestDonorCardMobilePhone(BaseTest):
    @allure.step(
        'МД. Мобильный телефон (карточка донора в регистратуре донорского отделения) (автотест)'
    )
    @pytest.mark.parametrize(
        'query, test_data_set_number',
        get_data('data_test_donor_minicard_mobile_phone.csv'))
    def test_donor_minicard_mobile_phone(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])

        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_mobile_phone',
                element_name='minicard_mobile_phone') == False
        else:
            assert aistium.get_text(
                elements=main_page.minicard_mobile_phone) == expected_result