Index: tst_treatment_saline_data/test.py =================================================================== diff -u -r6370ecd7783faa19562c022b1876d8ad2ab63c86 -r20f71633acc71b9332335b30d882c45223e02c22 --- tst_treatment_saline_data/test.py (.../test.py) (revision 6370ecd7783faa19562c022b1876d8ad2ab63c86) +++ tst_treatment_saline_data/test.py (.../test.py) (revision 20f71633acc71b9332335b30d882c45223e02c22) @@ -16,7 +16,6 @@ import names -import re from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from dialin.common.ui_defs import TXStates as txStates @@ -44,36 +43,26 @@ Method to verify target value on saline section @param expected_target_value: (int) expected target value on saline section """ - saline_target = object.children(waitForObject(names.o_fluid_text))[0] - target_value = re.findall(r'\w+', str(saline_target.text)) - test.compare(str(expected_target_value), str(target_value[0]), "Target value verified") - test.compare(get_unit(), str(target_value[1]), "Target unit verified") + test.compare(waitForObjectExists(names.o_treatmentStart_SalineSection).valueTarget , float(expected_target_value), "Target value verified") + test.compare(waitForObjectExists(names.o_treatmentHome_mL_Text).text , get_unit(), "Target unit verified" ) def verification_of_cumulative_value(expected_cumulative_value): """ Method to verify cumulative value on saline section @param expected_cumulative_value: (int) expected cumulative value on saline section """ - saline_unit = object.children(waitForObject(names.o_cumulative_fluid_text))[0] - if (saline_unit.text == config.SALINE_UNIT) and (saline_unit.text == get_unit()): - saline_cumulative = object.children(waitForObject(names.o_cumulative_fluid_text))[1] - test.compare(str(expected_cumulative_value), str(saline_cumulative.text)) - else: - test.fail("Deviation observed in unit of saline (fluid)") + test.compare(waitForObjectExists(names.o_treatmentHome_cumalative_value).text , expected_cumulative_value, "cumulative value verified") + test.compare(waitForObjectExists(names.o_treatmentHome_cumalative_unit).text , config.SALINE_UNIT, "cumulative unit verified" ) + - def verification_of_delivered_value(expected_delivered_value): """ Method to verify delivered value on saline section @param expected_delivered_valuee: (int) expected delivered value on saline section """ - saline_unit = object.children(waitForObject(names.o_fluid_text))[1] - if (saline_unit.text == config.SALINE_UNIT) and (saline_unit.text == get_unit()): - saline_cumulative = object.children(waitForObject(names.o_fluid_text))[2] - test.compare(str(expected_delivered_value), str(saline_cumulative.text)) - else: - test.fail("Deviation observed in unit of saline (fluid)") + test.compare(waitForObjectExists(names.o_treatmentHome_delivered_value).text , expected_delivered_value, "delivered value verified") + test.compare(waitForObjectExists(names.o_treatmentHome_delivered_unit).text , config.SALINE_UNIT, "delivered unit verified" ) def goto_screen_contains_treatment_saline_bolus_data(): @@ -111,8 +100,8 @@ # when rejected reason set 16 -> saline bolus in progress if (not accept_status): rejection_reason = rejectReason.REQUEST_REJECT_REASON_SALINE_BOLUS_IN_PROGRESS.value hd_simulator.cmd_set_saline_bolus_response(accepted = accept_status, reason = rejection_reason, target = target, state = saline_states) - if (not accept_status): test.compare(findObject(names.o_treatment_notification_bar).text, config.REJECTION_MESSAGE[rejection_reason], \ - "expected rejection {msg} displayed".format(msg=config.REJECTION_MESSAGE[rejection_reason])) + if (not accept_status): test.compare(findObject(names.o_treatment_notification_bar).text, config.REJECTION_REASON[rejection_reason], \ + "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection_reason])) #set saline transition state. hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=saline_states, heparin_state= 0, @@ -135,7 +124,7 @@ for rejection in range(1, config.NUM_OF_REQUEST_REJECT_REASONS): hd_simulator.cmd_set_saline_bolus_response(accepted = accept_status, reason = rejection, target = target, state = saline_states) rejection_message = findObject(names.o_treatment_notification_bar) - test.compare(rejection_message.text, config.REJECTION_MESSAGE[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_MESSAGE[rejection])) + test.compare(rejection_message.text, config.REJECTION_REASON[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection])) test.endSection() @@ -159,9 +148,9 @@ test.log("verification of saline values from dialysis state for target value :" + str(target_value)+\ " cumulative value :" +str(cumulative_value)+" and delivered value :"+ str(delivered_value)) - verification_of_target_value(expected_target_value = format(format(target_value, '.0f'))) - verification_of_delivered_value(expected_delivered_value = format(format(delivered_value, '.0f'))) - verification_of_cumulative_value(expected_cumulative_value = format(format(cumulative_value, '.0f'))) + verification_of_target_value(expected_target_value = format(target_value, '.1f')) + verification_of_delivered_value(expected_delivered_value = format(delivered_value, '.0f')) + verification_of_cumulative_value(expected_cumulative_value = format(cumulative_value, '.0f')) test.endSection()