Index: shared/scripts/configuration/strings.py =================================================================== diff -u -ra309546f47434a0a2a22de97e24947d252b59106 -r5347ee52338d76725d5f4cdca3f8077ef2997ba3 --- shared/scripts/configuration/strings.py (.../strings.py) (revision a309546f47434a0a2a22de97e24947d252b59106) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision 5347ee52338d76725d5f4cdca3f8077ef2997ba3) @@ -41,19 +41,8 @@ 3 : "Connect arterial and venous cartridge lines to your patient access lines." } -PRE_TREATMENT_SCREENS = { - 1 : "Create" , - 2 : "Sample" , - 3 : "Consumables" , - 4 : "Disposables" , - 5 : "Prime" , - 6 : "Ultrafiltration" , - 7 : "BP/HR" , - 8 : "Connection" , - 9 : "Start" -} +PRE_TREATMENT_SCREENS = ["Create" , "Sample" , "Consumables" , "Disposables" , "Prime" , "Ultrafiltration" , "BP/HR" , "Connection" , "Start"] - # dictionary of rejection reason from application source code. # message location -> denali-> Headers-> common-> MsgDefs.h REJECTION_REASON = { Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r08990cb9543b8deb3f05a05e6172029b4732e889 -r5347ee52338d76725d5f4cdca3f8077ef2997ba3 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 08990cb9543b8deb3f05a05e6172029b4732e889) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 5347ee52338d76725d5f4cdca3f8077ef2997ba3) @@ -74,89 +74,61 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") - -def page_step_indicator_verification(pre_treatment_step, pre_treatment_items_object): - """ - Method to verify the Page Step indicators on top of the screen which indicates the steps passed, current, remained] - @param pre_treatment_step :(int) indicates the Current pre-treatment step - @param pre_treatment_items_object :(dictionary) pre_treatment bullet object - @return N/A - """ - test.startSection("Method to verify the Page Step indicators from patient connection section") - for page in range(1, len(config.PRE_TREATMENT_SCREENS)): - pre_treatment_items_object["occurrence"] = page - bullet_children = object.children(squish.waitForObject(pre_treatment_items_object)) +def verify_page_step_indicator(screen_obj, pre_treatment_step): + """ + Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] + @param pre_treatment_step : indicates the Current pre-treatment step + """ + test.startSection("verification of page step indicators") + for page in range(len(config.PRE_TREATMENT_SCREENS)): + bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name - step_title = bullet_children[2] - #To verify the step indicators of the completed pre treatment screens + step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.PRE_TREATMENT_SCREENS[page])) + if page < pre_treatment_step: - test.verify(squish.waitForObjectExists(pre_treatment_items_object).complete, str(config.PRE_TREATMENT_SCREENS[page]+" complete attribute should be True")) - test.verify(not squish.waitForObjectExists(pre_treatment_items_object).current, str(config.PRE_TREATMENT_SCREENS[page]+" current attribute should be false")) - test.compare(bullet_circle_color, config.COMPLETE_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet color hex should be "+str(config.COMPLETE_COLOR))) - test.compare(bullet_border_color, config.COMPLETE_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet border color hex should be "+str(config.COMPLETE_COLOR))) - test.compare(step_title.color.name, config.ENABLED_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" title color hex should be "+str(config.ENABLED_COLOR))) - #To verify the step indicators of the current pre treatment screen + test.log("To verify the step indicator of the completed pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.compare(bullet_circle_color, config.COMPLETE_COLOR, " the bullet color must be " + str(config.COMPLETE_COLOR)) + test.compare(bullet_border_color, config.COMPLETE_COLOR," the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name, config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + elif page == pre_treatment_step: - test.verify(squish.waitForObjectExists(pre_treatment_items_object).current, str(config.PRE_TREATMENT_SCREENS[page]+" complete attribute should be True")) - test.verify(not squish.waitForObjectExists(pre_treatment_items_object).complete, str(config.PRE_TREATMENT_SCREENS[page]+" current attribute should be false")) - test.compare(bullet_circle_color,config.CURRENT_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet color hex should be "+str(config.CURRENT_COLOR))) - test.compare(bullet_border_color,config.COMPLETE_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet border color hex should be "+str(config.COMPLETE_COLOR))) - test.compare(step_title.color.name,config.ENABLED_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" title color hex should be "+str(config.ENABLED_COLOR))) - test.verify(step_title.font.bold, str(config.PRE_TREATMENT_SCREENS[page]+" title font bold should be "+str(config.ENABLED_COLOR))) - #To verify the step indicators of the remaining pre-treatment screens + test.log("To verify the step indicators of the current pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.COMPLETE_COLOR, " the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name,config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + test.verify(step_title.font.bold, " the current text must be in bold") + else: - test.verify(not squish.waitForObjectExists(pre_treatment_items_object).current, str(config.PRE_TREATMENT_SCREENS[page]+" complete attribute should be false")) - test.verify(not squish.waitForObjectExists(pre_treatment_items_object).complete, str(config.PRE_TREATMENT_SCREENS[page]+" current attribute should be false")) - test.compare(step_title.color.name,config.INCOMPLETE_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" title color hex should be "+str(config.INCOMPLETE_COLOR))) - test.compare(bullet_circle_color,config.CURRENT_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet circle color hex should be "+str(config.CURRENT_COLOR))) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR, str(config.PRE_TREATMENT_SCREENS[page]+" bullet border color hex should be "+str(config.INCOMPLETE_COLOR))) - - test.endSection() + test.log("To verify the step indicators of the remaining pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete,) + test.compare(step_title.color.name,config.INCOMPLETE_COLOR, " the text color must be " + str(config.INCOMPLETE_COLOR)) + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) + test.endSection() - -def instruction_screen_indicator_verification(current_indicator, training_items_object): +def get_text_object(screen_obj, txt): """ - Method to verify the pre treatment tutorial indicators on top of the screen which indicates the steps passed, current, remained] - @param current_indicator :(int) Current pre-treatment tutorial indicator - @param training_items_object :(dictionary) pre_treatment bullet object - @return N/A - """ - test.startSection("Method to verify the Page Step indicators from training screen") - for page in range(config.TRAINING_INDICATOR_SCREEN): - occurrence_index = 10 + page #1-9 occurrence of object belongs to page indicators, 10 - 13 occurrence of object belongs to training indicators - training_items_object["occurrence"] = occurrence_index - bullet_children = object.children(squish.waitForObject(training_items_object)) - bullet_circle_color = bullet_children[0].color.name - bullet_border_color = bullet_children[0].border.color.name - #To verify the step indicators of pre treatment tutorial screens - if page < current_indicator: - test.verify(squish.waitForObjectExists(training_items_object).complete, "bullet indicator {index} should be in complete state".format(index=current_indicator)) - test.verify(not squish.waitForObjectExists(training_items_object).current, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) - test.compare(bullet_circle_color, config.COMPLETE_COLOR, " bullet color hex should be "+str(config.COMPLETE_COLOR)) - test.compare(bullet_border_color, config.COMPLETE_COLOR, " bullet border color hex should be "+str(config.COMPLETE_COLOR)) - #To verify the step indicators of pre treatment tutorial screen - elif page == current_indicator: - test.verify(squish.waitForObjectExists(training_items_object).current, "bullet indicator {index} should be in complete state".format(index=current_indicator)) - test.verify(not squish.waitForObjectExists(training_items_object).complete, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) - test.compare(bullet_circle_color,config.COMPLETE_COLOR, "bullet color hex should be "+str(config.CURRENT_COLOR)) - test.compare(bullet_border_color,config.COMPLETE_COLOR, "bullet border color hex should be "+str(config.COMPLETE_COLOR)) - #To verify the step indicators of pre-treatment tutorial screens - else: - test.verify(not squish.waitForObjectExists(training_items_object).current, "bullet indicator {index} should not be complete state".format(index=current_indicator)) - test.verify(not squish.waitForObjectExists(training_items_object).complete, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) - test.compare(bullet_circle_color,config.CURRENT_COLOR, "bullet circle color hex should be "+str(config.CURRENT_COLOR)) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR, "bullet border color hex should be "+str(config.INCOMPLETE_COLOR)) - - test.endSection() + To obtain a text object based on text provided + @param screen_obj: provides the container on which the txt must be present + @returns a real name object + """ + names.o_text_object["container"] = screen_obj + names.o_text_object["text"] = txt + return names.o_text_object - -def verify_color_of_entry(entry = 0, vital_parameter = None, input_field = None): +def verify_color_of_entry(entry, vital_parameter, input_field): """ - Method to verify the color of entry of systolic, diastolic and heart rate - @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 + Method to verify the color of entry + of systolic, diastolic and heart rate + @param entry: (int) user 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 """ test.startSection("Verify the color of {} value {}".format(vital_parameter, entry)) input_field_color = input_field.color.name @@ -165,19 +137,31 @@ if (entry < config.SYSTOLIC_LOWER_LIMIT) or (entry > config.SYSTOLIC_UPPER_LIMIT): test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "systolic value {} is out of range, systolic value should be in range of {} and {}".format(entry, config.SYSTOLIC_LOWER_LIMIT, config.SYSTOLIC_UPPER_LIMIT)) elif (entry >= config.SYSTOLIC_LOWER_LIMIT) and (entry <= config.SYSTOLIC_UPPER_LIMIT): - test.compare(input_field_color, config.ENABLED_COLOR, "systolic value {} is in range of {} and {}".format(entry, config.SYSTOLIC_LOWER_LIMIT, config.SYSTOLIC_UPPER_LIMIT)) + test.compare(input_field_color, config.IN_RANGE_COLOR, "systolic value {} is in range of {} and {}".format(entry, config.SYSTOLIC_LOWER_LIMIT, config.SYSTOLIC_UPPER_LIMIT)) elif vital_parameter is config.DIASTOLIC_TEXT: if (entry < config.DIASTOLIC_LOWER_LIMIT) or (entry > config.DIASTOLIC_UPPER_LIMIT): test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "diastolic value {} is out of range, diastolic value should be in range of {} and {}".format(entry, config.DIASTOLIC_LOWER_LIMIT, config.DIASTOLIC_UPPER_LIMIT)) elif (entry >= config.DIASTOLIC_LOWER_LIMIT) and (entry <= config.DIASTOLIC_UPPER_LIMIT): - test.compare(input_field_color, config.ENABLED_COLOR, "diastolic value {} is in range of {} and {}".format(entry, config.DIASTOLIC_LOWER_LIMIT, config.DIASTOLIC_UPPER_LIMIT)) + test.compare(input_field_color, config.IN_RANGE_COLOR, "diastolic value {} is in range of {} and {}".format(entry, config.DIASTOLIC_LOWER_LIMIT, config.DIASTOLIC_UPPER_LIMIT)) elif vital_parameter is config.HEART_RATE_TITLE: if (entry < config.HEART_RATE_LOWER_LIMIT) or (entry > config.HEART_RATE_UPPER_LIMIT): test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "Heart Rate value {} is out of range, Heart Rate value should be in range of {} and {}".format(entry, config.HEART_RATE_LOWER_LIMIT, config.HEART_RATE_UPPER_LIMIT)) elif (entry >= config.HEART_RATE_LOWER_LIMIT) and (entry <= config.HEART_RATE_UPPER_LIMIT): - test.compare(input_field_color,config.ENABLED_COLOR, "Heart Rate value {} is in range of {} and {}".format(entry, config.HEART_RATE_LOWER_LIMIT, config.HEART_RATE_UPPER_LIMIT)) - test.endSection() + test.compare(input_field_color, config.IN_RANGE_COLOR, "Heart Rate value {} is in range of {} and {}".format(entry, config.HEART_RATE_LOWER_LIMIT, config.HEART_RATE_UPPER_LIMIT)) + test.endSection() + + +def get_bullet_object(screen_obj, num): + """ + To obtain a bullet object based on occurrence provided. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object def keypad_input(key_value): """ Index: shared/scripts/names.py =================================================================== diff -u -r2eb49a62b2f80e6f947037a7b5d78ae305e36af0 -r5347ee52338d76725d5f4cdca3f8077ef2997ba3 --- shared/scripts/names.py (.../names.py) (revision 2eb49a62b2f80e6f947037a7b5d78ae305e36af0) +++ shared/scripts/names.py (.../names.py) (revision 5347ee52338d76725d5f4cdca3f8077ef2997ba3) @@ -105,4 +105,5 @@ o_PreTreatmentBase_indicator_StepIndicator = {"container": o_PreTreatmentConnectionStack_PreTreatmentBase_TreatmentFlowBase_2, "id": "_indicator", "type": "StepIndicator", "unnamed": 1, "visible": True} o_PreTreatmentBase_headStepBullet_StepBullet = {"container": o_PreTreatmentConnectionStack_PreTreatmentBase_TreatmentFlowBase_2, "id": "_headStepBullet", "occurrence": 2, "type": "StepBullet", "unnamed": 1, "visible": True} o_PreTreatmentBase_gridStepsRest_Grid_2 = {"container": o_PreTreatmentConnectionStack_PreTreatmentBase_TreatmentFlowBase_2, "id": "_gridStepsRest", "occurrence": 10, "type": "Grid", "unnamed": 1, "visible": True} - +o_text_object = {"type": "Text", "unnamed": 1, "visible": True} +o_bullet_object = {"type": "StepBullet", "unnamed": 1, "visible": True} Index: tst_pre_treatment_patient_connection/test.py =================================================================== diff -u -r3d7cf6a6f54664810349200e11223e93c04011d2 -r5347ee52338d76725d5f4cdca3f8077ef2997ba3 --- tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 3d7cf6a6f54664810349200e11223e93c04011d2) +++ tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 5347ee52338d76725d5f4cdca3f8077ef2997ba3) @@ -28,6 +28,42 @@ CONNECTION_PRE_TREATMENT_STEPS = 7 +def verify_instruction_screen_indicator(current_indicator, training_items_object): + """ + Method to verify the pre treatment tutorial indicators on top of the screen which indicates the steps passed, current, remained] + @param current_indicator :(int) Current pre-treatment tutorial indicator + @param training_items_object :(dictionary) pre_treatment bullet object + @return N/A + """ + test.startSection("Method to verify the Page Step indicators from training screen") + for page in range(config.TRAINING_INDICATOR_SCREEN): + occurrence_index = 10 + page #1-9 occurrence of object belongs to page indicators, 10 - 13 occurrence of object belongs to training indicators + training_items_object["occurrence"] = occurrence_index + bullet_children = object.children(waitForObject(training_items_object)) + bullet_circle_color = bullet_children[0].color.name + bullet_border_color = bullet_children[0].border.color.name + #To verify the step indicators of pre treatment tutorial screens + if page < current_indicator: + test.verify(waitForObjectExists(training_items_object).complete, "bullet indicator {index} should be in complete state".format(index=current_indicator)) + test.verify(not waitForObjectExists(training_items_object).current, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) + test.compare(bullet_circle_color, config.COMPLETE_COLOR, " bullet color hex should be "+str(config.COMPLETE_COLOR)) + test.compare(bullet_border_color, config.COMPLETE_COLOR, " bullet border color hex should be "+str(config.COMPLETE_COLOR)) + #To verify the step indicators of pre treatment tutorial screen + elif page == current_indicator: + test.verify(waitForObjectExists(training_items_object).current, "bullet indicator {index} should be in complete state".format(index=current_indicator)) + test.verify(not waitForObjectExists(training_items_object).complete, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) + test.compare(bullet_circle_color,config.COMPLETE_COLOR, "bullet color hex should be "+str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.COMPLETE_COLOR, "bullet border color hex should be "+str(config.COMPLETE_COLOR)) + #To verify the step indicators of pre-treatment tutorial screens + else: + test.verify(not waitForObjectExists(training_items_object).current, "bullet indicator {index} should not be complete state".format(index=current_indicator)) + test.verify(not waitForObjectExists(training_items_object).complete, "bullet indicator {index} current attribute should be unchecked".format(index=current_indicator)) + test.compare(bullet_circle_color,config.CURRENT_COLOR, "bullet circle color hex should be "+str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR, "bullet border color hex should be "+str(config.INCOMPLETE_COLOR)) + + test.endSection() + + def test_rejection_message_patient_connection(accept_status): """ verification of rejection messages during patient connection. @@ -106,7 +142,7 @@ test.compare(waitForObjectExists(names.o_PreTreatmentBase_Patient_Connection_Text).text, config.PATIENT_CONNECTION_TEXT, "Patient connection text should be {msg}".format(msg=config.PATIENT_CONNECTION_TEXT)) test.compare(waitForObjectExists(names.o_swipeview_tutorial_text).enabled, True, "Tutorial text should be enabled.") - utility.instruction_screen_indicator_verification(screen_indicator, names.o_PreTreatmentBase_Indicators) + verify_instruction_screen_indicator(screen_indicator, names.o_PreTreatmentBase_Indicators) if screen_indicator == 3: test.verify(waitForObjectExists(names.o_PreTreatmentBase_Continue_Text).enabled, "continue button should be disabled") else: @@ -226,7 +262,7 @@ navigate_patient_connection(PRE_TREATMENT_PATIENT_CONNECTION_MODE) #verification of indicators from patient connection section - utility.page_step_indicator_verification(UF_PRE_TREATMENT_STEPS, names.o_PreTreatmentUltrafiltration_Indicators) + utility.verify_page_step_indicator(names.o_PreTreatmentStack_pretreatmentConnectionStack_PreTreatmentConnectionStack, UF_PRE_TREATMENT_STEPS) #verification of uf slider based on edge condition. for ranges in config.TREATMENT_ULTRAFILTERATION_TESTING_OPTION: @@ -239,13 +275,13 @@ hd_simulator.cmd_send_uf_treatment_response(accepted = True, reason = 0, volume = config.UF_VALID_RANGE) #verification of indicators from BP/HR section - utility.page_step_indicator_verification(BP_HR_PRE_TREATMENT_STEPS, names.o_PreTreatmentFlowBase_Indicators) + utility.verify_page_step_indicator(names.o_PreTreatmentStack_pretreatmentConnectionStack_PreTreatmentConnectionStack, BP_HR_PRE_TREATMENT_STEPS) #verification of BP/HR entries based on edge condition test_vital_entries_on_patient_connection() #verification of indicators from Connection section - utility.page_step_indicator_verification(CONNECTION_PRE_TREATMENT_STEPS, names.o_PreTreatmentBase_nextStepsBullet_StepBullet) + utility.verify_page_step_indicator(names.o_PreTreatmentStack_pretreatmentConnectionStack_PreTreatmentConnectionStack, CONNECTION_PRE_TREATMENT_STEPS) #verification of tutorial section test_patient_connection_instruction_screen()