Index: tst_patient_id/test.py =================================================================== diff -u -reb6b44f678d46f2b0fab047200a020e738d80798 -r18c2d43e6ee4fe3d5a531fe4c67d210ec2f1b183 --- tst_patient_id/test.py (.../test.py) (revision eb6b44f678d46f2b0fab047200a020e738d80798) +++ tst_patient_id/test.py (.../test.py) (revision 18c2d43e6ee4fe3d5a531fe4c67d210ec2f1b183) @@ -16,12 +16,12 @@ # This test is intended to be used to verify patient id in application. . import names - -from configuration import utility, config from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator +from configuration import utility, config + def keyboard_object_map_helper(text): """ Method for setting custom object property's for keyboard keys @@ -65,37 +65,27 @@ object_status = object.exists(keyboard_value) if object_status is True: return text - object_status = object.exists(names.o_keyboard_switch) + object_status = object.exists(names.o_keyboard_switch2) if object_status is True: - keyboard_value = waitForObject(names.o_keyboard_switch) + keyboard_value = waitForObject(names.o_keyboard_switch2) mouseClick(keyboard_value) text = text.lower() keyboard_value = keyboard_object_map_helper(text) object_status = object.exists(keyboard_value) if object_status is True: return text - object_status = object.exists(names.o_keyboard_switch_2) + object_status = object.exists(names.o_keyboard_switch) if object_status is True: - keyboard_value = waitForObject(names.o_keyboard_switch_2) + keyboard_value = waitForObject(names.o_keyboard_switch) mouseClick(keyboard_value) text = text.lower() keyboard_value = keyboard_object_map_helper(text) object_status = object.exists(keyboard_value) if object_status is True: return text + -def verify_patient_id(expected_patient_id): - expected_id = "" - for letter in expected_patient_id: - print(letter) - if letter.isalpha() or letter.isnumeric(): - expected_id += letter - else: - pass - patient_id_input = waitForObject(names.o_input_patient_id) - test.compare(patient_id_input.text, expected_id, "Patient id should be ->" + expected_id) - def user_input_clear_option(): """ Tests to clear retained patient id @@ -111,25 +101,22 @@ patient_id_length = patient_id_length - 1 -def validation_of_valid_patient_id_through_keypad(expected_value): +def validation_of_valid_patient_id_through_keypad(expected_value, actual_value): """ Tests verifies valid patient id set through application keyboard setup . @return: N/A """ patient_id_input = waitForObject(names.o_input_patient_id) mouseClick(patient_id_input) - patient_id = list(expected_value) - for text in patient_id: + for text in expected_value: keyword_state = keyboard_switching_section(text) if keyword_state is not None: keyboard_value = keyboard_object_map_helper(keyword_state) mouseClick(waitForObject(keyboard_value)) utils.waitForGUI(.2) - verify_patient_id(expected_value) -# test.compare(expected_value, (patient_id_input.text)) -# test.log("Patient id should be -> "+ expected_value) + test.compare(actual_value, (patient_id_input.text), "Patient id should be -> "+ str(actual_value)) verify_confirm_button_based_on_patient_id(expected_value) mouseClick(waitForObject(names.o_confirm_button)) @@ -140,7 +127,7 @@ mouseClick(waitForObject(names.o_back_button)) -def validation_of_valid_patient_id_through_user_input(expected_value): +def validation_of_valid_patient_id_through_user_input(expected_value, actual_value): """ Tests verifies valid patient id set through user's input. @@ -149,16 +136,15 @@ patient_id_input = waitForObject(names.o_input_patient_id) mouseClick(waitForObject(patient_id_input)) type(waitForObject(names.o_input_patient_id), expected_value) - verify_patient_id(expected_value) -# test.compare(expected_value, (patient_id_input.text)) -# test.log("Patient id should be ->" + expected_value) + test.compare(actual_value, (patient_id_input.text)) + test.log("Patient id should be ->" + expected_value) verify_confirm_button_based_on_patient_id(expected_value) mouseClick(waitForObject(names.o_confirm_button)) custom_treatment = waitForObject(names.o_custom_treatment) test.compare("Create a Custom Treatment", custom_treatment.text) - test.log("user successfully authenticated through patient id ->"+ expected_value) + test.log("user successfully authenticated through patient id ->"+ actual_value) mouseClick(waitForObject(names.o_back_button)) @@ -173,12 +159,11 @@ if patient_id is None: mouseClick( waitForObject(names.o_input_patient_id)) type( waitForObject(names.o_input_patient_id), " ") - confirm_button_status = waitForObject(names.o_confirm_button) + confirm_button_status = findObject(names.o_confirm_button) if confirm_button_status.enabled == False: test.passes("confirm button disabled without patient id") else: - #None patient id is accepting in application "space is accepting" - development stage - test.xfail("confirm button enabled without patient id") + test.fail("confirm button enabled without patient id") else: confirm_button_status = waitForObject(names.o_confirm_button) if confirm_button_status.enabled == True: @@ -208,24 +193,20 @@ utils.tstStart(__file__) startApplication(config.AUT_NAME) - utils.waitForGUI(1) - hd = HDSimulator() + hd = HDSimulator() - hd.cmd_send_power_on_self_test_version_request() hd.cmd_send_hd_operation_mode(4, 0) + utils.waitForGUI(2) mouseClick(waitForObject(names.o_input_patient_id)) - for patient_id in config.CHARACTER_PATIENT_ID: - validation_of_valid_patient_id_through_keypad(patient_id) - validation_of_valid_patient_id_through_user_input(patient_id) - - for patient_id in config.ALPHANUMERIC_PATIENT_ID: - validation_of_valid_patient_id_through_keypad(patient_id) - validation_of_valid_patient_id_through_user_input(patient_id) - + for expected_patient_id, actual_patient_id in config.PATIENT_ID.items(): + validation_of_valid_patient_id_through_keypad(expected_patient_id, actual_patient_id) + validation_of_valid_patient_id_through_user_input(expected_patient_id, actual_patient_id) + #verification of confirm button without giving patient id verify_confirm_button_based_on_patient_id(patient_id = None) utils.tstDone() +