# -*- 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(vMinUF, vMaxUF): for i in range(vMinUF, vMaxUF+1, 10): denaliMessages.setTreatmentUltrafiltration(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) def testScreen_Start_Ultrafiltration(): # [Start Screen] ## Pause Button test.compare(str(waitForObjectExists(names.o_pauseButton_TouchRect).text.text), "PAUSE ULTRAFILTRATION") def pause_Request(): # [Request Pause] mouseClick(waitForObject(names.o_pauseButton_TouchRect)) def pause_RejectNTest(): # [Reject Pause] denaliMessages.setTreatmentAdjustUltrafiltrationRejected() # [Reject Notification] test.compare(str(waitForObjectExists(names.notificationBar_NotificationBar).text), "Unable to Pause Ultrafiltration or already paused") def pause_Accept(): # [Accept Pause] denaliMessages.setTreatmentAdjustUltrafiltrationAccepted() utils.waitForGUI(1) def testScreen_Paused_Ultrafiltration(): # [Paused Screen] ## Edit Button test.compare(str(waitForObjectExists(names.o_editButton_TouchRect).text.text), "EDIT ULTRAFILTRATION VOLUME") ## Resume Button test.compare(str(waitForObjectExists(names.o_resumeButton_TouchRect).text.text), "RESUME ULTRAFILTRATION") ## Paused Notification test.compare(str(waitForObjectExists(names.o_pauseNotificationBar_NotificationBar).text), "Ultrafiltration is paused.") def resume_Request(): # [Request Resume] mouseClick(waitForObject(names.o_resumeButton_TouchRect)) def resume_RejectNTest(): # [Reject Resume] denaliMessages.setTreatmentAdjustUltrafiltrationRejected() # [Reject Notification] test.compare(str(waitForObjectExists(names.notificationBar_NotificationBar).text), "Unable to Resume Ultrafiltration or already running") def resume_Accept(): # [Accept Resume] denaliMessages.setTreatmentAdjustUltrafiltrationAccepted() utils.waitForGUI(1) def closeScreen(): mouseClick(waitForObject(names.o_closeButton)) utils.waitForGUI(1) def testScreen_Paused_Notification(): # [Section Paused Notification] test.compare(str(waitForObjectExists(names.o_treatmentStart_NotificationBar_NotificationBar).text), "Ultrafiltration Paused") test.compare(str(waitForObjectExists(names.o_treatmentStart_0_000_Text).color.name), "#696969") def edit_Clicked(): mouseClick(waitForObject(names.o_editButton_TouchRect)) def testScreen_Edit_Ultrafiltration(): test.compare(str(waitForObjectExists(names.o_nextButton_TouchRect).text.text), "NEXT") test.compare(str(waitForObjectExists(names.notificationBar_NotificationBar).text), "Ultrafiltration is paused.") test.compare(str(waitForObjectExists(names.o_backButton_BackButton).text.text), "BACK") def back_Clicked(): mouseClick(waitForObject(names.o_backButton_BackButton)) def main(): utils.tstStart() startApplication("denali") utils.waitForGUI(1) gotoScreenNtest_Contains_Ultrafiltration() utils.waitForGUI(1) gotoScreen_UltrafiltrationAdjustment() # Start Screen upon User touch while IS NOT PAUSED 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 testScreen_Start_Ultrafiltration() pause_Request() 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() # Paused Screen upon User Back Button from Edit Screen testScreen_Paused_Ultrafiltration() # Edit Screen upon Used Edit Button edit_Clicked() # HD sends Ultrafiltration ranges denaliMessages.setTreatmentParamRanges(0, 0, 100, 4800, 0, 0) # Edit Screen updates Ultrafiltration ranges on Slider upon Receiving Ranges test.compare(str(waitForObjectExists(names.o_volumeSlider_Slider).minText.text), "0.100") test.compare(str(waitForObjectExists(names.o_volumeSlider_Slider).maxText.text), "4.800") mouseClick(waitForObject(names.o_volumeSlider_Slider), 404, 1, Qt.LeftButton) test.compare(str(waitForObjectExists(names.o2_300_Text).text), "2.300") mouseClick(waitForObject(names.o_nextButton_TouchRect)) # HD Response # ----------- utils.tstDone()