Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
580f2f3
Add functionality for other capabilities
Oytizzo Apr 17, 2022
7e33077
Add os specific requirements
Oytizzo Apr 17, 2022
c7dbab9
Add shared capability and remove os specific req
Oytizzo Apr 25, 2022
71ea5cc
[Change] Image quality upgraded to 1920,1080 and quality 100
Muntasib-creator Apr 26, 2022
b3b1c4c
version = 15.0.1 date = April 26, 2022
Muntasib-creator Apr 26, 2022
5ec6ae3
Merge pull request #168 from AutomationSolutionz/ss_quality
Muntasib-creator Apr 26, 2022
243618e
[Add] `%|zeuz_auto_teardown|%` variable is added for turning off auto…
Muntasib-creator Apr 26, 2022
32c84f5
version = 15.0.2 date = April 26, 2022
Muntasib-creator Apr 26, 2022
f524d48
Merge pull request #169 from AutomationSolutionz/auto_teardown
Muntasib-creator Apr 26, 2022
c8e814a
Merge branch 'dev' of https://github.com/AutomationSolutionz/Zeuz_Pyt…
Muntasib-creator Apr 27, 2022
d3d5fe5
Merge pull request #167 from AutomationSolutionz/dev_short_fix
Muntasib-creator Apr 27, 2022
3825a3a
Update Exception_Handler
Oytizzo May 2, 2022
37cded5
Copied the android windows installer
Muntasib-creator May 7, 2022
eed1b4b
refactor
Muntasib-creator May 7, 2022
5e8c3b6
Resolve bug for printing whole error
Oytizzo May 8, 2022
64be2c3
version = 15.0.3 date = May 08, 2022
Muntasib-creator May 8, 2022
ab7e166
Merge pull request #170 from AutomationSolutionz/dev_exception_handler
Muntasib-creator May 8, 2022
bd3976a
[Improve] Initial improvements for windows
Muntasib-creator May 8, 2022
86eaeef
[Remove] futures no longer need to be installed for python3
Muntasib-creator May 9, 2022
2227fc4
[Modification]global attachment download action
Arifshariar7 May 10, 2022
7a83ed9
[Add] Pre-installer added
Muntasib-creator May 10, 2022
8991b92
Merge remote-tracking branch 'origin/win_android' into win_android
Muntasib-creator May 10, 2022
7a47189
Merge pull request #171 from AutomationSolutionz/global-attachment-do…
Muntasib-creator May 10, 2022
744d3fa
[Remove] Commented out ANT paths
Muntasib-creator May 11, 2022
b41046b
[Improve] Added plus button support in keystroke action
Muntasib-creator May 11, 2022
ac04be8
version = 15.0.4 date = May 11, 2022
Muntasib-creator May 11, 2022
f84c1dd
Merge pull request #172 from AutomationSolutionz/keystroke
Muntasib-creator May 11, 2022
b69613a
[Add] Iframe suggestion log
Muntasib-creator May 13, 2022
8c21dea
[Fix] uniq param does not end bug fix
Muntasib-creator May 13, 2022
6be4ab1
Merge pull request #174 from AutomationSolutionz/Improve_locating
Muntasib-creator May 13, 2022
ef45fcf
log improve
Muntasib-creator May 20, 2022
ba9bb30
[Add] installation guideline text file is added
Muntasib-creator May 20, 2022
b92bad4
Merge pull request #176 from AutomationSolutionz/win_android
Muntasib-creator May 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Changelog

# Version 14
# Version 15

### [Current changes]
- _

### [15.0.4][May 11, 2022]
- **[Improve]** Added plus button support in keystroke action

### [15.0.3][May 08, 2022]
- **[Change]** Removed printing the whole traceback of error

### [15.0.2][April 26, 2022]
- **[Add]** `%|zeuz_auto_teardown|%` variable is added for turning off auto teardown

### [15.0.1][April 26, 2022]
- **[Change]** Screenshot image quality upgraded to resolution 1920,1080

### [15.0.0][April 16, 2022]
- **[Add]** Added capability for handling alert as desired.
- **[Add]** Added action read scanned pdf
Expand All @@ -23,6 +35,8 @@
- **[Fix]** import pyautogui fix for ui-less machine
- **[Remove]** SSL validation is bypassed while installing webdriver

# Version 14

### [14.11.2][March 30, 2022]
- **[Fix]** Pyautogui import fix for ui-less machine
- **[Add]** Added missing commits of `Alert` and `Android browser`
Expand Down
32 changes: 22 additions & 10 deletions Framework/Built_In_Automation/Desktop/Windows/BuiltInFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ def Keystroke_For_Element(data_set):
left = left.strip().lower()
if "action" in mid.lower():
if left == "keystroke keys":
keystroke_value = right.lower() # Store keystroke
keystroke_value = right.strip().lower() # Store keystroke
elif left == "keystroke chars":
keystroke_char = right
if "parameter"in mid.lower():
Expand Down Expand Up @@ -1776,14 +1776,21 @@ def Keystroke_For_Element(data_set):
keystroke_value, count = keystroke_value.split(",")
count = int(count.strip())
keys = keystroke_value.split("+")
keys = [x.strip() for x in keys]
for i in range(len(keys)):
keys[i] = keys[i].strip()
if keys[i] == "plus":
keys[i] = "+"
elif keys[i] == "minus":
keys[i] = "-"
elif keys[i] == "comma":
keys[i] = ","

for i in range(count):
gui.hotkey(*keys) # Send keypress (as individual values using the asterisk)
CommonUtil.ExecLog(sModuleInfo, "Successfully entered keystroke", 1)
return "passed"

elif method_name=='autoit':
elif method_name == 'autoit':
try:
if keystroke_char != "":
autoit.send(keystroke_char)
Expand All @@ -1794,26 +1801,31 @@ def Keystroke_For_Element(data_set):
return CommonUtil.Exception_Handler(sys.exc_info(), None, errMsg)

count = 1
keystroke_value = keystroke_value
if "," in keystroke_value:
keystroke_value, count = keystroke_value.split(",")
count = int(count.strip())
keys = keystroke_value.split("+")
keys = [x.strip() for x in keys]
for i in range(len(keys)):
keys[i] = keys[i].strip()
if keys[i] == "plus":
keys[i] = "+"
elif keys[i] == "minus":
keys[i] = "-"
elif keys[i] == "comma":
keys[i] = ","

send_key = ""
for i in range(len(keys)):
if i == len(keys)-1:
send_key += '{' + keys[i] + ' ' + str(count) + '}'
else:
upper = keys[i].upper()
if upper == 'SHIFT':
if keys[i] == 'shift':
send_key += '+'
elif upper == 'CTRL':
elif keys[i] == 'ctrl':
send_key += '^'
elif upper == 'ALT':
elif keys[i] == 'alt':
send_key += '!'
elif upper == 'WIN':
elif keys[i] == 'win':
send_key += '#'
# print(send_key)
autoit.send(send_key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"attribute constrain",
"optional option",
"graphql",
"capability"
"shared capability"
)

# List of supported mobile platforms - must be lower case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4464,24 +4464,22 @@ def download_attachment_from_global(data_set):
"""
usage: This action allows you to download attachments from a testcase id
dataset :
attachment name | input parameter | name
path to save | optional parameter | path
download attachment from global | common action | result
download attachment from global | common action | attachment name

return : return True/False
note: attachment name will be the name of that attachment ,result will be the variable name to store
"""
sModuleInfo = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME
try:
var_name = None
var_path = None
var_path = sr.Get_Shared_Variables("zeuz_download_folder")
for left, mid, right in data_set:
left = left.strip().lower()
if "attachment name" == left:
var_name = right.strip()
if "path to save" == left:
var_path = CommonUtil.path_parser(right)

if "download attachment from global"==left:
var_name=right.strip()
if var_path is None:
CommonUtil.ExecLog(sModuleInfo, "Please insert attachment path to download ", 3)
return "zeuz_failed"
Expand Down
14 changes: 11 additions & 3 deletions Framework/Built_In_Automation/Shared_Resources/LocateElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ def Get_Element(step_data_set, driver, query_debug=False, return_all_elements=Fa
if save_parameter != "": # save element to a variable
sr.Set_Shared_Variables(save_parameter, result)
return result # Return on pass
elif result == "zeuz_failed":
try:
if len(generic_driver.find_elements(By.TAG_NAME, "iframe")) > 0:
CommonUtil.ExecLog(sModuleInfo, "You have Iframes in your Webpage. Try switching Iframe with \"Switch Iframe\" action", 3)
elif len(generic_driver.find_elements(By.TAG_NAME, "frame")) > 0:
CommonUtil.ExecLog(sModuleInfo, "You have Frames in your Webpage. Try switching Frame with \"Switch Iframe\" action", 3)
except:
pass
return "zeuz_failed"
except Exception:
return CommonUtil.Exception_Handler(sys.exc_info())
Expand Down Expand Up @@ -786,12 +794,12 @@ def _get_xpath_or_css_element(element_query, css_xpath,data_set, index_number=No

if all_matching_elements_visible_invisible and len(filter_elements(all_matching_elements_visible_invisible, "")) > 0:
break
elif time.time() > end:
if time.time() > end:
break
# end of while loop

if exception_cnd:
return False
return "zeuz_failed"

if driver_type == "appium" and index_number is not None and index_number > 0 and len(all_matching_elements_visible_invisible) == 0:
CommonUtil.ExecLog(sModuleInfo, "Element not found and we do not support Auto Scroll when index is provided", 2)
Expand Down Expand Up @@ -830,7 +838,7 @@ def _get_xpath_or_css_element(element_query, css_xpath,data_set, index_number=No
"To get hidden elements add a row (\"allow hidden\", \"optional option\", \"yes\")",
3
)
return False
return "zeuz_failed"
elif len(all_matching_elements) == 1 and index_number is None:
if hidden_len > 0 and Filter != "allow hidden":
CommonUtil.ExecLog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,14 +777,18 @@ def Go_To_Link(step_data, page_title=False):
driver_id = right.strip()

# checks for capabilities and modifies them by the given step_data
elif mid.strip().lower() == "capability":
elif mid.strip().lower() == "shared capability":
if left.strip().lower() in ("promptbehavior", "alertbehavior"):
if right.strip().lower() in ("accept", "yes", "ok"):
capabilities["unhandledPromptBehavior"] = "accept"

elif right.strip().lower() in ("dismiss", "no", "cancel"):
capabilities["unhandledPromptBehavior"] = "dismiss"

else:
# any other shared capabilities can be added from the selenium document
capabilities[left.strip()] = right.strip()

if not driver_id:
driver_id = "default"

Expand Down
4 changes: 3 additions & 1 deletion Framework/MainDriverApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ def run_test_case(

if not CommonUtil.debug_status: # if normal run, then write log file and cleanup driver instances
CommonUtil.Join_Thread_and_Return_Result("screenshot") # Let the capturing screenshot end in thread
cleanup_driver_instances() # clean up drivers
if shared.Get_Shared_Variables("zeuz_auto_teardown").strip().lower() in ("on", "yes", "true", "ok", "enable"):
cleanup_driver_instances() # clean up drivers
shared.Clean_Up_Shared_Variables() # clean up shared variables
if ConfigModule.get_config_value("RunDefinition", "local_run") == "False":

Expand Down Expand Up @@ -1419,6 +1420,7 @@ def main(device_dict, user_info_object):
rerun_on_fail = ConfigModule.get_config_value("RunDefinition", "rerun_on_fail")
rerun_on_fail = False if rerun_on_fail.lower() == "false" else True
CommonUtil.upload_on_fail, CommonUtil.rerun_on_fail = send_log_file_only_for_fail, rerun_on_fail
shared.Set_Shared_Variables("zeuz_auto_teardown", "on")

all_testcases_info = run_id_info["test_cases"]
TestSetStartTime = time.time()
Expand Down
114 changes: 52 additions & 62 deletions Framework/Utilities/CommonUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,55 +264,55 @@ def Add_File_To_Current_Test_Case_Log(src):

def Exception_Handler(exec_info, temp_q=None, UserMessage=None):
try:
console.print_exception(show_locals=True, max_frames=1)
# sModuleInfo_Local = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME
# exc_type, exc_obj, exc_tb = exec_info
# Error_Type = (
# (str(exc_type).replace("type ", ""))
# .replace("<", "")
# .replace(">", "")
# .replace(";", ":")
# )
# Error_Message = str(exc_obj)
# File_Name = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
# Function_Name = os.path.split(exc_tb.tb_frame.f_code.co_name)[1]
# Line_Number = str(exc_tb.tb_lineno)
# Error_Detail = (
# "Error Type ~ %s: Error Message ~ %s: File Name ~ %s: Function Name ~ %s: Line ~ %s"
# % (Error_Type, Error_Message, File_Name, Function_Name, Line_Number)
# )
# sModuleInfo = Function_Name + ":" + File_Name
# ExecLog(sModuleInfo, "Following exception occurred: %s" % (Error_Detail), 3)
# # TakeScreenShot(Function_Name + "~" + File_Name)
# if UserMessage != None:
# ExecLog(
# sModuleInfo, "Following error message is custom: %s" % (UserMessage), 3
# )
if temp_q != None:
temp_q.put("zeuz_failed")
# console.print_exception(show_locals=True, max_frames=1)
sModuleInfo_Local = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME
exc_type, exc_obj, exc_tb = exec_info
Error_Type = (
(str(exc_type).replace("type ", ""))
.replace("<", "")
.replace(">", "")
.replace(";", ":")
)
Error_Message = str(exc_obj)
File_Name = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
Function_Name = os.path.split(exc_tb.tb_frame.f_code.co_name)[1]
Line_Number = str(exc_tb.tb_lineno)
Error_Detail = (
"Error Type ~ %s: Error Message ~ %s: File Name ~ %s: Function Name ~ %s: Line ~ %s"
% (Error_Type, Error_Message, File_Name, Function_Name, Line_Number)
)
sModuleInfo = Function_Name + ":" + File_Name
ExecLog(sModuleInfo, "Following exception occurred: %s" % (Error_Detail), 3)
# TakeScreenShot(Function_Name + "~" + File_Name)
if UserMessage != None:
ExecLog(
sModuleInfo, "Following error message is custom: %s" % (UserMessage), 3
)
# if temp_q != None:
# temp_q.put("zeuz_failed")

return "zeuz_failed"

except Exception:
# exc_type_local, exc_obj_local, exc_tb_local = sys.exc_info()
# fname_local = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
# Error_Detail_Local = (
# (str(exc_type_local).replace("type ", "Error Type: "))
# + ";"
# + "Error Message: "
# + str(exc_obj_local)
# + ";"
# + "File Name: "
# + fname_local
# + ";"
# + "Line: "
# + str(exc_tb_local.tb_lineno)
# )
# ExecLog(
# sModuleInfo_Local,
# "Following exception occurred: %s" % (Error_Detail_Local),
# 3,
# )
exc_type_local, exc_obj_local, exc_tb_local = sys.exc_info()
fname_local = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
Error_Detail_Local = (
(str(exc_type_local).replace("type ", "Error Type: "))
+ ";"
+ "Error Message: "
+ str(exc_obj_local)
+ ";"
+ "File Name: "
+ fname_local
+ ";"
+ "Line: "
+ str(exc_tb_local.tb_lineno)
)
ExecLog(
sModuleInfo_Local,
"Following exception occurred: %s" % (Error_Detail_Local),
3,
)
return "zeuz_failed"


Expand Down Expand Up @@ -753,8 +753,8 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
r"\/",
r":",
] # Symbols that can't be used in filename
picture_quality = 20 # Quality of picture
picture_size = 800, 600 # Size of image (for reduction in file size)
picture_quality = 100 # Quality of picture
picture_size = 1920, 1080 # Size of image (for reduction in file size)

# Adjust filename and create full path (remove invalid characters, convert spaces to underscore, remove leading and trailing spaces)
trans_table = str.maketrans(
Expand All @@ -773,9 +773,7 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
image.save(ImageName, format="PNG") # Save to disk

# Exit if we don't have a driver yet (happens when Test Step is set to mobile/web, but we haven't setup the driver)
elif Driver == None and (
Method == "mobile" or Method == "web"
):
elif Driver is None and Method in ("mobile", "web"):
ExecLog(
sModuleInfo,
"Can't capture screen, driver not available for type: %s, or invalid driver: %s"
Expand All @@ -786,15 +784,11 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):

# Capture screenshot of web browser
elif Method == "web":
Driver.get_screenshot_as_file(
ImageName
) # Must be .png, otherwise an exception occurs
Driver.get_screenshot_as_file(ImageName) # Must be .png, otherwise an exception occurs

# Capture screenshot of mobile
elif Method == "mobile":
Driver.save_screenshot(
ImageName
) # Must be .png, otherwise an exception occurs
Driver.save_screenshot(ImageName) # Must be .png, otherwise an exception occurs
else:
ExecLog(
sModuleInfo,
Expand All @@ -805,12 +799,8 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
# Lower the picture quality
if os.path.exists(ImageName): # Make sure image was saved
image = Image.open(ImageName) # Re-open in standard format
image.thumbnail(
picture_size, Image.ANTIALIAS
) # Resize picture to lower file size
image.save(
ImageName, format="PNG", quality=picture_quality
) # Change quality to reduce file size
image.thumbnail(picture_size, Image.ANTIALIAS) # Resize picture to lower file size
image.save(ImageName, format="PNG", quality=picture_quality) # Change quality to reduce file size

# Convert image to bytearray and send it to ws for streaming.
image_byte_array = pil_image_to_bytearray(image)
Expand Down
4 changes: 2 additions & 2 deletions Framework/Version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[ZeuZ Python Version]
version = 15.0.0
version = 15.0.4
[Release Date]
date = April 16, 2022
date = May 11, 2022
Loading