Index: tst_cloud_sync - treatment_screen/test.py =================================================================== diff -u -r94e535b209b30b9aaae8174e92ea802f4a6c5452 -rb634bdd10b66a9b76dd6c3898b27f60bd25bcbdc --- tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 94e535b209b30b9aaae8174e92ea802f4a6c5452) +++ tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision b634bdd10b66a9b76dd6c3898b27f60bd25bcbdc) @@ -17,8 +17,8 @@ import csv import names -import time import os +import time from dialin.ui.hd_simulator import HDSimulator from dialin.ui import utils from configuration import utility @@ -40,40 +40,44 @@ DEVICE_FACTORY_RESET_CONFIRM = '1639391827,1,0,1005,1,0' DEVICE_INFO_REQUEST = '1639391827,1,9,2002,0' + def verify_code_from_treatment_response(): """ This function is used for verify the code text from treatment log. """ hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) - for indicator in range(1, POST_TREATMENT_INSTRUCTION_COUNT, 1): + for indicator in range(1, POST_TREATMENT_INSTRUCTION_COUNT): if indicator != POST_TREATMENT_INSTRUCTION_COUNT: mouseClick(waitForObject(names.o_patient_Disconnection_right_arrow)) - utils.waitForGUI(2) + utils.waitForGUI() mouseClick(names.o_patientDisconnectionConfirm_CONFIRM_Text) message_text = CODE_DISPLAY_REQUEST.split(',') - utils.waitForGUI(3) #delay for fetching the effect + utils.waitForGUI(1) #delay for fetching the effect text_code_label = str(waitForObjectExists(names.o_treatmentReviewConfirm_Code_Tx_code_Label).text) - test.compare(message_text[5], text_code_label.split(': ')[1], "CS2UI message should be verified") + test.compare(message_text[config.PARAMETER_INDEX], text_code_label.split(': ')[1], "CS2UI message text for code 2008 should be verified") def set_data_in_cloud_sync_output_file(message): """ This function is capable to write message into cloud sync folder. Through this method file reader act as a handler and it will write custom messages into {current_date}_out.buf - @input: (string) message -expected message to be write on out.buf file. + @input: (string) message - expected message to be write on out.buf file. """ cloud_out_log = utility.get_cloud_sync_output_file() with open(cloud_out_log, "w") as filereader: filereader.write(message) - utils.waitForGUI(5) + test.log("User written message - %s into out.buf file" %message) + utils.waitForGUI(1) def verify_log_response(actual_cloudsync_data, expected_cloudsync_data): """ This function is used for verifying the expected and actual cloud-sync log data. + @input: (string) actual_cloudsync_data - cloud sync log from in device. + @input: (string) expected_cloudsync_data - expected cloud sync log. """ test.startSection("Verification of cloud response for code %s" %actual_cloudsync_data[config.CODE_INDEX]) expected_cloudsync_data = expected_cloudsync_data.split(',') @@ -86,8 +90,6 @@ test.compare(expected_cloudsync_data[index], actual_cloudsync_data[index], "cloud sync data %s is verified" %expected_cloudsync_data[index]) test.endSection() - - def main(): @@ -101,17 +103,13 @@ verify_code_from_treatment_response() set_data_in_cloud_sync_output_file(DEVICE_CREDENTIALS_REQUEST) - utils.waitForGUI(3) device_credentials_response = utility.retrive_log_data() verify_log_response(device_credentials_response[0], DEVICE_CREDENTIALS_RESPONSE) - set_data_in_cloud_sync_output_file(DEVICE_FACTORY_RESET_REQUEST) - utils.waitForGUI(3) factory_reset_response = utility.retrive_log_data() verify_log_response(factory_reset_response[0], DEVICE_FACTORY_RESET_CONFIRM) - utils.tstDone() \ No newline at end of file