Index: shared/scripts/denaliMessages.py =================================================================== diff -u -r40568c277aa2c01963d0f3f9da41748c2686d343 -r929c42f19c662c57ae264d200658fb1690353008 --- shared/scripts/denaliMessages.py (.../denaliMessages.py) (revision 40568c277aa2c01963d0f3f9da41748c2686d343) +++ shared/scripts/denaliMessages.py (.../denaliMessages.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -12,6 +12,7 @@ # author Behrouz NematiPour # +import time import subprocess import utils import messageBuilder @@ -61,93 +62,101 @@ def show_PowerOffRejectionDialog(): subprocess.call(['cansend', 'can0', '020#A5.01.00.01.00.01.02.5A']) +################################################################################################## +# After each multi-frame message put a 100ms sleep, time.sleep(0.1) # +# it seems it's needed otherwise the test will check a value which has not been received yet. # +################################################################################################## +def waitForMessageToBeSent(): + time.sleep(0.1) + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildSetTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate): - msg = messageBuilder.buildMessage( GuiActionType.TreatmentRanges, 4 * 6, - utils.toU32(vMinTreatmentDuration), - utils.toU32(vMaxTreatmentDuration), - utils.toU32(vMinUFVolume ), - utils.toU32(vMaxUFVolume ), - utils.toU32(vMinDialysateFlowRate), - utils.toU32(vMaxDialysateFlowRate) + msg = messageBuilder.buildMessage( GuiActionType.TreatmentRanges, 4 * 6, True, + utils.toI32(vMinTreatmentDuration), + utils.toI32(vMaxTreatmentDuration), + utils.toI32(vMinUFVolume ), + utils.toI32(vMaxUFVolume ), + utils.toI32(vMinDialysateFlowRate), + utils.toI32(vMaxDialysateFlowRate) ) return messageBuilder.toFrames(msg) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def setTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate): # This message needs to be acknowledged by seq# 01.00 : just call send_acknowledge_UI after this - # ------------------------------------------vvvvv----------------------------------------------- frames = buildSetTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate) frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '020#{}'.format(frame)]) + waitForMessageToBeSent() - ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildSetTreatmentBloodFlowRate(vFlowSetPt, vMeasFlow = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): - msg = messageBuilder.buildMessage( 5, 4 * 7, - utils.toU32(vFlowSetPt ), - utils.toU32(vMeasFlow ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vRotSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMotSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMCSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMCCurr ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vPWM ) # it has to be F32 and at this moment I haven't implemented and I don't currently need it + msg = messageBuilder.buildMessage( GuiActionType.BloodFlow, 4 * 7, False, + utils.toI32(vFlowSetPt ), + utils.toF32(vMeasFlow ), + utils.toF32(vRotSpd ), + utils.toF32(vMotSpd ), + utils.toF32(vMCSpd ), + utils.toF32(vMCCurr ), + utils.toF32(vPWM ) ) - return messageBuilder.toFrames(msg) - + return messageBuilder.toFrames(msg) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def setTreatmentBloodFlowRate(vFlowSetPt): +def setTreatmentBloodFlowRate(vFlowSetPt, vMeasFlow = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): frames = buildSetTreatmentBloodFlowRate(vFlowSetPt) frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) - + waitForMessageToBeSent() + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildSetTreatmentDialysateFlowRate(vFlowSetPt, vMeasFlow = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): - msg = messageBuilder.buildMessage( 8, 4 * 7, - utils.toU32(vFlowSetPt ), - utils.toU32(vMeasFlow ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vRotSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMotSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMCSpd ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vMCCurr ), # it has to be F32 and at this moment I haven't implemented and I don't currently need it - utils.toU32(vPWM ) # it has to be F32 and at this moment I haven't implemented and I don't currently need it + msg = messageBuilder.buildMessage( GuiActionType.DialysateInletFlow, 4 * 7, False, + utils.toI32(vFlowSetPt ), + utils.toF32(vMeasFlow ), + utils.toF32(vRotSpd ), + utils.toF32(vMotSpd ), + utils.toF32(vMCSpd ), + utils.toF32(vMCCurr ), + utils.toF32(vPWM ) ) return messageBuilder.toFrames(msg) - ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def setTreatmentDialysateFlowRate(vFlowSetPt): +def setTreatmentDialysateFlowRate(vFlowSetPt, vMeasFlow = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): frames = buildSetTreatmentDialysateFlowRate(vFlowSetPt) frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) - + waitForMessageToBeSent() + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildTreatmentAdjustBloodDialysateResponse(vAccepted, vReason, vBloodRate, vDialysate): - msg = messageBuilder.buildMessage( GuiActionType.AdjustBloodDialysateRsp, 4 * 4, - utils.toU32(vAccepted), - utils.toU32(vReason), - utils.toU32(vBloodRate), - utils.toU32(vDialysate) + msg = messageBuilder.buildMessage( GuiActionType.AdjustBloodDialysateRsp, 4 * 4, True, + utils.toI32(vAccepted), + utils.toI32(vReason), + utils.toI32(vBloodRate), + utils.toI32(vDialysate) ) return messageBuilder.toFrames(msg) - +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def sendTreatmentAdjustBloodDialysateResponse(vAccepted, vReason, vBloodRate, vDialysate): frames = buildTreatmentAdjustBloodDialysateResponse(vAccepted, vReason, vBloodRate, vDialysate) frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '020#{}'.format(frame)]) - + waitForMessageToBeSent() + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildTreatmentTime(vSecsTotal, vSecsElap, vSecsRem): - msg = messageBuilder.buildMessage( GuiActionType.TreatmentTime, 3 * 4, - utils.toU32(vSecsTotal ), - utils.toU32(vSecsElap ), - utils.toU32(vSecsRem ) + msg = messageBuilder.buildMessage( GuiActionType.TreatmentTime, 3 * 4, False, + utils.toI32(vSecsTotal ), + utils.toI32(vSecsElap ), + utils.toI32(vSecsRem ) ) return messageBuilder.toFrames(msg) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -156,16 +165,57 @@ frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) - + waitForMessageToBeSent() + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def buildSetTreatmentUltrafiltration(vRefUFVol, vMeasUFVol = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): + msg = messageBuilder.buildMessage( GuiActionType.DialysateOutletFlow, 4 * 7, False, + utils.toF32(vRefUFVol ), + utils.toF32(vMeasUFVol ), + utils.toF32(vRotSpd ), + utils.toF32(vMotSpd ), + utils.toF32(vMCSpd ), + utils.toF32(vMCCurr ), + utils.toF32(vPWM ) + ) + return messageBuilder.toFrames(msg) +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def setTreatmentUltrafiltration(vRefUFVol, vMeasUFVol = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): + frames = buildSetTreatmentUltrafiltration(vRefUFVol, vMeasUFVol, vRotSpd, vMotSpd, vMCSpd, vMCCurr, vPWM) + frames = messageBuilder.toCandumpFormat(frames) + for frame in frames: + subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) + waitForMessageToBeSent() + +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def buildSetTreatmentPressureOcclusion(vArtPres, vVenPres, vBPOccl, vDIPOccl, vDOPOccl): + msg = messageBuilder.buildMessage( GuiActionType.PressureOcclusion, 4 * 5, False, + utils.toF32(vArtPres ), + utils.toF32(vVenPres ), + utils.toF32(vBPOccl ), + utils.toF32(vDIPOccl ), + utils.toF32(vDOPOccl ) + ) + return messageBuilder.toFrames(msg) +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def setTreatmentPressureOcclusion(vArtPres = 0, vVenPres = 0, vBPOccl = 0, vDIPOccl = 0, vDOPOccl = 0): + frames = buildSetTreatmentPressureOcclusion(vArtPres, vVenPres, vBPOccl, vDIPOccl, vDOPOccl) + frames = messageBuilder.toCandumpFormat(frames) + for frame in frames: + subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) + waitForMessageToBeSent() + +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildAlarm(vState, vTop, vEsclatesIn, vSilentExpires, vFlags): - msg = messageBuilder.buildMessage( GuiActionType.AlarmStatus, 4 * 4 + 2, - utils.toU32(vState ), - utils.toU32(vTop ), - utils.toU32(vEsclatesIn ), - utils.toU32(vSilentExpires ), - utils.toU16(vFlags ) + msg = messageBuilder.buildMessage( GuiActionType.AlarmStatus, 4 * 4 + 2, False, + utils.toI32(vState ), + utils.toI32(vTop ), + utils.toI32(vEsclatesIn ), + utils.toI32(vSilentExpires ), + utils.toI16(vFlags ) ) return messageBuilder.toFrames(msg) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -174,4 +224,4 @@ frames = messageBuilder.toCandumpFormat(frames) for frame in frames: subprocess.call(['cansend', 'can0', '001#{}'.format(frame)]) - + waitForMessageToBeSent() Index: shared/scripts/messageBuilder.py =================================================================== diff -u -r40df2a58a855b561c1ca8dabd3b272ac48b8924e -r929c42f19c662c57ae264d200658fb1690353008 --- shared/scripts/messageBuilder.py (.../messageBuilder.py) (revision 40df2a58a855b561c1ca8dabd3b272ac48b8924e) +++ shared/scripts/messageBuilder.py (.../messageBuilder.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -38,12 +38,16 @@ return vString + vDelimiter + crc.calcCRC8(vString, vDelimiter) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def buildMessage(vMsgID, vLen, *vArgs): +def buildMessage(vMsgID, vLen, vAck, *vArgs): msg = "" - seq = 1 - msg += utils.toU16(seq) # always used seq# 1 (for now) - msg += utils.toU16(vMsgID) - msg += utils.toU08(vLen) + if vAck: + seq = -1 + else: + seq = 1 + + msg += utils.toI16(seq) # always used seq# (-)1 (for now) + msg += utils.toI16(vMsgID) + msg += utils.toI08(vLen) for arg in vArgs: msg += arg msg += crc.calcCRC8(msg) Index: shared/scripts/names.py =================================================================== diff -u -r7fa14415857c2a6d03e5cccb0d187675a297e0b9 -r929c42f19c662c57ae264d200658fb1690353008 --- shared/scripts/names.py (.../names.py) (revision 7fa14415857c2a6d03e5cccb0d187675a297e0b9) +++ shared/scripts/names.py (.../names.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -82,4 +82,3 @@ # Alarm Status o_ALARM_ID_MESSAGE = {"container": o_QQuickView, "id": "_alarm", "type": "Rectangle", "objectName": "NotificationBar", "visible": True} - Index: shared/scripts/utils.py =================================================================== diff -u -r40df2a58a855b561c1ca8dabd3b272ac48b8924e -r929c42f19c662c57ae264d200658fb1690353008 --- shared/scripts/utils.py (.../utils.py) (revision 40df2a58a855b561c1ca8dabd3b272ac48b8924e) +++ shared/scripts/utils.py (.../utils.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -12,27 +12,35 @@ # author Behrouz NematiPour # +import time +import struct + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def waitForGUI(vDelay = 1): + time.sleep(vDelay) +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def toUXX(vValue, vByteCount, vDelimiter): - x = '{0:0{1}X}'.format(vValue, vByteCount, 'x') - #n = 2 - #bytes = [x[i-n:i] for i in range(len(x),0, -n)] + x = '{0:0{1}X}'.format(vValue & (2**(4*vByteCount)-1), vByteCount, 'x') bytes = partition(x, 2) return vDelimiter.join(bytes) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def toU32(vValue, vDelimiter = ""): +def toI32(vValue, vDelimiter = ""): return toUXX(vValue, 8, vDelimiter) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def toU16(vValue, vDelimiter = ""): +def toI16(vValue, vDelimiter = ""): return toUXX(vValue, 4, vDelimiter) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def toU08(vValue, vDelimiter = ""): +def toI08(vValue, vDelimiter = ""): return toUXX(vValue, 2, vDelimiter) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def toF32(vValue): + return '{:08X}'.format(struct.unpack('f', vValue))[0],'X') + +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def partition(vString, vPart, vRightDirection = True): if vRightDirection: list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)] @@ -46,3 +54,4 @@ lPad = int(lStr / vLen) * vLen + ( vLen * (1 if lStr % vLen else 0) ) return vString.ljust(lPad, "0") + Index: suite.conf =================================================================== diff -u -rf268c732b393b4a4db05e8b8d4b1e17f7252ea27 -r929c42f19c662c57ae264d200658fb1690353008 --- suite.conf (.../suite.conf) (revision f268c732b393b4a4db05e8b8d4b1e17f7252ea27) +++ suite.conf (.../suite.conf) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -5,6 +5,6 @@ IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_GlobalTests tst_HomeScreen tst_ServiceShutdown tst_TreatmentScreen tst_Treatment_Section_BloodDialysate tst_Treatment_ParametersRange tst_Treatment_Adjustment_BloodDialysate tst_Treatment_Time tst_Alarm +TEST_CASES=tst_GlobalTests tst_HomeScreen tst_ServiceShutdown tst_TreatmentScreen tst_Treatment_Section_BloodDialysate tst_Treatment_BloodFlowRate tst_Treatment_DialysateFlowRate tst_Treatment_Time tst_Treatment_Ultrafiltration tst_Treatment_PressureOcclusion tst_Treatment_ParametersRange tst_Treatment_Adjustment_BloodDialysate tst_Alarm VERSION=3 WRAPPERS=Qt Index: tst_Alarm/test.py =================================================================== diff -u -r7fa14415857c2a6d03e5cccb0d187675a297e0b9 -r929c42f19c662c57ae264d200658fb1690353008 --- tst_Alarm/test.py (.../test.py) (revision 7fa14415857c2a6d03e5cccb0d187675a297e0b9) +++ tst_Alarm/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -13,13 +13,12 @@ # import names -import time import denaliMessages def main(): startApplication("denaliSquish") - denaliMessages.sendAlarm(3, 1, 0, 0, 120) + denaliMessages.sendAlarm(3, 26, 2, 0, 65535) test.compare(waitForObjectExists(names.o_ALARM_ID_MESSAGE).level, 3) test.compare(waitForObjectExists(names.o_ALARM_ID_MESSAGE).color.name, "#c53b33") @@ -43,7 +42,7 @@ denaliMessages.sendAlarm(0, 0, 0, 0, 0) try: # Notification Bar should be hidden - waitForObjectExists(names.o_ALARM_ID_MESSAGE,100) + waitForObjectExists(names.o_ALARM_ID_MESSAGE,0) test.compare(False, True) except LookupError: test.compare(False, False) Index: tst_GlobalTests/test.py =================================================================== diff -u -r40df2a58a855b561c1ca8dabd3b272ac48b8924e -r929c42f19c662c57ae264d200658fb1690353008 --- tst_GlobalTests/test.py (.../test.py) (revision 40df2a58a855b561c1ca8dabd3b272ac48b8924e) +++ tst_GlobalTests/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -13,7 +13,6 @@ # import unittests -#import denaliMessages def main(): unittests.testPythonVersion() Index: tst_ServiceShutdown/test.py =================================================================== diff -u -r40df2a58a855b561c1ca8dabd3b272ac48b8924e -r929c42f19c662c57ae264d200658fb1690353008 --- tst_ServiceShutdown/test.py (.../test.py) (revision 40df2a58a855b561c1ca8dabd3b272ac48b8924e) +++ tst_ServiceShutdown/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -11,9 +11,8 @@ # date 2019/11/20 # author Behrouz NematiPour # - +import utils import names -import time import globals import denaliMessages @@ -22,61 +21,61 @@ # This is only checking the functionality exists and it's working # ################################################################################ -def test_MainMenu_CurrentItem(vSRSUI = ""): - #test.compare(waitForObjectExists(names.o_mainMenu).currentIndex, 0) +def test_MainMenu_CurrentItem(vSRSUI=""): + # test.compare(waitForObjectExists(names.o_mainMenu).currentIndex, 0) test.compare(str(waitForObjectExists(names.o_mainMenu).currentTitle), "Treatment", globals.SRSUI(vSRSUI)) -def gotoScreenNtest_Contains_PowerOffButton(vSRSUI = ""): - mouseClick (waitForObjectExists(names.o_mainMenu_settings )) - test.compare(waitForObjectExists(names.o_settingsHome ).visible, True, globals.SRSUI(vSRSUI)) +def gotoScreenNtest_Contains_PowerOffButton(vSRSUI=""): + mouseClick (waitForObjectExists(names.o_mainMenu_settings)) + test.compare(waitForObjectExists(names.o_settingsHome).visible, True, globals.SRSUI(vSRSUI)) -def gotoScreenNtest_Contains_TreatmentHome(vSRSUI = ""): +def gotoScreenNtest_Contains_TreatmentHome(vSRSUI=""): mouseClick (waitForObjectExists(names.o_mainMenu_treatment)) test.compare(waitForObjectExists(names.o_treatmentHome).visible, True, globals.SRSUI(vSRSUI)) -def showNtest_PowerOffDialog(vSRSUI = ""): +def showNtest_PowerOffDialog(vSRSUI=""): denaliMessages.show_PowerOffDialog() test_PowerOffDialog(vSRSUI) -def hideNtest_PowerOffDialog(vSRSUI = ""): +def hideNtest_PowerOffDialog(vSRSUI=""): denaliMessages.hide_PowerOffDialog() test_PowerOffButton(vSRSUI) -def showNtest_PowerOffNotificationDialog(vSRSUI = ""): +def showNtest_PowerOffNotificationDialog(vSRSUI=""): mSRSUI = globals.SRSUI(vSRSUI) denaliMessages.show_PowerOffNotificationDialog() test.compare(str(waitForObjectExists(names.o_poweroff_notification).baseUrl.path), "/dialogs/AutoHideInfo.qml", mSRSUI + " - Dialog") constantPartOfTheMessage = "System is shutting down" test.compare(str(waitForObjectExists(names.o_poweroff_notification).text)[0:len(constantPartOfTheMessage)], constantPartOfTheMessage, mSRSUI + " - Message Text") - time.sleep(5) # dialog timeout - time.sleep(1) # animation transition + utils.waitForGUI(5) # dialog timeout + utils.waitForGUI(1) # animation transition -def showNtest_PowerOffRejectionDialog(vSRSUI = ""): +def showNtest_PowerOffRejectionDialog(vSRSUI=""): mSRSUI = globals.SRSUI(vSRSUI) denaliMessages.show_PowerOffRejectionDialog() test.compare(str(waitForObjectExists(names.o_poweroff_rejection).baseUrl.path), "/dialogs/AutoHideInfo.qml", mSRSUI + " - Dialog") - constantPartOfTheMessage = "Cannot shutdown during " # there might be the reason, concatenated at the end of the string. + constantPartOfTheMessage = "Cannot shutdown during " # there might be the reason, concatenated at the end of the string. test.compare(str(waitForObjectExists(names.o_poweroff_rejection).text)[0:len(constantPartOfTheMessage)], constantPartOfTheMessage, mSRSUI + " - Message Text") - time.sleep(2) # dialog timeout - time.sleep(1) # animation transition + utils.waitForGUI(2) # dialog timeout + utils.waitForGUI(1) # animation transition -def test_PowerOffButton(vSRSUI = ""): +def test_PowerOffButton(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroffButton).visible, True, globals.SRSUI(vSRSUI)) -def test_PowerOffDialog(vSRSUI = ""): +def test_PowerOffDialog(vSRSUI=""): test.compare(waitForObjectExists(names.o_modalDialog).visible, True, globals.SRSUI(vSRSUI)) -def testNclick_ShutdownButton_onPowerOffConfirm(vSRSUI = ""): +def testNclick_ShutdownButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_shutdown).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_shutdown)) - time.sleep (1) # Wait for the animation + utils.waitForGUI (1) # Wait for the animation -def testNclick_CancelButton_onPowerOffConfirm(vSRSUI = ""): +def testNclick_CancelButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_cancel).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_cancel)) - time.sleep (1) # Wait for the animation + utils.waitForGUI (1) # Wait for the animation def main(): # Start the Application @@ -86,7 +85,7 @@ test_MainMenu_CurrentItem(535) # 028 : The Home Screen shall display a "Settings" button. - test.compare(str(waitForObjectExists(names.o_mainMenu_settings ).text.text), "Settings", globals.SRSUI(28)) + test.compare(str(waitForObjectExists(names.o_mainMenu_settings).text.text), "Settings", globals.SRSUI(28)) # 029 : Upon "Settings" button depress on the Home Screen; the UI shall navigate the user to the Device Settings Screen. gotoScreenNtest_Contains_PowerOffButton(29) Index: tst_Treatment_Adjustment_BloodDialysate/test.py =================================================================== diff -u -r40568c277aa2c01963d0f3f9da41748c2686d343 -r929c42f19c662c57ae264d200658fb1690353008 --- tst_Treatment_Adjustment_BloodDialysate/test.py (.../test.py) (revision 40568c277aa2c01963d0f3f9da41748c2686d343) +++ tst_Treatment_Adjustment_BloodDialysate/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -13,7 +13,7 @@ # import names -import time +import utils import denaliMessages def gotoScreenNtest_Contains_FlowsSection(): @@ -28,13 +28,13 @@ startApplication("denaliSquish") gotoScreenNtest_Contains_FlowsSection() - time.sleep(1) + utils.waitForGUI(1) denaliMessages.setTreatmentBloodFlowRate(175) denaliMessages.setTreatmentDialysateFlowRate(250) gotoScreenNTest_Contains_Ranges() - time.sleep(1) + utils.waitForGUI(1) denaliMessages.setTreatmentParamRanges(0, 0, 0, 0, 150, 550) denaliMessages.send_acknowledge_UI() @@ -44,12 +44,22 @@ test.compare(waitForObjectExists(names.o_bloodFlowSlider_Slider).value, 225) test.compare(waitForObjectExists(names.o_dialysateFlowSlider_Slider).value, 200) + + # sendTreatmentAdjustBloodDialysateRequest mouseClick(waitForObject(names.o_TouchRect)) - - denaliMessages.sendTreatmentAdjustBloodDialysateResponse(0, 3, 175, 250) + denaliMessages.waitForMessageToBeSent() + utils.waitForGUI(7) # wait for ack timeout 5 is the timeout added +2 Sec for safe range. - time.sleep(2) + # sendTreatmentAdjustBloodDialysateRequest again + mouseClick(waitForObject(names.o_TouchRect)) + denaliMessages.waitForMessageToBeSent() + denaliMessages.send_acknowledge_HD() + denaliMessages.sendTreatmentAdjustBloodDialysateResponse(0, 3, 125, 150) # coverage + denaliMessages.sendTreatmentAdjustBloodDialysateResponse(0, 3, 125, 150) # coverage + denaliMessages.sendTreatmentAdjustBloodDialysateResponse(0, 3, 175, 250) + utils.waitForGUI(2) + mouseClick(waitForObject(names.o_bloodFlowSlider_Slider), 190, 4, Qt.LeftButton) mouseClick(waitForObject(names.o_dialysateFlowSlider_Slider), 79, 5, Qt.LeftButton) @@ -60,13 +70,9 @@ waitForObjectExists(names.o_bloodFlowSlider_Slider).value, waitForObjectExists(names.o_dialysateFlowSlider_Slider).value ) - - time.sleep(1) - denaliMessages.setTreatmentBloodFlowRate(225) denaliMessages.setTreatmentDialysateFlowRate(200) test.compare(str(waitForObjectExists(names.o_treatmentStart_225_Text).text), "225") test.compare(str(waitForObjectExists(names.o_treatmentStart_200_Text).text), "200") - time.sleep(1) Index: tst_Treatment_BloodFlowRate/test.py =================================================================== diff -u --- tst_Treatment_BloodFlowRate/test.py (revision 0) +++ tst_Treatment_BloodFlowRate/test.py (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -0,0 +1,38 @@ +# -*- 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_Treatment_BloodFlowRate +# date 2020/04/13 +# author Behrouz NematiPour +# + +import names +import utils +import denaliMessages + +def gotoScreenNtest_Contains_FlowsSection(): + mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) + test.compare(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).visible, True) + +def main(): + startApplication("denaliSquish") + + gotoScreenNtest_Contains_FlowsSection() + utils.waitForGUI(1) + + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).bloodFlowSetPoint), "0") + + denaliMessages.setTreatmentBloodFlowRate(125, 0, 0, 0, 0, 0, 0) # coverage + denaliMessages.setTreatmentBloodFlowRate(125, 0, 0, 0, 0, 0, 0) + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).bloodFlowSetPoint), "125") + + + denaliMessages.setTreatmentBloodFlowRate(175, 1, 1, 1, 1, 1, 1) + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).bloodFlowSetPoint), "175") + Index: tst_Treatment_DialysateFlowRate/test.py =================================================================== diff -u --- tst_Treatment_DialysateFlowRate/test.py (revision 0) +++ tst_Treatment_DialysateFlowRate/test.py (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -0,0 +1,38 @@ +# -*- 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_Treatment_DialysateFlowRate +# date 2020/04/13 +# author Behrouz NematiPour +# + +import names +import utils +import denaliMessages + +def gotoScreenNtest_Contains_FlowsSection(): + mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) + test.compare(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).visible, True) + +def main(): + startApplication("denaliSquish") + + gotoScreenNtest_Contains_FlowsSection() + utils.waitForGUI(1) + + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).dialysateFlowSetPoint), "0") + + denaliMessages.setTreatmentDialysateFlowRate(145, 0, 0, 0, 0, 0, 0) # coverage + denaliMessages.setTreatmentDialysateFlowRate(145, 0, 0, 0, 0, 0, 0) + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).dialysateFlowSetPoint), "145") + + + denaliMessages.setTreatmentDialysateFlowRate(155, 1, 1, 1, 1, 1, 1) + test.compare(str(waitForObjectExists(names.o_treatmentStart_flowsTouchArea_TreatmentFlows).dialysateFlowSetPoint), "155") + Index: tst_Treatment_ParametersRange/test.py =================================================================== diff -u -r40568c277aa2c01963d0f3f9da41748c2686d343 -r929c42f19c662c57ae264d200658fb1690353008 --- tst_Treatment_ParametersRange/test.py (.../test.py) (revision 40568c277aa2c01963d0f3f9da41748c2686d343) +++ tst_Treatment_ParametersRange/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -13,7 +13,7 @@ # import names -import time +import utils import denaliMessages def gotoScreenNtest_Contains_FlowsSection(): @@ -36,8 +36,9 @@ gotoScreenNtest_Contains_FlowsSection() gotoScreenNTest_Contains_Ranges() - time.sleep(1) + utils.waitForGUI(1) + denaliMessages.setTreatmentParamRanges(0, 0, 0, 0, 150, 550) #coverage denaliMessages.setTreatmentParamRanges(0, 0, 0, 0, 150, 550) denaliMessages.send_acknowledge_UI() Index: tst_Treatment_PressureOcclusion/test.py =================================================================== diff -u --- tst_Treatment_PressureOcclusion/test.py (revision 0) +++ tst_Treatment_PressureOcclusion/test.py (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -0,0 +1,43 @@ +# -*- 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_Treatment_PressureOcclusion +# date 2020/04/13 +# author Behrouz NematiPour +# + +import names +import utils +import denaliMessages + +def gotoScreenNtest_Contains_PressureOcclusion(): + mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).visible, True) + +def main(): + startApplication("denaliSquish") + + gotoScreenNtest_Contains_PressureOcclusion() + utils.waitForGUI(1) + + denaliMessages.setTreatmentPressureOcclusion(0, 0, 0, 0, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).arterilPressure, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).venusPressure, 0) + + + denaliMessages.setTreatmentPressureOcclusion(200, 100, 50, 25, 15) # Coverage + denaliMessages.setTreatmentPressureOcclusion(200, 100, 50, 25, 15) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).arterilPressure, 200) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).venusPressure, 100) + + + denaliMessages.setTreatmentPressureOcclusion(0, 0, 0, 0, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).arterilPressure, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_pressureTouchArea_TreatmentPressure).venusPressure, 0) + Index: tst_Treatment_Time/test.py =================================================================== diff -u -rf268c732b393b4a4db05e8b8d4b1e17f7252ea27 -r929c42f19c662c57ae264d200658fb1690353008 --- tst_Treatment_Time/test.py (.../test.py) (revision f268c732b393b4a4db05e8b8d4b1e17f7252ea27) +++ tst_Treatment_Time/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -13,7 +13,7 @@ # import names -import time +import utils import denaliMessages def gotoScreenNtest_Contains_TimeSection(): @@ -35,7 +35,7 @@ startApplication("denaliSquish") gotoScreenNtest_Contains_TimeSection() - time.sleep(1) + utils.waitForGUI(1) total = 60 resetNTestTreatmentTime(total) Index: tst_Treatment_Ultrafiltration/test.py =================================================================== diff -u --- tst_Treatment_Ultrafiltration/test.py (revision 0) +++ tst_Treatment_Ultrafiltration/test.py (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -0,0 +1,63 @@ +# -*- 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_Treatment_Ultrafiltration +# date 2020/04/12 +# author Behrouz NematiPour +# + +import names +import utils +import denaliMessages + +def gotoScreenNtest_Contains_Ultrafiltration(): + mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).visible, True) + +def startNTestTreatmentUltrafiltration(vVolume): + for i in range(0,vVolume+1): + denaliMessages.setTreatmentUltrafiltration(vVolume, i, 1, 1, 1, 1, 1) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).value, i) + +def resetNTestTreatmentUltrafiltration(vVolume): + denaliMessages.setTreatmentUltrafiltration(0, 0, 0, 0, 0, 0, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).value, 0) + +def main(): + startApplication("denaliSquish") + + gotoScreenNtest_Contains_Ultrafiltration() + utils.waitForGUI(1) + + minUF = 0 + maxUF = 100 + + denaliMessages.setTreatmentParamRanges(0, 0, minUF, maxUF, 0, 0) + denaliMessages.send_acknowledge_UI() + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).minimum, minUF) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).maximum, maxUF) + + volume = maxUF + resetNTestTreatmentUltrafiltration(volume) + startNTestTreatmentUltrafiltration(volume) + resetNTestTreatmentUltrafiltration(volume) + + minUF = 0 + maxUF = 10 + + denaliMessages.setTreatmentParamRanges(0, 0, minUF, maxUF, 0, 0) + denaliMessages.send_acknowledge_UI() + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).minimum, minUF) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).maximum, maxUF) + + volume = maxUF + resetNTestTreatmentUltrafiltration(volume) + startNTestTreatmentUltrafiltration(volume) + resetNTestTreatmentUltrafiltration(volume) +