Index: tools/run_tests.sh =================================================================== diff -u -r932d63fb26cda19a65375d592e454836f8b2522e -rca79dc7f50fc912b05da91321d8652934aee0764 --- tools/run_tests.sh (.../run_tests.sh) (revision 932d63fb26cda19a65375d592e454836f8b2522e) +++ tools/run_tests.sh (.../run_tests.sh) (revision ca79dc7f50fc912b05da91321d8652934aee0764) @@ -15,10 +15,10 @@ # and can run tests with the specified tags # ############################################################################ -TAGS=AlarmSilence +TAGS=TreatmentAdjustmentUltrafiltration TIMEOUT=200 -rm -rf /tmp/UnitTest +rm -rf /tmp/UnitTest* cd .. read -p "Did you already start run_server.sh? (y/n) " serverStarted if [ "$serverStarted" != "y" ]; then @@ -28,16 +28,26 @@ read -p "Do you want to run all tests? (y/n) " resp -/opt/squishqt/bin/squishrunner --config setAUTTimeout $TIMEOUT +nums=1 +if [ "$resp" == "n" ]; then + read -p "How many repetitions? " nums -if [ "$resp" == "y" ]; then - /opt/squishqt/bin/squishrunner --testsuite . \ - --reportgen html,/tmp/UnitTest -else - /opt/squishqt/bin/squishrunner --testsuite . \ - --tags $TAGS \ - --reportgen html,/tmp/UnitTest fi +/opt/squishqt/bin/squishrunner --config setAUTTimeout $TIMEOUT +for (( i=1; i<=$nums; i++)) +do + if [ "$resp" == "y" ]; then + /opt/squishqt/bin/squishrunner --testsuite . \ + --reportgen html,/tmp/UnitTest-$i + else + /opt/squishqt/bin/squishrunner --testsuite . \ + --tags $TAGS \ + --reportgen html,/tmp/UnitTest-$i + fi +done + + + Index: tst_DGROPumpData/test.py =================================================================== diff -u -r867655840cada2d79fa5028c8fab68516ea59673 -rca79dc7f50fc912b05da91321d8652934aee0764 --- tst_DGROPumpData/test.py (.../test.py) (revision 867655840cada2d79fa5028c8fab68516ea59673) +++ tst_DGROPumpData/test.py (.../test.py) (revision ca79dc7f50fc912b05da91321d8652934aee0764) @@ -24,9 +24,15 @@ def test_values(vSetPtPressure, vFlowRate, vPWM): - test.compare(str(waitForObjectExists(names.o_managerHome_DGROPumpData_SetPtPressure).text), "{:.0f}".format(vSetPtPressure)) - test.compare(str(waitForObjectExists(names.o_managerHome_DGROPumpData_FlowRate ).text), "{:.2f}".format(vFlowRate )) - test.compare(str(waitForObjectExists(names.o_managerHome_DGROPumpData_PWM ).text), "{:.2f}".format(vPWM )) + tmp = "{:.0f}".format(vSetPtPressure) + test.compare(str(waitForObjectExists( + utils.dict_update(names.o_managerHome_DGROPumpData_SetPtPressure, "text", tmp)).text), tmp) + tmp = "{:.2f}".format(vFlowRate) + test.compare(str(waitForObjectExists( + utils.dict_update(names.o_managerHome_DGROPumpData_FlowRate, "text", tmp)).text), tmp) + tmp = "{:.2f}".format(vPWM) + test.compare(str(waitForObjectExists( + utils.dict_update(names.o_managerHome_DGROPumpData_PWM, "text", tmp)).text), tmp) def main(): Index: tst_Treatment_Adjustment_Heparin/test.py =================================================================== diff -u -r310f51a5ed4921f184572f90d07b350ec41c0bae -rca79dc7f50fc912b05da91321d8652934aee0764 --- tst_Treatment_Adjustment_Heparin/test.py (.../test.py) (revision 310f51a5ed4921f184572f90d07b350ec41c0bae) +++ tst_Treatment_Adjustment_Heparin/test.py (.../test.py) (revision ca79dc7f50fc912b05da91321d8652934aee0764) @@ -45,6 +45,7 @@ else: test.compare(heparin_button.enabled, False) + utils.waitForGUI(0.2) test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinSection).buttonText), "{} DELIVERY".format(vText)) Index: tst_Treatment_Adjustment_Ultrafiltration/test.py =================================================================== diff -u -r310f51a5ed4921f184572f90d07b350ec41c0bae -rca79dc7f50fc912b05da91321d8652934aee0764 --- tst_Treatment_Adjustment_Ultrafiltration/test.py (.../test.py) (revision 310f51a5ed4921f184572f90d07b350ec41c0bae) +++ tst_Treatment_Adjustment_Ultrafiltration/test.py (.../test.py) (revision ca79dc7f50fc912b05da91321d8652934aee0764) @@ -11,13 +11,13 @@ # date 2020/06/17 # author Behrouz NematiPour # - +import os import names from dialin.ui import utils from dialin import HDSimulator from dialin.ui.hd_simulator import TXStates from dialin.common.msg_defs import RequestRejectReasons as rejectReason -HDSimulator = HDSimulator() +hd_simulator = HDSimulator() eInvalid = 0 @@ -58,44 +58,43 @@ # --------------- Main Treatment def gotoScreenNtest_Contains_Ultrafiltration(): mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) - test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).visible, True) + test.compare(waitForObject(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).visible, True) def startNTestTreatmentUltrafiltration(vMinUF, vMaxUF): for i in range(vMinUF, vMaxUF+1, 10): - HDSimulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(vMaxUF, i, 1, 1, 1, 1, 1) + hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(vMaxUF, i, 1, 1, 1, 1, 1) test.compare(utils.l2ml(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).value), i) def gotoScreen_UltrafiltrationAdjustment(): # [Section Click] mouseClick(waitForObject(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration)) - utils.waitForGUI(1) # --------------- Off Screen --- the default state is off for ultrafiltration def testScreen_Off_Ultrafiltration(): # [Stop Screen] which is actually paused screen without resume button since the uf is in stop mode and user need to adjust/edit uf volume to start. - test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_Screen ).visible, True) + test.compare( waitForObject(names.o_treatmentAdjustmentUltrafiltrationPaused_Screen ).visible, True) ## Edit Button - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_EditButton ).text.text), "EDIT ULTRAFILTRATION VOLUME") + test.compare(str(waitForObject(names.o_treatmentAdjustmentUltrafiltrationPaused_EditButton ).text.text), "EDIT ULTRAFILTRATION VOLUME") ## Resume Buttons test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_ResumeButton).visible, False) ## Paused Notification - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_PausedText).text), "Ultrafiltration is off") + test.compare(str(waitForObject(names.o_treatmentAdjustmentUltrafiltrationPaused_PausedText).text), "Ultrafiltration is off") def testScreen_Off_Notification(): # [Section Paused Notification] - test.compare(str(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).notification.text), "Ultrafiltration is off") + test.compare(str(waitForObject(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).notification.text), "Ultrafiltration is off") # --------------- Start Screen def testScreen_Start_Ultrafiltration(): # [Start Screen] - test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationStart_Screen ).visible , True ) + test.compare(waitForObject(names.o_treatmentAdjustmentUltrafiltrationStart_Screen, 2000).visible, True) ## Pause Button - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationStart_PauseButton).text.text), "PAUSE ULTRAFILTRATION") + test.compare(str(waitForObject(names.o_treatmentAdjustmentUltrafiltrationStart_PauseButton).text.text), "PAUSE ULTRAFILTRATION") def pause_Request(): @@ -107,19 +106,25 @@ # [Normal Notification] test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationStart_NotificationBar).text), "") # [Reject Pause] - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_rejected(rejectReason.REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS.value, TXStates.UF_RUNNING_STATE) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_rejected(rejectReason.REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS.value, TXStates.UF_RUNNING_STATE) + utils.waitForGUI(3) # [Reject Notification] - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationStart_NotificationBar).text), rejectReason.REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS.name) + test.compare(str(waitForObject( + utils.dict_update(names.o_treatmentAdjustmentUltrafiltrationStart_NotificationBar, + "text", + rejectReason.REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS.name), 2000).text), + rejectReason.REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS.name) def pause_Accept(): - # [Accept Pause] - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_accepted(TXStates.UF_PAUSED_STATE) - # [Accept Notification] - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_NotificationBar).text), "") utils.waitForGUI(1) + # [Accept Pause] + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(TXStates.UF_PAUSED_STATE) + # [Accept Notification] + test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_NotificationBar).text), "") + # --------------- Paused Screen def testScreen_Paused_Ultrafiltration(): # [Paused Screen] @@ -141,21 +146,20 @@ # [Normal Notification] test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_NotificationBar).text), "") # [Reject Resume] - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_rejected(rejectReason.REQUEST_REJECT_REASON_UF_NOT_PAUSED.value, TXStates.UF_PAUSED_STATE) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_rejected(rejectReason.REQUEST_REJECT_REASON_UF_NOT_PAUSED.value, TXStates.UF_PAUSED_STATE) + utils.waitForGUI() # [Reject Notification] - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationPaused_NotificationBar).text), rejectReason.REQUEST_REJECT_REASON_UF_NOT_PAUSED.name) + test.compare(str(waitForObject(names.o_treatmentAdjustmentUltrafiltrationPaused_NotificationBar, 3000).text), rejectReason.REQUEST_REJECT_REASON_UF_NOT_PAUSED.name) def resume_Accept(): # [Accept Resume] - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_accepted(TXStates.UF_RUNNING_STATE) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(TXStates.UF_RUNNING_STATE) utils.waitForGUI(1) def closeScreen(): - utils.waitForGUI() mouseClick(waitForObject(names.o_closeButton)) - utils.waitForGUI() def testScreen_Paused_Notification(): @@ -179,15 +183,15 @@ def edit_RejectNTest(): - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_edit_rejected(rejectReason.REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE.value) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_edit_rejected(rejectReason.REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE.value) test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationEdit_NotificationBar).visible, True) #this error message needs to be changed later when translated. test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationEdit_NotificationBar).text), rejectReason.REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE.name) def updateNTest_Adjustment_Ranges(vMinUFVolume, vMaxUFVolume): # HD sends Ultrafiltration ranges - HDSimulator.cmd_set_treatment_parameter_ranges(0, 0, vMinUFVolume, vMaxUFVolume, 0, 0) + hd_simulator.cmd_set_treatment_parameter_ranges(0, 0, vMinUFVolume, vMaxUFVolume, 0, 0) # Edit Screen updates Ultrafiltration ranges on Slider upon Receiving Ranges test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationEdit_VolumeSlider).minText.text), "{:.3f}".format(utils.ml2l(vMinUFVolume))) test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationEdit_VolumeSlider).maxText.text), "{:.3f}".format(utils.ml2l(vMaxUFVolume))) @@ -203,7 +207,7 @@ def adjustmentResponse(): - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_edit_response(_Accepted, _Reason, _Volume, _Duration, _DurationDiff, _Rate, _RateDiff, _RateOld) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_edit_response(_Accepted, _Reason, _Volume, _Duration, _DurationDiff, _Rate, _RateDiff, _RateOld) def next_Accepted(vVolume, vRateState, vDurationState): @@ -244,14 +248,20 @@ def testScreen_Confirm_Ultrafiltration(): #[Confirm Screen] - test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_Screen).visible, True) - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_PausedText).text), "Ultrafiltration is paused") + test.compare( waitForObject(names.o_treatmentAdjustmentUltrafiltrationConfirm_Screen).visible, True) + tmp = "Ultrafiltration is paused" + test.compare(str(waitForObjectExists( + utils.dict_update(names.o_treatmentAdjustmentUltrafiltrationConfirm_PausedText, "text", tmp)).text), tmp) test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_ConfirmButton).text.text), "CONFIRM") - test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_ConfirmButton).disabled, True) + + test.compare(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_ConfirmButton).disabled, True) test.compare(str(waitForObjectExists(names.o_backButton).text.text), "BACK") #[Confirm Title / Ultrafiltration Volume] - test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_Title ).text), "To confirm new UF Volume ({:.3f}),\nselect a treatment adjustment:".format(utils.ml2l(_Volume))) + tmp = "To confirm new UF Volume ({:.3f}),\nselect a treatment adjustment:".format(utils.ml2l(_Volume)) + test.compare(str(waitForObjectExists( + utils.dict_update(names.o_treatmentAdjustmentUltrafiltrationConfirm_Title, "text", tmp) + , 3000).text), tmp) test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_AdjustmentButtonRate ).selected , False) test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_AdjustmentButtonDuration).selected , False) @@ -321,19 +331,21 @@ def confirm_RejectNTest(): - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_confirm_rejected(rejectReason.REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM.value) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_confirm_rejected(rejectReason.REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM.value) test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_NotificationBar).visible, True) test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_NotificationBar).text ), rejectReason.REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM.name) def confirm_RejectNTest_Unknow(): - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_confirm_rejected(200) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_confirm_rejected(200) test.compare( waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_NotificationBar).visible, True) test.compare(str(waitForObjectExists(names.o_treatmentAdjustmentUltrafiltrationConfirm_NotificationBar).text ), "[200] Unknown Error") def confirm_Accept(vVolume, vDuration, vRate): - HDSimulator.cmd_set_treatment_adjust_ultrafiltration_confirm_response(1, 0, vVolume, vDuration, vRate) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_confirm_response(1, 0, vVolume, vDuration, vRate) + utils.waitForGUI() + test.compare(utils.l2ml(waitForObject(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).maximum), 1200) def main(): @@ -343,7 +355,6 @@ utils.waitForGUI(1) gotoScreenNtest_Contains_Ultrafiltration() - utils.waitForGUI(1) # Main Treatment Off Notification while ultrafiltration is off (default state) testScreen_Off_Notification() @@ -355,62 +366,65 @@ closeScreen() # Back to main # set the ultrafiltration to running state - HDSimulator.cmd_set_treatment_states_data(TXStates.TREATMENT_DIALYSIS_STATE_NOT, TXStates.UF_RUNNING_STATE, TXStates.SALINE_BOLUS_STATE_IDLE, TXStates.HEPARIN_STATE_OFF) + hd_simulator.cmd_set_treatment_states_data(TXStates.TREATMENT_DIALYSIS_STATE_NOT, TXStates.UF_RUNNING_STATE, TXStates.SALINE_BOLUS_STATE_IDLE, TXStates.HEPARIN_STATE_OFF) + closeScreen() gotoScreen_UltrafiltrationAdjustment() # Start Screen upon User touch while IS RUNNING - testScreen_Start_Ultrafiltration() - closeScreen() # Back to main + utils.waitForGUI(5) + testScreen_Start_Ultrafiltration() - gotoScreen_UltrafiltrationAdjustment() - - testScreen_Start_Ultrafiltration() pause_Request() pause_RejectNTest() # Test Notification pause_Accept() # Paused Screen upon Pause accepted testScreen_Paused_Ultrafiltration() - closeScreen() # Back to main - + # Main Treatment Paused Notification upon Pause accepted testScreen_Paused_Notification() # Paused Screen upon User touch while IS PAUSED gotoScreen_UltrafiltrationAdjustment() - testScreen_Paused_Ultrafiltration() resume_Request() resume_RejectNTest() resume_Accept() - + # Paused Screen upon User touch while IS PAUSED gotoScreen_UltrafiltrationAdjustment() # Start Screen upon User touch while IS NOT PAUSED + utils.waitForGUI(5) testScreen_Start_Ultrafiltration() pause_Request() - pause_Accept() + pause_Accept() testScreen_Paused_Notification() # Edit Screen upon Used Edit Button edit_Clicked() + # Edit Screen testScreen_Edit_Ultrafiltration() # Back to Paused Screen from Edit Screen back_Clicked() - + + closeScreen() + + gotoScreen_UltrafiltrationAdjustment() + pause_Accept() + # Paused Screen upon User Back Button from Edit Screen testScreen_Paused_Ultrafiltration() # Edit Screen upon Used Edit Button edit_Clicked() - + updateNTest_Adjustment_Ranges(600, 2400) updateNTest_Adjustment_Ranges(100, 4800) @@ -426,7 +440,6 @@ # Some of this test may never happen but GUI should work as developed # So Volume is not necessarily correct - # ----- Rate Inv next_Accepted( 0, eInvalid , eIncrease) back_Clicked() @@ -496,11 +509,8 @@ next_Accepted(4800, eIncrease, eIncrease) confirm_Request_Duration() confirm_RejectNTest_Unknow() - + confirm_Accept(1200, 2 *60, 20) - - test.compare(utils.l2ml(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).maximum), 1200) utils.tstDone() -