Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r4dfe8f7ce0cf625ca3039ff482eba432f3cf7ade -r8e0a85bb2892e136dba36c9280bb3c9076017781 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 4dfe8f7ce0cf625ca3039ff482eba432f3cf7ade) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 8e0a85bb2892e136dba36c9280bb3c9076017781) @@ -1224,66 +1224,5 @@ raise LookupError("value object is not in view to the user after trying 100 times") -def rename_file(path,filename): - """ - This method Rename the original folder name to dummy name. - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename+"_1": - if os.path.exists(path+filename+"_1"): - shutil.rmtree(path+filename+"_1") - test.log(str(filename+" name changed to "+files)) - if files == filename: - if os.path.exists(path+filename): - utils.waitForGUI(1) - os.rename(path+filename,path+filename+"_1") - test.log(str(files+" name changed to "+filename+"_1")) - -def rename_old_name(path,filename): - """ - This method Rename the dummy name to original folder name . - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename: - if os.path.exists(path+filename): - shutil.rmtree(path+filename) - test.log(str(files+"_1 name changed to "+filename)) - utils.waitForGUI(5) - - if files != filename: - - if (files == filename+"_1"): - os.rename(path+files,path+filename) - test.log(str(files+" name changed to "+filename)) - - -def scroll_to_zone(zone=None, screen_object=None, direction = None): - """ - scroll to the to the value if object is hidden - @param value - (obj) value object - @param container - (obj) Container of the value - @return boolean true and false - """ - counter = 0 - while counter <= 100: - try: - counter += 1 - squish.findObject(zone) - squish.snooze(0.5) - if check_if_object_is_within_the_container(obj=zone, container=screen_object): - return True - else: - raise RuntimeError - except RuntimeError: - ScreenObj = squish.findObject(screen_object) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) - if direction is None: - squish.mouseWheel(ScreenObj, (screenWidth-100), 107, 0, -(screenHeight-460), squish.Qt.NoModifier) - else: - squish.mouseWheel(ScreenObj, (screenWidth-100), -(screenHeight-700), 0, 200, squish.Qt.NoModifier) - - raise LookupError("zone object is not in view to the user after trying 100 times") - + + \ No newline at end of file Index: tst_cloud_sync - treatment_screen/test.py =================================================================== diff -u -r9b7ef5a23854a897c674bd62c6e7be63c60b9233 -r8e0a85bb2892e136dba36c9280bb3c9076017781 --- tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 9b7ef5a23854a897c674bd62c6e7be63c60b9233) +++ tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 8e0a85bb2892e136dba36c9280bb3c9076017781) @@ -254,38 +254,7 @@ test.fail("err log file is not created or log file is not created based on standard log naming format.") -def rename_file(path,filename): - """ - This method Rename the original folder name to dummy name. - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename+"_1": - if os.path.exists(path+filename+"_1"): - shutil.rmtree(path+filename+"_1") - test.log(str(filename+" name changed to "+files)) - if files == filename: - if os.path.exists(path+filename): - utils.waitForGUI(1) - os.rename(path+filename,path+filename+"_1") - test.log(str(files+" name changed to "+filename+"_1")) -def rename_old_name(path,filename): - """ - This method Rename the dummy name to original folder name . - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename: - if os.path.exists(path+filename): - shutil.rmtree(path+filename) - test.log(str(files+"_1 name changed to "+filename)) - utils.waitForGUI(5) - if files != filename: - if (files == filename+"_1"): - os.rename(path+files,path+filename) - test.log(str(files+" name changed to "+filename)) - def verify_wifi_scan(): """ Method to navigate to "Settings" screen @@ -313,40 +282,40 @@ test.startSection("Renaming the cloudsync,sd-card, usb-disk, application folder name") try: - rename_file(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_file(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") utils.waitForGUI(5) except: test.log(str("cloudsync main desktop folder name not changed")) finally: - rename_old_name(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_old_name(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") try: - rename_file(config.SD_CARD_LOCATION,"sd-card") + utility.rename_file(config.SD_CARD_LOCATION,"sd-card") utils.waitForGUI(5) except: test.log(str("sd-card folder name not changed")) finally: - rename_old_name(config.SD_CARD_LOCATION,"sd-card") + utility.rename_old_name(config.SD_CARD_LOCATION,"sd-card") try: - rename_file(config.USB_DISK_FOLDER_LOCATION,"usb-disk") + utility.rename_file(config.USB_DISK_FOLDER_LOCATION,"usb-disk") utils.waitForGUI(5) except: test.log(str("usb_disk folder name not changed")) finally: - rename_old_name(config.USB_DISK_FOLDER_LOCATION,"usb-disk") + utility.rename_old_name(config.USB_DISK_FOLDER_LOCATION,"usb-disk") try: - rename_file(config.APPLICATION_FOLDER_LOCATION,"application") + utility.rename_file(config.APPLICATION_FOLDER_LOCATION,"application") utils.waitForGUI(5) verify_wifi_scan() except: test.log(str("Setings wifi screen not visible")) finally: - rename_old_name(config.APPLICATION_FOLDER_LOCATION,"application") + utility.rename_old_name(config.APPLICATION_FOLDER_LOCATION,"application") try: - rename_file(config.CANBUS_FOLDER_LOCATION,"canbus") + utility.rename_file(config.CANBUS_FOLDER_LOCATION,"canbus") HD_DG_VERSION_SERIAL_REQUEST = "1657706421,13,0,1001,3,HD1234567890123,DG1234567890123,06300216" hd_simulator.cmd_send_serial_hd_data(serial = HD_VERSION_SERIAL_REQUEST[5]) dg_simulator.cmd_send_serial_dg_data(serial = DG_VERSION_SERIAL_REQUEST[6]) @@ -355,7 +324,7 @@ except: test.log(str("Setings wifi screen not visible")) finally: - rename_old_name(config.CANBUS_FOLDER_LOCATION,"canbus") + utility.rename_old_name(config.CANBUS_FOLDER_LOCATION,"canbus") test.endSection() def verify_cloudsync_treatment(): @@ -398,9 +367,20 @@ def main(): + """ + Do not interrupt this script while it is executing. + This script might create folder problems. + Inside this script we are renaming names of following folders which are required for execution. + 1)cloudsync present on desktop + 2)cloudsync present inside sd-card + 3)usb-disk + 4)sd-card + 5)application + 6)canbus + """ utils.tstStart(__file__) try: - rename_file(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_file(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") utils.waitForGUI(0.5) startApplication(config.AUT_NAME) utils.waitForGUI(1.5) @@ -412,7 +392,7 @@ except: test.log(str("Cloudsync desktop folder name not changed")) finally: - rename_old_name(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_old_name(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") verify_cloudsync_treatment() rename_folder_names()