Index: tst_pre_treatment_patient_connection/test.py =================================================================== diff -u -r7882eef58dfd3755ab3a6f2709a6e81f8662a0a2 -r75b5f2a93fc13f944d268961901be981dec4bfbe --- tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 7882eef58dfd3755ab3a6f2709a6e81f8662a0a2) +++ tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 75b5f2a93fc13f944d268961901be981dec4bfbe) @@ -78,8 +78,47 @@ test.compare(rejection_message.text, config.REJECTION_REASON[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection])) test.endSection() + + +def keypad_input(key_value): + """ + Method to enter values using applicatio UI keyboard + @param key_value: (str) User expected value + """ + if key_value is not None: + names.o_keypad_input["text"] = key_value + return names.o_keypad_input + else: + test.log("Invalid text for object.") + names.o_keypad_input["text"] = "Q" + + +def enter_keypad_value(entry): + """ + Method to enter user desired + value using keypad + @param entry: (str) User expected value + """ + test.startSection("Entering {}".format(entry)) + for value in entry: +# value = int(value) + mouseClick(waitForObject(keypad_input(value))) + test.endSection() + +def erase_entered_value(input_field): + """ + Method to erase the entered value + @param input_field - (obj) object of input field + """ + input_field = waitForObject(input_field).text + for value in input_field: + test.log(str(value)) + mouseClick(squish.waitForObjectExists(names.o_back_space_key)) + + test.compare(input_field, "", "Input field should be empty") + def verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val, dia_val, heart_rate, save): """ method to enter systolic, diastolic and heart rate value and save or unsave it and verify @@ -91,26 +130,22 @@ """ test.startSection("Verify the entered systolic, diastolic and heart rate value updated in main-treatement screen") mouseClick(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry)) - erase_entered_value(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry)) - type(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry), sys_val) - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).enabled, True, "Tutorial text should be enabled.")) - test.compare(str(waitForObjectExists(names.o_swipeview_tutorial_text).text, config.TUTORIAL_TEXT[screen_indicator], "Tutorial text should be {msg}".format(msg=config.TUTORIAL_TEXT[screen_indicator]))) - - - + erase_entered_value(names.o_PreTreatmentBase_input_TextInput_2) + enter_keypad_value(str(sys_val)) - verify_entered_value_in_pop_up(value=str(sys_val), input_field=systolic, - vital=SYSTOLIC_TEXT) - verify_color_of_entry(entry=sys_val, vital_parameter=SYSTOLIC_TEXT, - input_field=systolic) - diastolic = waitForObject(names.o_pop_up_diastolic_input_field) - mouseClick(diastolic) + test.verify(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).enabled, "systolic value should be enabled.") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).text, str(sys_val), "systolic value should be : "+str(sys_val)) + verify_color_of_entry(entry=sys_val, vital_parameter=SYSTOLIC_TEXT, input_field=waitForObject(names.o_PreTreatmentBase_input_TextInput_2)) + + + mouseClick(waitForObject(names.o_pop_up_diastolic_input_field)) erase_entered_value(diastolic) enter_keypad_value(str(dia_val)) verify_entered_value_in_pop_up(value=str(dia_val), input_field=diastolic, vital=DIASTOLIC_TEXT) verify_color_of_entry(entry=dia_val, vital_parameter=DIASTOLIC_TEXT, input_field=diastolic) + hr = waitForObject(names.o_pop_up_heart_rate_input_field) mouseClick(hr) erase_entered_value(hr) @@ -142,7 +177,7 @@ """ Method to verify the color of entry of systolic, diastolic and heart rate - @param entry: (int) user user entered value + @param entry: (int) user entered value @param vital_parameter - (str) parameter name under which user is entering value (sys/dia/heart rate) @param input_field - (obj) object of input field """ @@ -208,26 +243,7 @@ for instruction_screen in (screen_indicator): mouseClick(waitForObject(names.o_PreTreatmentBase_leftImage_Image)) - - -def verify_filter_flush_text(): - """ - Verify Filter Flush Text on UI Screen - """ - test.log("Verifying the text 'Filter Flush'") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Filter_Flush_Text).text),FILTER_FLUSH_TEXT, "Verified Filter Flush text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Create_Text).text),CREATE, "Verified Create text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Sample_Text).text),SAMPLE, "Verified Sample text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Consumables_Text).text),CONSUMABLES, "Verified Consumables text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Disposables_Text).text),DISPOSABLES, "Verified Disposables text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Prime_Text).text),PRIME, "Verified PRIME text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Ultrafiltration_Text).text),ULTRAFILTERATION, "Verified Ultrafilteration text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_BP_HR_Text).text),BP_HR, "Verified BP/HR text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Connection_Text).text),CONNECTION, "Verified Connection text") - test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Start_Text).text),START, "Verified Start text") - - def drag_and_drop_ultrafilteration_slider(slider_value = 0, maximum_ultrafilteration = 0): """ Tests to verify ultrafilteration slider range