Index: tst_disinfection/test.py =================================================================== diff -u -r1d3192e66bed27fb83cc86d4468bc5bdcc79647a -rfafc6e0cf130380ef845bd0519ef31049a3fbec4 --- tst_disinfection/test.py (.../test.py) (revision 1d3192e66bed27fb83cc86d4468bc5bdcc79647a) +++ tst_disinfection/test.py (.../test.py) (revision fafc6e0cf130380ef845bd0519ef31049a3fbec4) @@ -1,16 +1,31 @@ -# -*- coding: utf-8 -*-" +# -*- coding: utf-8 -*- +## +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# copyright +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, +# IN PART OR IN WHOLE, +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# file tst_In_treatment +# date 2020/08/24 +# author Joseph Varghese +# +# NOTE: +# This test contradicts verification of Disinfection from Application UI +# section + import names from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from dialin.ui.dg_simulator import DGSimulator from configuration import config from configuration import utility -from dialin.utils.conversions import integer_to_bytearray, float_to_bytearray, short_to_bytearray, unsigned_integer_to_bytearray, integer_to_bit_array, unsigned_short_to_bytearray, unsigned_byte_to_bytearray, unsigned_byte_to_bytearray -from dialin.common.hd_defs import HDOpModes, HDOpSubModes -from dateutil.tz._common import ZERO +from dialin.common.dg_defs import DGHeatDisinfectStates, DGChemicalDisinfectStates, DGFlushStates +from dialin.common.hd_defs import HDOpSubModes, HDOpModes + DISINFECT_TREATMENT_OBJECT = { "Chemical" : names.o_DisinfectStack_disinfectChemical_TreatmentFlowBase, "Heat" : names.o_DisinfectStack_disinfectHeat_TreatmentFlowBase, @@ -28,51 +43,53 @@ dg_simulator = DGSimulator() -def verify_right_navigation_for_chemical_disinfection(num_of_instructions): +def verify_right_navigation_for_chemical_disinfection(num_of_instructions, indicator_object, left_arrow_object, right_arrow_object): """ The method is used to verify the functionality of the right arrow in the disinfection navigation, as well as the visibility of the two arrows + @ + """ test.startSection("Rightward navigation") - test.verify(not object.exists(names.o_disinfectChemical_leftImage_Image), "The left navigation arrow should not be present on the first screen of instruction") - child = object.children(waitForObject(names.o_disinfectChemical_gridSteps_Grid)) + test.verify(not object.exists(left_arrow_object), "The left navigation arrow should not be present on the first screen of instruction") + child = object.children(waitForObject(indicator_object)) for indicator in range(num_of_instructions): if child[indicator].id != "_tailStepsRepeater": - verify_bullet_navigation(num_of_instructions, indicator) - if not object.exists(names.o_disinfectChemical_rightImage_Image): + verify_bullet_navigation(num_of_instructions, indicator, indicator_object) + if not object.exists(right_arrow_object): test.log("The right navigation arrow should not be present on the last screen of instruction") break - mouseClick(waitForObject(names.o_disinfectChemical_rightImage_Image)) + mouseClick(waitForObject(right_arrow_object)) test.endSection() -def verify_left_navigation_for_chemical_disinfection(num_of_instructions): +def verify_left_navigation_for_chemical_disinfection(num_of_instructions, indicator_object, left_arrow_object, right_arrow_object): """ The method is used to verify the functionality of the left arrow in the instruction navigation, as well as the visibility of the two arrows """ test.startSection("Leftward instruction navigation") - test.verify(not object.exists(names.o_disinfectChemical_rightImage_Image), "The right navigation arrow should not be present on the last screen of instruction") + test.verify(not object.exists(right_arrow_object), "The right navigation arrow should not be present on the last screen of instruction") - child = object.children(waitForObject(names.o_disinfectChemical_gridSteps_Grid)) + child = object.children(waitForObject(indicator_object)) for indicator in range(num_of_instructions, -1, -1): if child[indicator].id != "_tailStepsRepeater": - verify_bullet_navigation(num_of_instructions, indicator) - if not object.exists(names.o_disinfectChemical_leftImage_Image): + verify_bullet_navigation(num_of_instructions, indicator, indicator_object) + if not object.exists(left_arrow_object): test.log("The left navigation arrow should not be present on the last screen of instruction") break - mouseClick(waitForObject(names.o_disinfectChemical_leftImage_Image)) + mouseClick(waitForObject(left_arrow_object)) test.endSection() -def verify_bullet_navigation(num_of_instructions, indicator): +def verify_bullet_navigation(num_of_instructions, indicator, indicator_object): """ This method verifies the properties of the bullets present in the instruction navigation screen """ test.startSection("Instruction bullet verification for screens " + str(indicator)) - child = object.children(waitForObject(names.o_disinfectChemical_gridSteps_Grid)) + child = object.children(waitForObject(indicator_object)) for instruction in range(num_of_instructions): if child[instruction].id == "_tailStepsRepeater": continue @@ -117,23 +134,30 @@ test.verify(standby_status.enabled, "Standby page should be displayed.") hd_simulator.cmd_send_hd_operation_mode(op_mode = 3, sub_mode = 2) + test.log("verification of instruction navigation from Disinfection.") + list_of_bullets = get_dynamic_bullet_count(names.o_disinfectHome_gridSteps_Grid) + verify_right_navigation_for_chemical_disinfection(list_of_bullets, names.o_disinfectHome_gridSteps_Grid, names.o_disinfectHome_leftImage_Image, names.o_disinfectHome_rightImage_Image) + verify_left_navigation_for_chemical_disinfection(list_of_bullets, names.o_disinfectHome_gridSteps_Grid, names.o_disinfectHome_leftImage_Image, names.o_disinfectHome_rightImage_Image) + + + #NB: Disinfection states are yet to be added - Future development + #verification of chemical disinfection states + for chemical_mode_state in range(DGChemicalDisinfectStates.NUM_OF_DG_CHEM_DISINFECT_STATES.value): + hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 1, flush_mode = 0, heat_mode = 0, chemical_mode = chemical_mode_state) + #verification of heat disinfection states + for heat_mode_state in range(DGHeatDisinfectStates.NUM_OF_DG_HEAT_DISINFECT_STATES.value): + hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 1, flush_mode = 0, heat_mode = heat_mode_state, chemical_mode = 0) + #verification of flush disinfection states + for flush_mode_state in range(DGFlushStates.NUM_OF_DG_FLUSH_STATES.value): + hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 1, flush_mode = flush_mode_state, heat_mode = 0, chemical_mode = chemical_mode_state) + + test.compare(waitForObjectExists(names.o_disinfectHome_Disinfection_Text).text, config.DISINFECT_TEXT, "Disinfection text is verified !") + test.endSection() + +def get_dynamic_bullet_count(bullet_object): - hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 3, flush_mode = 0, heat_mode = 0, chemical_mode = 1) - - verify_request_rejection_mode("Chemical") - verify_confirm_disinfect() - - - - - - - - -def get_dynamic_bullet_count(): - chemical_disinfect_count = 0 - child = object.children(waitForObject(names.o_disinfectChemical_gridSteps_Grid)) + child = object.children(waitForObject(bullet_object)) for dynamic_indicator_count in range (len(child)): if child[dynamic_indicator_count].id != "_tailStepsRepeater": chemical_disinfect_count+=1 @@ -156,11 +180,11 @@ test.log("verification of instruction navigation from chemical disinfection.") - list_of_bullets = get_dynamic_bullet_count() + list_of_bullets = get_dynamic_bullet_count(names.o_disinfectChemical_gridSteps_Grid) test.verify(not waitForObjectExists(names.o_disinfectChemical_confirmButton_TouchRect).enabled, "confirm button must not be active") - verify_right_navigation_for_chemical_disinfection(list_of_bullets) + verify_right_navigation_for_chemical_disinfection(list_of_bullets, names.o_disinfectChemical_gridSteps_Grid, names.o_disinfectChemical_leftImage_Image, names.o_disinfectChemical_rightImage_Image) test.verify(waitForObjectExists(names.o_disinfectChemical_confirmButton_TouchRect).enabled, "confirm button must be active") - verify_left_navigation_for_chemical_disinfection(list_of_bullets) + verify_left_navigation_for_chemical_disinfection(list_of_bullets, names.o_disinfectChemical_gridSteps_Grid, names.o_disinfectChemical_leftImage_Image, names.o_disinfectChemical_rightImage_Image) test.verify(not waitForObjectExists(names.o_disinfectChemical_confirmButton_TouchRect).enabled ,"confirm button must not be active") for right_arrow in range(list_of_bullets-1): @@ -223,41 +247,12 @@ utils.tstStart(__file__) startApplication(config.AUT_NAME) - #verify_chemical_disinfect() - #verify_heat_disinfect() - #verify_water_flush() - + verify_chemical_disinfect() + verify_heat_disinfect() + verify_water_flush() verify_disinfection_states() - """ - hd_simulator.cmd_send_hd_disinfection_state(self, sub_mode: int, flush_mode: int, heat_mode: int,chemical_mode: int) - hd_simulator.cmd_send_hd_disinfect_response(self, accepted: bool, reason: int) - hd_simulator.cmd_send_hd_disinfect_chemical_confirm(self, accepted: bool, reason: int) - - - dg_simulator.cmd_send_dg_disinfect_progress_time_flush(self, total: int, countdown: int) - dg_simulator.cmd_send_dg_disinfect_progress_time_heat(self, total: int, countdown: int) - - - - # hd_simulator.cmd_send_hd_disinfect_response(accepted = True, reason =1) - #payload = integer_to_bytearray(1) - #payload += unsigned_integer_to_bytearray(4) - #hd_simulator.cmd_send_hd_general_response(message_id=155, accepted=1, reason=1, is_pure_data=False, has_parameters=True, parameters_payload=payload) - - - - - snooze(5) - #hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 0, flush_mode = 0, heat_mode = 0, chemical_mode = 1) - #snooze(5) - #dg_simulator.cmd_send_dg_disinfect_progress_time_flush(total = 120, countdown = 45) - - """ - utils.waitForGUI(2) - - utils.tstDone()