Skip to content

Commit b874bd4

Browse files
authored
Merge pull request #299 from riz-hossain/allow_hidden
Allow hidden
2 parents d410da3 + ccefd0a commit b874bd4

File tree

10 files changed

+216
-181
lines changed

10 files changed

+216
-181
lines changed

Framework/Built_In_Automation/Desktop/CrossPlatform/BuiltInFunctions.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ def Enter_Text(data_set):
226226
0,
227227
)
228228

229-
CommonUtil.TakeScreenShot(
230-
sModuleInfo
231-
) # Capture screenshot, if settings allow for it
229+
# CommonUtil.TakeScreenShot(
230+
# sModuleInfo
231+
# ) # Capture screenshot, if settings allow for it
232232

233233
# Enter text
234234
gui.typewrite(text_value)
@@ -549,9 +549,9 @@ def close_program(data_set):
549549
)
550550
return "failed"
551551

552-
CommonUtil.TakeScreenShot(
553-
sModuleInfo
554-
) # Capture screenshot, if settings allow for it
552+
# CommonUtil.TakeScreenShot(
553+
# sModuleInfo
554+
# ) # Capture screenshot, if settings allow for it
555555

556556
# Check result
557557
if close_status in failed_tag_list:
@@ -645,9 +645,9 @@ def Click_Element(data_set):
645645
elif cmd == "doubleclick":
646646
result = gui.doubleClick(x, y) # Double click
647647

648-
CommonUtil.TakeScreenShot(
649-
sModuleInfo
650-
) # Capture screenshot, if settings allow for it
648+
# CommonUtil.TakeScreenShot(
649+
# sModuleInfo
650+
# ) # Capture screenshot, if settings allow for it
651651

652652
# Check result and return
653653
if result in failed_tag_list:
@@ -698,9 +698,9 @@ def check_for_element(data_set):
698698
)
699699
element = LocateElement.Get_Element(data_set, gui) # (x, y, w, h)
700700

701-
CommonUtil.TakeScreenShot(
702-
sModuleInfo
703-
) # Capture screenshot, if settings allow for it
701+
# CommonUtil.TakeScreenShot(
702+
# sModuleInfo
703+
# ) # Capture screenshot, if settings allow for it
704704

705705
if element in failed_tag_list:
706706
CommonUtil.ExecLog(sModuleInfo, "Element not found", 3)
@@ -796,9 +796,9 @@ def launch_program(data_set):
796796
)
797797
return "failed"
798798

799-
CommonUtil.TakeScreenShot(
800-
sModuleInfo
801-
) # Capture screenshot, if settings allow for it
799+
# CommonUtil.TakeScreenShot(
800+
# sModuleInfo
801+
# ) # Capture screenshot, if settings allow for it
802802

803803
# Check result and return
804804
if launch_status in failed_tag_list:
@@ -932,9 +932,9 @@ def Drag_Element(data_set):
932932
dst_x, dst_y, 2, button="left"
933933
) # Click and drag to destination, taking two seconds, then release - the 2 seconds is important for some drags because without the time, it happens too fast and the drag command is missed by the window manager
934934

935-
CommonUtil.TakeScreenShot(
936-
sModuleInfo
937-
) # Capture screenshot, if settings allow for it
935+
# CommonUtil.TakeScreenShot(
936+
# sModuleInfo
937+
# ) # Capture screenshot, if settings allow for it
938938

939939
# Check result and return
940940
if result in failed_tag_list:
@@ -1035,9 +1035,9 @@ def navigate_listbox(data_set):
10351035
)
10361036
return "passed"
10371037

1038-
CommonUtil.TakeScreenShot(
1039-
sModuleInfo
1040-
) # Capture screenshot, if settings allow for it
1038+
# CommonUtil.TakeScreenShot(
1039+
# sModuleInfo
1040+
# ) # Capture screenshot, if settings allow for it
10411041

10421042
CommonUtil.ExecLog(
10431043
sModuleInfo, "Could not locate element after %d attempts" % max_tries, 3

Framework/Built_In_Automation/Desktop/Windows/BuiltInFunctions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def go_to_desktop(data_set):
7777
return "failed"
7878
try:
7979
result = Click_Element_None_Mouse(Element, None, True, None, None)
80-
CommonUtil.TakeScreenShot(sModuleInfo)
80+
# CommonUtil.TakeScreenShot(sModuleInfo)
8181
if result in failed_tag_list:
8282
CommonUtil.ExecLog(sModuleInfo, "Could not click element", 3)
8383
return "failed"
@@ -173,7 +173,7 @@ def Click_Element(data_set):
173173
sModuleInfo, "Element was located. Performing action provided ", 1
174174
)
175175
result = Click_Element_None_Mouse(Element, expand, invoke, select, toggle)
176-
CommonUtil.TakeScreenShot(sModuleInfo)
176+
# CommonUtil.TakeScreenShot(sModuleInfo)
177177
if result in failed_tag_list:
178178
CommonUtil.ExecLog(sModuleInfo, "Could not click element", 3)
179179
return "failed"
@@ -1488,9 +1488,9 @@ def Keystroke_For_Element(data_set):
14881488
try:
14891489
if keystroke_char != False:
14901490
pyautogui.write(keystroke_char)
1491-
CommonUtil.TakeScreenShot(
1492-
sModuleInfo
1493-
) # Capture screenshot, if settings allow for it
1491+
# CommonUtil.TakeScreenShot(
1492+
# sModuleInfo
1493+
# ) # Capture screenshot, if settings allow for it
14941494

14951495
CommonUtil.ExecLog(
14961496
sModuleInfo,
@@ -1515,9 +1515,9 @@ def Keystroke_For_Element(data_set):
15151515
for i in range(count):
15161516
gui.hotkey(*keys) # Send keypress (as individual values using the asterisk)
15171517

1518-
CommonUtil.TakeScreenShot(
1519-
sModuleInfo
1520-
) # Capture screenshot, if settings allow for it
1518+
# CommonUtil.TakeScreenShot(
1519+
# sModuleInfo
1520+
# ) # Capture screenshot, if settings allow for it
15211521

15221522
CommonUtil.ExecLog(sModuleInfo, "Successfully entered keystroke", 1)
15231523
return "passed"

Framework/Built_In_Automation/Mobile/CrossPlatform/Appium/BuiltInFunctions.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ def launch_application(data_set):
620620
CommonUtil.ExecLog(sModuleInfo, "Launching %s" % package_name, 0)
621621
if launch_app: # if ios simulator then no need to launch app again
622622
appium_driver.launch_app() # Launch program configured in the Appium capabilities
623-
CommonUtil.TakeScreenShot(
624-
sModuleInfo
625-
) # Capture screenshot, if settings allow for it
623+
# CommonUtil.TakeScreenShot(
624+
# sModuleInfo
625+
# ) # Capture screenshot, if settings allow for it
626626
CommonUtil.ExecLog(sModuleInfo, "Launched the application successfully.", 1)
627627
return "passed"
628628
except Exception:
@@ -1309,9 +1309,9 @@ def Swipe(x_start, y_start, x_end, y_end, duration=1000, adb=False):
13091309
x_start, y_start, x_end, y_end, duration
13101310
) # Use Appium to swipe by default
13111311

1312-
CommonUtil.TakeScreenShot(
1313-
sModuleInfo
1314-
) # Capture screenshot, if settings allow for it
1312+
# CommonUtil.TakeScreenShot(
1313+
# sModuleInfo
1314+
# ) # Capture screenshot, if settings allow for it
13151315
return "passed"
13161316
except Exception:
13171317
errMsg = "Unable to swipe."
@@ -2075,7 +2075,7 @@ def Click_Element_Appium(data_set):
20752075
return "passed"
20762076

20772077
except:
2078-
CommonUtil.TakeScreenShot(sModuleInfo)
2078+
# CommonUtil.TakeScreenShot(sModuleInfo)
20792079
CommonUtil.ExecLog(
20802080
sModuleInfo,
20812081
"Element is enabled. Unable to tap based on offset.",
@@ -2094,7 +2094,7 @@ def Click_Element_Appium(data_set):
20942094
else:
20952095
try:
20962096
Element.click()
2097-
CommonUtil.TakeScreenShot(sModuleInfo)
2097+
# CommonUtil.TakeScreenShot(sModuleInfo)
20982098
CommonUtil.ExecLog(
20992099
sModuleInfo,
21002100
"Successfully clicked the element with given parameters and values",
@@ -2122,7 +2122,7 @@ def Click_Element_Appium(data_set):
21222122
return CommonUtil.Exception_Handler(sys.exc_info(), None, errMsg)
21232123

21242124
else:
2125-
CommonUtil.TakeScreenShot(sModuleInfo)
2125+
# CommonUtil.TakeScreenShot(sModuleInfo)
21262126
CommonUtil.ExecLog(sModuleInfo, "Element not enabled. Unable to click.", 3)
21272127
if context_switched == True:
21282128
CommonUtil.ExecLog(
@@ -2224,7 +2224,7 @@ def Tap_Appium(data_set):
22242224
return "passed"
22252225

22262226
except:
2227-
CommonUtil.TakeScreenShot(sModuleInfo)
2227+
# CommonUtil.TakeScreenShot(sModuleInfo)
22282228
CommonUtil.ExecLog(
22292229
sModuleInfo,
22302230
"Element is enabled. Unable to tap based on offset.",
@@ -2240,7 +2240,7 @@ def Tap_Appium(data_set):
22402240
)
22412241
return "passed"
22422242
else:
2243-
CommonUtil.TakeScreenShot(sModuleInfo)
2243+
# CommonUtil.TakeScreenShot(sModuleInfo)
22442244
CommonUtil.ExecLog(
22452245
sModuleInfo, "Element not enabled. Unable to click.", 3
22462246
)
@@ -2284,7 +2284,7 @@ def Double_Tap_Appium(data_set):
22842284
)
22852285
return "passed"
22862286
else:
2287-
CommonUtil.TakeScreenShot(sModuleInfo)
2287+
# CommonUtil.TakeScreenShot(sModuleInfo)
22882288
CommonUtil.ExecLog(
22892289
sModuleInfo, "Element not enabled. Unable to click.", 3
22902290
)
@@ -2327,7 +2327,7 @@ def Long_Press_Appium(data_set):
23272327
)
23282328
return "passed"
23292329
else:
2330-
CommonUtil.TakeScreenShot(sModuleInfo)
2330+
# CommonUtil.TakeScreenShot(sModuleInfo)
23312331
CommonUtil.ExecLog(
23322332
sModuleInfo, "Element not enabled. Unable to click.", 3
23332333
)
@@ -2589,7 +2589,7 @@ def Pickerwheel_Appium(data_set):
25892589
# Complete the action
25902590
try:
25912591
# appium_driver.hide_keyboard() # Remove keyboard
2592-
CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
2592+
# CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
25932593
CommonUtil.ExecLog(
25942594
sModuleInfo,
25952595
"Successfully set the value of to text to: %s" % text_value,
@@ -2671,17 +2671,17 @@ def Clear_And_Enter_Text_ADB(data_set, serial=""):
26712671
result = "failed"
26722672

26732673
if result in passed_tag_list:
2674-
CommonUtil.TakeScreenShot(sModuleInfo)
2674+
# CommonUtil.TakeScreenShot(sModuleInfo)
26752675
CommonUtil.ExecLog(
26762676
sModuleInfo, "Successfully entered text with adb shell", 1
26772677
)
26782678
appium_driver.hide_keyboard() # Remove keyboard
2679-
CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
2679+
# CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
26802680
CommonUtil.ExecLog(sModuleInfo, "Successfully hid keyboard", 1)
26812681

26822682
return "passed"
26832683
else:
2684-
CommonUtil.TakeScreenShot(sModuleInfo)
2684+
# CommonUtil.TakeScreenShot(sModuleInfo)
26852685
CommonUtil.ExecLog(sModuleInfo, "Could not text with adb shell", 3)
26862686
return "failed"
26872687

@@ -2755,7 +2755,7 @@ def Clear_And_Enter_Text_Appium(data_set):
27552755
# Complete the action
27562756
try:
27572757
# appium_driver.hide_keyboard() # Remove keyboard
2758-
CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
2758+
# CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
27592759
CommonUtil.ExecLog(
27602760
sModuleInfo,
27612761
"Successfully set the value of to text to: %s" % text_value,
@@ -2794,7 +2794,7 @@ def Hide_Keyboard(data_set):
27942794
try:
27952795
if appium_driver.is_keyboard_shown():
27962796
appium_driver.hide_keyboard() # Remove keyboard
2797-
CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
2797+
# CommonUtil.TakeScreenShot(sModuleInfo) # Capture screen
27982798
return "passed"
27992799
except Exception:
28002800
errMsg = "Unable to hide your keyboard"
@@ -2967,15 +2967,15 @@ def Keystroke_Appium(data_set):
29672967
result = "failed"
29682968

29692969
if result in passed_tag_list:
2970-
CommonUtil.TakeScreenShot(sModuleInfo)
2970+
# CommonUtil.TakeScreenShot(sModuleInfo)
29712971
CommonUtil.ExecLog(
29722972
sModuleInfo,
29732973
"Successfully entered keystroke for the element with given parameters and values",
29742974
1,
29752975
)
29762976
return "passed"
29772977
else:
2978-
CommonUtil.TakeScreenShot(sModuleInfo)
2978+
# CommonUtil.TakeScreenShot(sModuleInfo)
29792979
CommonUtil.ExecLog(
29802980
sModuleInfo,
29812981
"Could not enter keystroke for the element with given parameters and values",

Framework/Built_In_Automation/Sequential_Actions/action_declarations/selenium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{ "name": "navigate", "function": "Navigate", "screenshot": "web" },
2626
{ "name": "get location", "function": "get_location_of_element", "screenshot": "web" },
2727
{ "name": "validate table", "function": "validate_table", "screenshot": "web" },
28-
{ "name": "handle alert", "function": "Handle_Browser_Alert", "screenshot": "desktop" },
28+
{ "name": "handle alert", "function": "Handle_Browser_Alert", "screenshot": "web" },
2929
{ "name": "browser", "function": "Open_Browser_Wrapper", "screenshot": "web" },
3030
{ "name": "teardown", "function": "Tear_Down_Selenium", "screenshot": "web" },
3131
{ "name": "open new tab", "function": "open_new_tab", "screenshot": "web" },

Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,12 +1923,12 @@ def Action_Handler(_data_set, action_row):
19231923
0,
19241924
)
19251925

1926-
sr.Set_Shared_Variables(
1927-
"screen_capture", screenshot.lower().strip()
1928-
) # Save the screen capture type
1929-
CommonUtil.set_screenshot_vars(
1930-
sr.Shared_Variable_Export()
1931-
) # Get all the shared variables, and pass them to CommonUtil
1926+
# sr.Set_Shared_Variables(
1927+
# "screen_capture", screenshot.lower().strip()
1928+
# ) # Save the screen capture type
1929+
# CommonUtil.set_screenshot_vars(
1930+
# sr.Shared_Variable_Export()
1931+
# ) # Get all the shared variables, and pass them to CommonUtil
19321932

19331933
if (
19341934
module in failed_tag_list or module == "" or function == ""
@@ -1963,6 +1963,9 @@ def Action_Handler(_data_set, action_row):
19631963
data_set = []
19641964
for row in _data_set:
19651965
new_row = list(row)
1966+
if "optional parameter" in row[1] and "screen capture" == row[0].strip().lower():
1967+
screenshot = row[2].strip().lower()
1968+
continue
19661969
if "optional" in row[1]:
19671970
new_row[1] = new_row[1].replace("optional", "").strip()
19681971
if "bypass" in row[1]:
@@ -1973,6 +1976,9 @@ def Action_Handler(_data_set, action_row):
19731976
new_row[1] = new_row[1].replace(original_module, "").strip()
19741977
data_set.append(tuple(new_row))
19751978

1979+
sr.Set_Shared_Variables("screen_capture", screenshot.lower().strip())
1980+
CommonUtil.set_screenshot_vars(sr.Shared_Variable_Export())
1981+
19761982
# Convert shared variables to their string equivelent
19771983
if action_name not in skip_conversion_of_shared_variable_for_actions:
19781984
data_set = common.shared_variable_to_value(data_set)
@@ -1992,6 +1998,7 @@ def Action_Handler(_data_set, action_row):
19921998
result = run_function(
19931999
data_set
19942000
) # Execute function, providing all rows in the data set
2001+
CommonUtil.TakeScreenShot(function)
19952002
return result # Return result to sequential_actions()
19962003

19972004
except Exception:

0 commit comments

Comments
 (0)