Update GUI Apps
This commit is contained in:
parent
18b18f9d8b
commit
e144cecfbf
|
@ -81,7 +81,7 @@ def do_behave_run(
|
|||
if selected_tests[selected_test].get():
|
||||
total_selected_tests += 1
|
||||
|
||||
full_run_command = "behave"
|
||||
full_run_command = "%s -m behave" % sys.executable
|
||||
if total_selected_tests == 0 or total_tests == total_selected_tests:
|
||||
if command_string:
|
||||
full_run_command += " "
|
||||
|
@ -390,7 +390,8 @@ def main():
|
|||
command_string = command_string.replace("--quiet", "")
|
||||
command_string = command_string.replace("-q", "")
|
||||
proc = subprocess.Popen(
|
||||
"behave -d %s --show-source" % command_string,
|
||||
"%s -m behave -d %s --show-source"
|
||||
% (sys.executable, command_string),
|
||||
stdout=subprocess.PIPE,
|
||||
shell=True,
|
||||
)
|
||||
|
|
|
@ -391,7 +391,10 @@ def create_tkinter_gui(tests, command_string):
|
|||
)
|
||||
run_display_2 = "(Tests with existing Case Plans are already checked)"
|
||||
tk.Label(root, text=run_display, fg="blue").pack()
|
||||
tk.Label(root, text=run_display_2, fg="purple").pack()
|
||||
try:
|
||||
tk.Label(root, text=run_display_2, fg="purple").pack()
|
||||
except Exception:
|
||||
tk.Label(root, text=run_display_2, fg="magenta").pack()
|
||||
text_area = ScrolledText(
|
||||
root, width=100, height=12, wrap="word", state=tk.DISABLED
|
||||
)
|
||||
|
@ -465,13 +468,22 @@ def create_tkinter_gui(tests, command_string):
|
|||
).pack()
|
||||
|
||||
tk.Label(root, text="").pack()
|
||||
tk.Button(
|
||||
root,
|
||||
text=(
|
||||
"Generate Summary of existing Case Plans"),
|
||||
fg="teal",
|
||||
command=lambda: view_summary_of_existing_case_plans(root, tests),
|
||||
).pack()
|
||||
try:
|
||||
tk.Button(
|
||||
root,
|
||||
text=(
|
||||
"Generate Summary of existing Case Plans"),
|
||||
fg="teal",
|
||||
command=lambda: view_summary_of_existing_case_plans(root, tests),
|
||||
).pack()
|
||||
except Exception:
|
||||
tk.Button(
|
||||
root,
|
||||
text=(
|
||||
"Generate Summary of existing Case Plans"),
|
||||
fg="green",
|
||||
command=lambda: view_summary_of_existing_case_plans(root, tests),
|
||||
).pack()
|
||||
tk.Label(root, text="\n").pack()
|
||||
|
||||
# Bring form window to front
|
||||
|
@ -515,7 +527,8 @@ def main():
|
|||
print(message)
|
||||
|
||||
proc = subprocess.Popen(
|
||||
'pytest --co -q --rootdir="./" %s' % command_string,
|
||||
'%s -m pytest --collect-only -q --rootdir="./" %s'
|
||||
% (sys.executable, command_string),
|
||||
stdout=subprocess.PIPE,
|
||||
shell=True,
|
||||
)
|
||||
|
|
|
@ -93,7 +93,7 @@ def do_pytest_run(
|
|||
if selected_tests[selected_test].get():
|
||||
total_selected_tests += 1
|
||||
|
||||
full_run_command = "pytest"
|
||||
full_run_command = "%s -m pytest" % sys.executable
|
||||
if total_selected_tests == 0 or total_tests == total_selected_tests:
|
||||
if command_string:
|
||||
full_run_command += " "
|
||||
|
@ -424,7 +424,8 @@ def main():
|
|||
print(message)
|
||||
|
||||
proc = subprocess.Popen(
|
||||
'pytest --co -q --rootdir="./" %s' % command_string,
|
||||
'%s -m pytest --collect-only -q --rootdir="./" %s'
|
||||
% (sys.executable, command_string),
|
||||
stdout=subprocess.PIPE,
|
||||
shell=True,
|
||||
)
|
||||
|
|
|
@ -35,11 +35,6 @@ import shutil
|
|||
import os
|
||||
import sys
|
||||
|
||||
PLATFORM = sys.platform
|
||||
IS_WINDOWS = False
|
||||
if "win32" in PLATFORM or "win64" in PLATFORM or "x64" in PLATFORM:
|
||||
IS_WINDOWS = True
|
||||
|
||||
|
||||
def invalid_run_command(msg=None):
|
||||
exp = " ** mkrec / record / codegen **\n\n"
|
||||
|
@ -87,7 +82,6 @@ def set_colors(use_colors):
|
|||
|
||||
|
||||
def main():
|
||||
platform = sys.platform
|
||||
help_me = False
|
||||
error_msg = None
|
||||
invalid_cmd = None
|
||||
|
@ -99,7 +93,7 @@ def main():
|
|||
force_gui = False
|
||||
rec_behave = False
|
||||
|
||||
if "linux" in platform:
|
||||
if "linux" in sys.platform:
|
||||
use_colors = False
|
||||
c0, c1, c2, c5, c7, cr = set_colors(use_colors)
|
||||
|
||||
|
@ -142,7 +136,7 @@ def main():
|
|||
elif option.lower() == "--edge":
|
||||
use_edge = True
|
||||
elif option.lower() in ("--gui", "--headed"):
|
||||
if "linux" in platform:
|
||||
if "linux" in sys.platform:
|
||||
force_gui = True
|
||||
elif option.lower() in ("--uc", "--undetected", "--undetectable"):
|
||||
use_uc = True
|
||||
|
@ -189,9 +183,11 @@ def main():
|
|||
print(success)
|
||||
run_cmd = None
|
||||
if not start_page:
|
||||
run_cmd = "pytest %s --rec -q -s" % file_name
|
||||
run_cmd = "%s -m pytest %s --rec -q -s" % (sys.executable, file_name)
|
||||
else:
|
||||
run_cmd = "pytest %s --rec -q -s --url=%s" % (file_name, start_page)
|
||||
run_cmd = "%s -m pytest %s --rec -q -s --url=%s" % (
|
||||
sys.executable, file_name, start_page
|
||||
)
|
||||
if use_edge:
|
||||
run_cmd += " --edge"
|
||||
if force_gui:
|
||||
|
@ -200,8 +196,6 @@ def main():
|
|||
run_cmd += " --uc"
|
||||
if rec_behave:
|
||||
run_cmd += " --rec-behave"
|
||||
if IS_WINDOWS:
|
||||
run_cmd = "python.exe -m %s" % run_cmd
|
||||
print(run_cmd)
|
||||
os.system(run_cmd)
|
||||
if os.path.exists(file_path):
|
||||
|
@ -209,9 +203,7 @@ def main():
|
|||
recorded_filename = file_name[:-3] + "_rec.py"
|
||||
recordings_dir = os.path.join(dir_name, "recordings")
|
||||
recorded_file = os.path.join(recordings_dir, recorded_filename)
|
||||
prefix = ""
|
||||
if IS_WINDOWS:
|
||||
prefix = "python.exe -m "
|
||||
prefix = "%s -m " % sys.executable
|
||||
if " " not in recorded_file:
|
||||
os.system("%sseleniumbase print %s -n" % (prefix, recorded_file))
|
||||
elif '"' not in recorded_file:
|
||||
|
|
|
@ -21,10 +21,6 @@ import sys
|
|||
from seleniumbase import config as sb_config
|
||||
from seleniumbase.fixtures import page_utils
|
||||
|
||||
PLATFORM = sys.platform
|
||||
IS_WINDOWS = False
|
||||
if "win32" in PLATFORM or "win64" in PLATFORM or "x64" in PLATFORM:
|
||||
IS_WINDOWS = True
|
||||
sb_config.rec_subprocess_p = None
|
||||
sb_config.rec_subprocess_used = False
|
||||
if sys.version_info <= (3, 7):
|
||||
|
@ -134,9 +130,10 @@ def do_recording(file_name, url, overwrite_enabled, use_chrome, window):
|
|||
or "--gherkin" in command_args
|
||||
):
|
||||
add_on = " --rec-behave"
|
||||
command = "seleniumbase mkrec %s --url=%s --gui" % (file_name, url)
|
||||
if IS_WINDOWS:
|
||||
command = "python.exe -m %s" % command
|
||||
command = (
|
||||
"%s -m seleniumbase mkrec %s --url=%s --gui"
|
||||
% (sys.executable, file_name, url)
|
||||
)
|
||||
if not use_chrome:
|
||||
command += " --edge"
|
||||
if (
|
||||
|
@ -171,9 +168,7 @@ def do_playback(file_name, use_chrome, window, demo_mode=False):
|
|||
'File "%s" does not exist in the current directory!' % file_name,
|
||||
)
|
||||
return
|
||||
command = "pytest %s -q -s" % file_name
|
||||
if IS_WINDOWS:
|
||||
command = "python.exe -m %s" % command
|
||||
command = "%s -m pytest %s -q -s" % (sys.executable, file_name)
|
||||
if "linux" in sys.platform:
|
||||
command += " --gui"
|
||||
if not use_chrome:
|
||||
|
@ -248,14 +243,24 @@ def create_tkinter_gui():
|
|||
).pack()
|
||||
tk.Label(window, text="").pack()
|
||||
tk.Label(window, text="Playback recording (Demo Mode):").pack()
|
||||
tk.Button(
|
||||
window,
|
||||
text="Playback (Demo Mode)",
|
||||
fg="teal",
|
||||
command=lambda: do_playback(
|
||||
fname.get(), cbb.get(), window, demo_mode=True
|
||||
),
|
||||
).pack()
|
||||
try:
|
||||
tk.Button(
|
||||
window,
|
||||
text="Playback (Demo Mode)",
|
||||
fg="teal",
|
||||
command=lambda: do_playback(
|
||||
fname.get(), cbb.get(), window, demo_mode=True
|
||||
),
|
||||
).pack()
|
||||
except Exception:
|
||||
tk.Button(
|
||||
window,
|
||||
text="Playback (Demo Mode)",
|
||||
fg="blue",
|
||||
command=lambda: do_playback(
|
||||
fname.get(), cbb.get(), window, demo_mode=True
|
||||
),
|
||||
).pack()
|
||||
|
||||
# Bring form window to front
|
||||
send_window_to_front(window)
|
||||
|
|
Loading…
Reference in New Issue