Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -rd132e765fb23ee3309cbdad3d10fe9f6f508405a --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision d132e765fb23ee3309cbdad3d10fe9f6f508405a) @@ -34,6 +34,41 @@ o_standby_page = {"container": o_MainHome_MainHome, "type": "Column", "unnamed": 1, "visible": True} + +#pre_treatment_water_sample + +o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} +o_PreTreatmentStack_PreTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PreTreatmentStack", "type": "PreTreatmentStack", "visible": True} +o_PreTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSampleStack = {"container": o_PreTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentSampleStack", "type": "PreTreatmentWaterSampleStack", "visible": True} +o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase = {"container": o_PreTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSampleStack, "objectName": "_PreTreatmentBase", "type": "TreatmentFlowBase", "visible": True} +o_PreTreatmentBase_WATER_SAMPLE_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "WATER SAMPLE", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_NEXT_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "FAIL", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Sample_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Sample", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_headStepBullet_StepBullet = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "id": "_headStepBullet", "type": "StepBullet", "unnamed": 1, "visible": True} +o_PreTreatmentBase_indicator_StepIndicator = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "gradient": 0, "id": "_indicator", "type": "StepIndicator", "unnamed": 1, "visible": True} +o_PreTreatmentBase_FAIL_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "OK", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_PASS_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "PASS", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_BACK_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "BACK", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_OK_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "OK", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_TimeText = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "id": "_shape", "type": "Shape", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Filter_Flush_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Filter Flush", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_rectangle_Rectangle = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "id": "_rectangle", "type": "Rectangle", "unnamed": 1, "visible": True} +o_PreTreatmentBase_TimeText_hour_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "objectName": "_TimeText_hour", "type": "Text", "visible": True} +o_PreTreatmentBase_progressCircle_ProgressCircle = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "id": "_progressCircle", "type": "ProgressCircle", "unnamed": 1, "visible": True} + +Time_text={"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "objectName": "_TimeText", "type": "TimeText", "visible": True} +progress_circle={"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "id": "_progressCircle", "type": "ProgressCircle", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Create_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Create", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Disposables_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Disposables", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Prime_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Prime", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Ultrafiltration_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Ultrafiltration", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_BP_HR_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "BP/HR", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Connection_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Connection", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Start_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Start", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Consumables_Text = {"container": o_PreTreatmentSampleStack_PreTreatmentBase_TreatmentFlowBase, "text": "Consumables", "type": "Text", "unnamed": 1, "visible": True} + + + #in-treatment o_blood_priming = {"container": o_treatmentStack_TreatmentBloodPrime_ScreenItem, "text": "Blood Priming", "type": "Text", "unnamed": 1, "visible": True} o_blood_priming_value_by_default = {"container": o_treatmentStack_TreatmentBloodPrime_ScreenItem, "text": "0 mL", "type": "Text", "unnamed": 1, "visible": True} Index: tst_pre_treatment_water_sample/test.py =================================================================== diff -u --- tst_pre_treatment_water_sample/test.py (revision 0) +++ tst_pre_treatment_water_sample/test.py (revision d132e765fb23ee3309cbdad3d10fe9f6f508405a) @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +import names +from dialin.ui import utils +from dialin.ui.hd_simulator import HDSimulator +from dialin.ui.utils import waitForGUI +from random import randint +from dialin.ui.dg_simulator import DGSimulator + +hd_simulator = HDSimulator() +dg_simulator = DGSimulator() +MIN_TIME_RANGE = 0 +MAX_TIME_RANGE = 300 + +FILTER_FLUSH_TEXT = "Filter Flush" +CREATE = "Create" +SAMPLE = "Sample" +CONSUMABLES = "Consumables" +DISPOSABLES = "Disposables" +PRIME = "Prime" +ULTRAFILTERATION = "Ultrafiltration" +BP_HR = "BP/HR" +CONNECTION = "Connection" +START = "Start" + + +FILTER_FLUSH_DEFAULT_VALUE = "0" + +def verify_filter_flush_text(): + """ + Verify Filter Flush Text on UI Screen + """ + test.log("Verifying the text 'Filter Flush'") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Filter_Flush_Text).text),FILTER_FLUSH_TEXT, "Verified Filter Flush text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Create_Text).text),CREATE, "Verified Create text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Sample_Text).text),SAMPLE, "Verified Sample text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Consumables_Text).text),CONSUMABLES, "Verified Consumables text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Disposables_Text).text),DISPOSABLES, "Verified Disposables text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Prime_Text).text),PRIME, "Verified PRIME text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Ultrafiltration_Text).text),ULTRAFILTERATION, "Verified Ultrafilteration text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_BP_HR_Text).text),BP_HR, "Verified BP/HR text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Connection_Text).text),CONNECTION, "Verified Connection text") + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_Start_Text).text),START, "Verified Start text") + +def navigate_to_pretreatment_screen(): + """ + Method to navigate to sub mode under pre-treatment screen + @param mode - (int) pre treatment state + """ + hd_simulator.cmd_set_hd_operation_mode_data(5,0) + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=1, water_sample_state=1, + consumables_self_test_state=0,no_cartridge_self_test_state=0, + installation_state=0, dry_self_test_state=0, prime_state=0, + recirculate_state=0, patient_connection_state=0) + +def filter_flush_screen_navigation(): + """ + Method to navigate to sub mode under pre-treatment screen + @param mode - (int) pre treatment state + """ + hd_simulator.cmd_set_hd_operation_mode_data(5,0) + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=1, water_sample_state=0, + consumables_self_test_state=0,no_cartridge_self_test_state=0, + installation_state=0, dry_self_test_state=0, prime_state=0, + recirculate_state=0, patient_connection_state=0) + +def filter_flush_verification(total): + #hd_simulator.cmd_send_pre_treatment_self_test_dry_progress_data(filter_flush_progress_value,filter_flush_countdown_value) + #test.compare(waitForObject(names.o_PreTreatmentBase_TimeText_TimeText).text, + test.startSection("Verify the seconds values inside Progress bar and on timer 'Time in seconds'") + reset_treatment_time_verification(total) + start_treatment_time_verification(total) + test.endSection() + +def verification_Bullets_text(): + test.verify((names.o_PreTreatmentBase_headStepBullet_StepBullet).visible, "Verify headstep bullet") + test.verify((names.o_PreTreatmentBase_indicator_StepIndicator).enable, "Verified indicator") + +def reset_treatment_time_verification(vTotal): + """ + Method to reset and verify Actual time in seconds + to Maximum & Minimum values on UI screen in seconds + @param vTotal: (int) Total time in seconds + """ + + dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(0,vTotal) + test.compare(waitForObjectExists(names.Time_text).parent.parent.maximum, vTotal, "Reset maximum value and compare it expected value{}".format(vTotal)) + test.compare(waitForObjectExists(names.Time_text).parent.parent.minimum, 0, "Reset minimun value and compare it expected value{}".format(0)) + +def start_treatment_time_verification(vTotal): + """ + Method to verify Actual time in seconds to Time appear on UI Screen in seconds. + Also it compare the Progress bar value in seconds + @param vTotal: (int) Total time in seconds ##as per behrouz comment @param vTotal - (int) Total time in seconds + """ + test.log("Start time") + for i in range(0,vTotal+1): + test.log("IN for loop") + dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(300, vTotal - i) + test.compare(waitForObjectExists(names.progress_circle).parent.progressValue, i, "progress value should be {}".format(i)) + test.compare(waitForObjectExists(names.Time_text).parent.parent.timeTextValue, vTotal - i, "Expected Time on UI should be in seconds{}".format(vTotal - i)) + + +def total_time(): + """ + Method for providing two random values between the time duration range as per SRSUI documents from 60 to 480 Minutes + + """ + + totaltime_list = [] + id_count = 0 + while id_count < 2: + id = randint(MIN_TIME_RANGE, MAX_TIME_RANGE) + test.log(str(id),"Random total Seconds arrived by randint function") + if id in totaltime_list: + pass + else: + totaltime_list.append(id) + id_count += 1 + return totaltime_list + +def main_screen_verification(): + test.verify(waitForObjectExists(names.o_PreTreatmentBase_WATER_SAMPLE_Text).visible, "Sample text is bold") + test.verify(waitForObjectExists(names.o_PreTreatmentBase_NEXT_Text).visible, "Next button is enabled") + mouseClick(waitForObject(names.o_PreTreatmentBase_NEXT_Text)) + +def verify_water_sample_screen(): + test.verify(waitForObjectExists(names.o_PreTreatmentBase_PASS_Text).visible,"Verify pass button") + test.verify(waitForObjectExists(names.o_PreTreatmentBase_NEXT_Text).visible,"Verify Fail button") + mouseClick(waitForObject(names.o_PreTreatmentBase_PASS_Text)) + mouseClick(waitForObject(names.o_PreTreatmentBase_BACK_Text)) + mouseClick(waitForObject(names.o_PreTreatmentBase_NEXT_Text)) + mouseClick(waitForObject(names.o_PreTreatmentBase_FAIL_Text)) + +def verify_failed_water_sample_screen(): + test.log("Verify") + test.verify(waitForObjectExists(names.o_PreTreatmentBase_OK_Text).visible,"Verify ok button") + +def main(): + utils.tstStart(__file__) + startApplication("denaliSquish") + + filter_flush_screen_navigation() + waitForGUI(10) + verify_filter_flush_text() + #verification_Bullets_text() + dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(300,100) + waitForGUI(5) + total_time_list = total_time() + for value in total_time_list: + filter_flush_verification(value) + #filter_flush_verification(total=5) + waitForGUI(5) + navigate_to_pretreatment_screen() + waitForGUI(5) + main_screen_verification() + waitForGUI(10) + verify_water_sample_screen() + waitForGUI(10) + verify_failed_water_sample_screen() + waitForGUI(10) + + utils.tstDone() + + \ No newline at end of file