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
Exemplo n.º 2
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) == 'Вернуть'
    def test_donors_direction_warning_messages_b(self):
        main_page = DonorsModuleRegistryPage()

        main_page.clear_localstorage()

        change_donor_settings(CheckDonorInFicWhileDirection='false',
                              CheckFiasAddressForDonor='true',
                              CheckIncompleteAnalysis='true',
                              AlwaysShowEpidAddress='true')

        full_query = sql_query(
            '''select top(1) PerC.UniqueId Ent, 'Донор отведён (тип отвода: Абсолютный).' 
			OR1 from PersonCards PerC join AppointedDonationTypes AppD on PerC.UniqueId = AppD.DonorId 
			join (select AppD.DonorId, max(AppD.DonationDate) MaxDate from AppointedDonationTypes AppD group by AppD.DonorId) 
			Main on AppD.DonorId = Main.DonorId and AppD.DonationDate = Main.MaxDate 
			join ref.DonationTypeParams DonTP on AppD.DonationTypeId = DonTP.DonationTypeId 
			join ref.DonationTypes DonT on AppD.DonationTypeId = DonT.UniqueId 
			join Deferrals Def on PerC.UniqueId = Def.DonorId and Def.RevokeDate is null 
			join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId and DefT.BaseType = 1 where PerC.IsDeleted != 1 
			and PerC.BirthDateIsUndefined = 0 and PerC.DeathDate is null and PerC.UniqueId not in 
			(select PrReg.DonorId from DonationProcessRegistry PrReg where PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState != 6) 
			and PerC.UniqueId not in (select Don.DonorId from Donations Don where cast(Don.DonationDate as date) = cast(getdate() as date)) 
			and PerC.UniqueId not in (select Def.DonorId from Deferrals Def join ref.DeferralTypes DefT on Def.DeferralTypeId = DefT.UniqueId 
			where ((DefT.BaseType = 2 and Def.RevokeDate is null) or (DefT.BaseType = 3 
			and (cast(Def.StopDate as date) >= cast(getdate() as date) or Def.StopDate is null)))) and PerC.Gender in (1,2) 
			and PerC.IdentityDocId is not null and ((PerC.RegAddressId is not null and (PerC.RegAddressIsInactive = 0 
			or PerC.RegAddressIsInactive is null)) or (PerC.FactAddressId is not null and (PerC.FactAddressIsInactive = 0 
			or PerC.FactAddressIsInactive is null)) or (PerC.TempAddressId is not null and (PerC.TempAddressIsInactive = 0 
			or PerC.TempAddressIsInactive is null))) and DonTP.IsActive = 1 and DonT.DonationParams not in (4, 5, 6, 7, 12, 15) 
			and (cast(AppD.NextDonationDate as date) <= cast(getdate() as date) or AppD.NextDonationDate is null) and DonT.ChargeType = 0 
			and PerC.UniqueId not in (select Don.DonorId from Donations Don where Don.ResultStatus != 5)'''
        )

        donorid = str(full_query[0][0])

        expected_message = str(full_query[0][1])

        main_page.open()

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

        main_page.quick_search('click')

        main_page.loading_is_completed()

        ind = sql_query(
            "select Main.Nmb from (select row_number() over (order by PerC.BirthDate desc) Nmb, PerC.UniqueId from PersonCards PerC left join IdentityDocs IDoc on PerC.IdentityDocId = IDoc.UniqueId where PerC.IsDeleted != 1 and (PerC.UniqueId = '"
            + donorid + "' or IDoc.Number = '" + donorid +
            "')) Main where Main.UniqueId = '" + donorid + "'")[0][0]

        main_page.get_grid_values('UniqueId', ind, main_page.main_grid,
                                  'click')

        main_page.loading_is_completed()

        aistium.click_on(elements=main_page.process_state_button)

        main_page.loading_is_completed()

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

        assert aistium.element_is_on_the_page(
            locators_list=locators, element_name='confirm_popup') == False

        assert len(
            sql_query(
                "select PrReg.Id from DonationProcessRegistry PrReg, ref.SystemSettings SysSet where PrReg.DonorId = '"
                + donorid +
                "' and PrReg.OrgId = SysSet.CurrentOrganizationId and PrReg.RegDate = cast(getdate() as date) and PrReg.CurrentState = 1 and PrReg.MobileTeamSessionId is null"
            )) == 0