Merge pull request #1863 from seleniumbase/gui-colors-and-fixes
GUI colors and fixes
This commit is contained in:
commit
dc6fb95b68
|
@ -180,8 +180,8 @@ class HackTests(BaseCase):
|
|||
self.highlight("#ctitle", loops=7, scroll=False)
|
||||
|
||||
self.open("https://www.nintendo.com/whatsnew/")
|
||||
self.set_text_content("h2", aybabtu)
|
||||
self.highlight("h2", loops=10, scroll=False)
|
||||
self.set_text_content("#main h2", aybabtu)
|
||||
self.highlight("#main h2", loops=10, scroll=False)
|
||||
|
||||
if not self.headless:
|
||||
self.open("https://support.gog.com/hc/en-us?product=gog")
|
||||
|
|
|
@ -546,6 +546,8 @@ self.set_default_timeout(timeout)
|
|||
|
||||
self.reset_default_timeout()
|
||||
|
||||
self.fail(msg=None)
|
||||
|
||||
self.skip(reason="")
|
||||
|
||||
############
|
||||
|
|
|
@ -36,8 +36,8 @@ urllib3==1.26.12;python_version<"3.7"
|
|||
urllib3==1.26.15;python_version>="3.7"
|
||||
requests==2.27.1;python_version<"3.7"
|
||||
requests==2.29.0;python_version>="3.7"
|
||||
requests-toolbelt==0.10.1
|
||||
pynose==1.4.2
|
||||
requests-toolbelt==1.0.0
|
||||
pynose==1.4.3
|
||||
sniffio==1.3.0;python_version>="3.7"
|
||||
h11==0.14.0;python_version>="3.7"
|
||||
outcome==1.2.0;python_version>="3.7"
|
||||
|
@ -105,7 +105,7 @@ rich==13.3.5;python_version>="3.7"
|
|||
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
|
||||
|
||||
coverage==6.2;python_version<"3.7"
|
||||
coverage==7.2.4;python_version>="3.7"
|
||||
coverage==7.2.5;python_version>="3.7"
|
||||
pytest-cov==4.0.0
|
||||
flake8==5.0.4;python_version<"3.9"
|
||||
flake8==6.0.0;python_version>="3.9"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# seleniumbase package
|
||||
__version__ = "4.14.4"
|
||||
__version__ = "4.14.5"
|
||||
|
|
|
@ -256,7 +256,7 @@ def create_tkinter_gui(tests, command_string, t_count, f_count, s_tests):
|
|||
if t_count == 1:
|
||||
run_display = "Only ONE TEST was found and will be run:"
|
||||
tests = s_tests
|
||||
tk.Label(root, text=run_display, fg="blue").pack()
|
||||
tk.Label(root, text=run_display, bg="yellow", fg="magenta").pack()
|
||||
text_area = ScrolledText(
|
||||
root, width=100, height=12, wrap="word", state=tk.DISABLED
|
||||
)
|
||||
|
@ -271,7 +271,8 @@ def create_tkinter_gui(tests, command_string, t_count, f_count, s_tests):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="teal",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
variable=ara[count],
|
||||
|
@ -280,7 +281,8 @@ def create_tkinter_gui(tests, command_string, t_count, f_count, s_tests):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="teal",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
borderwidth=0,
|
||||
|
@ -297,7 +299,7 @@ def create_tkinter_gui(tests, command_string, t_count, f_count, s_tests):
|
|||
tk.Label(
|
||||
root,
|
||||
text='Additional "behave" Options: (Eg. "-D incognito --junit")',
|
||||
fg="blue",
|
||||
bg="yellow", fg="blue",
|
||||
).pack()
|
||||
entry = tk.Entry(root, textvariable=aopts)
|
||||
entry.pack()
|
||||
|
@ -326,6 +328,7 @@ def create_tkinter_gui(tests, command_string, t_count, f_count, s_tests):
|
|||
root,
|
||||
text="Run Selected Tests",
|
||||
fg="green",
|
||||
bg="gray",
|
||||
command=lambda: do_behave_run(
|
||||
root,
|
||||
tests,
|
||||
|
|
|
@ -390,11 +390,8 @@ def create_tkinter_gui(tests, command_string):
|
|||
"(Boilerplate Case Plans will be generated as needed)"
|
||||
)
|
||||
run_display_2 = "(Tests with existing Case Plans are already checked)"
|
||||
tk.Label(root, text=run_display, fg="blue").pack()
|
||||
try:
|
||||
tk.Label(root, text=run_display_2, fg="purple").pack()
|
||||
except Exception:
|
||||
tk.Label(root, text=run_display_2, fg="magenta").pack()
|
||||
tk.Label(root, text=run_display, bg="yellow", fg="green").pack()
|
||||
tk.Label(root, text=run_display_2, bg="yellow", fg="magenta").pack()
|
||||
text_area = ScrolledText(
|
||||
root, width=100, height=12, wrap="word", state=tk.DISABLED
|
||||
)
|
||||
|
@ -411,7 +408,8 @@ def create_tkinter_gui(tests, command_string):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="green",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
variable=ara[count],
|
||||
|
@ -420,7 +418,8 @@ def create_tkinter_gui(tests, command_string):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="green",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
borderwidth=0,
|
||||
|
@ -471,16 +470,14 @@ def create_tkinter_gui(tests, command_string):
|
|||
try:
|
||||
tk.Button(
|
||||
root,
|
||||
text=(
|
||||
"Generate Summary of existing Case Plans"),
|
||||
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"),
|
||||
text=("Generate Summary of existing Case Plans"),
|
||||
fg="green",
|
||||
command=lambda: view_summary_of_existing_case_plans(root, tests),
|
||||
).pack()
|
||||
|
|
|
@ -291,7 +291,7 @@ def create_tkinter_gui(tests, command_string, files, solo_tests):
|
|||
% (len(solo_tests))
|
||||
)
|
||||
tests = solo_tests
|
||||
tk.Label(root, text=run_display, fg="blue").pack()
|
||||
tk.Label(root, text=run_display, bg="yellow", fg="magenta").pack()
|
||||
text_area = ScrolledText(
|
||||
root, width=100, height=12, wrap="word", state=tk.DISABLED
|
||||
)
|
||||
|
@ -306,7 +306,8 @@ def create_tkinter_gui(tests, command_string, files, solo_tests):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="green",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
variable=ara[count],
|
||||
|
@ -315,7 +316,8 @@ def create_tkinter_gui(tests, command_string, files, solo_tests):
|
|||
cb = tk.Checkbutton(
|
||||
text_area,
|
||||
text=(row),
|
||||
bg="white",
|
||||
bg="green",
|
||||
fg="yellow",
|
||||
anchor="w",
|
||||
pady=0,
|
||||
borderwidth=0,
|
||||
|
@ -332,7 +334,7 @@ def create_tkinter_gui(tests, command_string, files, solo_tests):
|
|||
tk.Label(
|
||||
root,
|
||||
text='Additional "pytest" Options: (Eg. "--incognito --slow")',
|
||||
fg="blue",
|
||||
bg="yellow", fg="blue",
|
||||
).pack()
|
||||
entry = tk.Entry(root, textvariable=aopts)
|
||||
entry.pack()
|
||||
|
@ -363,6 +365,7 @@ def create_tkinter_gui(tests, command_string, files, solo_tests):
|
|||
root,
|
||||
text="Run Selected Tests",
|
||||
fg="green",
|
||||
bg="gray",
|
||||
command=lambda: do_pytest_run(
|
||||
root,
|
||||
tests,
|
||||
|
|
|
@ -307,6 +307,7 @@ class BaseCase(unittest.TestCase):
|
|||
pass # Odd issue where the open did happen. Continue.
|
||||
else:
|
||||
raise
|
||||
unittest.has_exception = False
|
||||
if (
|
||||
self.undetectable
|
||||
or (
|
||||
|
@ -4119,6 +4120,7 @@ class BaseCase(unittest.TestCase):
|
|||
and settings.SKIP_JS_WAITS
|
||||
):
|
||||
time.sleep(0.05)
|
||||
unittest.has_exception = False
|
||||
return True
|
||||
|
||||
def wait_for_angularjs(self, timeout=None, **kwargs):
|
||||
|
@ -6360,12 +6362,14 @@ class BaseCase(unittest.TestCase):
|
|||
)
|
||||
if type(page) is int:
|
||||
if text not in pdf_text:
|
||||
unittest.has_exception = True
|
||||
raise Exception(
|
||||
"PDF [%s] is missing expected text [%s] on "
|
||||
"page [%s]!" % (pdf, text, page)
|
||||
)
|
||||
else:
|
||||
if text not in pdf_text:
|
||||
unittest.has_exception = True
|
||||
raise Exception(
|
||||
"PDF [%s] is missing expected text [%s]!" % (pdf, text)
|
||||
)
|
||||
|
@ -6740,40 +6744,52 @@ class BaseCase(unittest.TestCase):
|
|||
def assert_true(self, expr, msg=None):
|
||||
"""Asserts that the expression is True.
|
||||
Will raise an exception if the statement if False."""
|
||||
unittest.has_exception = True
|
||||
self.assertTrue(expr, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_false(self, expr, msg=None):
|
||||
"""Asserts that the expression is False.
|
||||
Will raise an exception if the statement if True."""
|
||||
unittest.has_exception = True
|
||||
self.assertFalse(expr, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_equal(self, first, second, msg=None):
|
||||
"""Asserts that the two values are equal.
|
||||
Will raise an exception if the values are not equal."""
|
||||
unittest.has_exception = True
|
||||
self.assertEqual(first, second, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_not_equal(self, first, second, msg=None):
|
||||
"""Asserts that the two values are not equal.
|
||||
Will raise an exception if the values are equal."""
|
||||
unittest.has_exception = True
|
||||
self.assertNotEqual(first, second, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_in(self, first, second, msg=None):
|
||||
"""Asserts that the first string is in the second string.
|
||||
Will raise an exception if the first string is not in the second."""
|
||||
unittest.has_exception = True
|
||||
self.assertIn(first, second, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_not_in(self, first, second, msg=None):
|
||||
"""Asserts that the first string is not in the second string.
|
||||
Will raise an exception if the first string is in the second string."""
|
||||
unittest.has_exception = True
|
||||
self.assertNotIn(first, second, msg=msg)
|
||||
unittest.has_exception = False
|
||||
|
||||
def assert_raises(self, *args, **kwargs):
|
||||
"""Asserts that the following block of code raises an exception.
|
||||
Will raise an exception if the block of code has no exception.
|
||||
Usage Example =>
|
||||
# Verify that the expected exception is raised.
|
||||
with self.assert_raises(Exception):
|
||||
raise Exception("Expected Exception!") """
|
||||
# Verify that the expected exception is raised.
|
||||
with self.assert_raises(Exception):
|
||||
raise Exception("Expected Exception!") """
|
||||
return self.assertRaises(*args, **kwargs)
|
||||
|
||||
def wait_for_attribute(
|
||||
|
@ -6884,9 +6900,11 @@ class BaseCase(unittest.TestCase):
|
|||
self.wait_for_ready_state_complete()
|
||||
time.sleep(2)
|
||||
actual = self.get_page_title().strip()
|
||||
unittest.has_exception = True
|
||||
self.assertEqual(
|
||||
expected, actual, error % (expected, actual)
|
||||
)
|
||||
unittest.has_exception = False
|
||||
if self.demo_mode and not self.recorder_mode:
|
||||
a_t = "ASSERT TITLE"
|
||||
if self._language != "English":
|
||||
|
@ -6931,9 +6949,11 @@ class BaseCase(unittest.TestCase):
|
|||
self.wait_for_ready_state_complete()
|
||||
time.sleep(2)
|
||||
actual = self.get_page_title().strip()
|
||||
unittest.has_exception = True
|
||||
self.assertIn(
|
||||
expected, actual, error % (expected, actual)
|
||||
)
|
||||
unittest.has_exception = False
|
||||
if self.demo_mode and not self.recorder_mode:
|
||||
a_t = "ASSERT TITLE CONTAINS"
|
||||
if self._language != "English":
|
||||
|
@ -6968,7 +6988,9 @@ class BaseCase(unittest.TestCase):
|
|||
self.wait_for_ready_state_complete()
|
||||
time.sleep(2)
|
||||
actual = self.get_current_url().strip()
|
||||
unittest.has_exception = True
|
||||
self.assertEqual(expected, actual, error % (expected, actual))
|
||||
unittest.has_exception = False
|
||||
if self.demo_mode and not self.recorder_mode:
|
||||
a_u = "ASSERT URL"
|
||||
if self._language != "English":
|
||||
|
@ -7006,7 +7028,9 @@ class BaseCase(unittest.TestCase):
|
|||
self.wait_for_ready_state_complete()
|
||||
time.sleep(2)
|
||||
actual = self.get_current_url().strip()
|
||||
unittest.has_exception = True
|
||||
self.assertIn(expected, actual, error % (expected, actual))
|
||||
unittest.has_exception = False
|
||||
if self.demo_mode and not self.recorder_mode:
|
||||
a_u = "ASSERT URL CONTAINS"
|
||||
if self._language != "English":
|
||||
|
@ -7103,6 +7127,7 @@ class BaseCase(unittest.TestCase):
|
|||
er_str = str(errors)
|
||||
er_str = er_str.replace("[{", "[\n{").replace("}, {", "},\n{")
|
||||
current_url = self.get_current_url()
|
||||
unittest.has_exception = True
|
||||
raise Exception(
|
||||
"JavaScript errors found on %s => %s" % (current_url, er_str)
|
||||
)
|
||||
|
@ -7656,6 +7681,12 @@ class BaseCase(unittest.TestCase):
|
|||
sb_config._is_timeout_changed = False
|
||||
self.__overrided_default_timeouts = False
|
||||
|
||||
def fail(self, msg=None):
|
||||
"""Fail immediately, with the given message."""
|
||||
unittest.has_exception = True
|
||||
super().fail(msg)
|
||||
raise self.failureException(msg)
|
||||
|
||||
def skip(self, reason=""):
|
||||
"""Mark the test as Skipped."""
|
||||
self.__check_scope()
|
||||
|
@ -9806,6 +9837,7 @@ class BaseCase(unittest.TestCase):
|
|||
|
||||
def __check_scope(self):
|
||||
if hasattr(self, "browser"): # self.browser stores the type of browser
|
||||
unittest.has_exception = False
|
||||
return # All good: setUp() already initialized variables in "self"
|
||||
else:
|
||||
message = (
|
||||
|
@ -9821,6 +9853,7 @@ class BaseCase(unittest.TestCase):
|
|||
"\n variables, which are initialized during the setUp() method"
|
||||
"\n that runs automatically before all tests called by pytest."
|
||||
)
|
||||
unittest.has_exception = True
|
||||
raise OutOfScopeException(message)
|
||||
|
||||
############
|
||||
|
@ -10076,6 +10109,7 @@ class BaseCase(unittest.TestCase):
|
|||
if print_only:
|
||||
print(exception_output)
|
||||
else:
|
||||
unittest.has_exception = True
|
||||
raise Exception(exception_output.replace("\\n", "\n"))
|
||||
|
||||
############
|
||||
|
@ -13868,6 +13902,8 @@ class BaseCase(unittest.TestCase):
|
|||
# Some actions such as hover-clicking are different on mobile.
|
||||
self.mobile_emulator = False
|
||||
|
||||
unittest.has_exception = False
|
||||
|
||||
# Configure the test time limit (if used).
|
||||
self.set_time_limit(self.time_limit)
|
||||
|
||||
|
@ -14152,6 +14188,8 @@ class BaseCase(unittest.TestCase):
|
|||
has_exception = sys.exc_info()[1] is not None
|
||||
if self.__will_be_skipped and hasattr(self, "_using_sb_fixture"):
|
||||
has_exception = False
|
||||
if python3_11_or_newer and unittest.has_exception:
|
||||
has_exception = True
|
||||
return has_exception
|
||||
|
||||
def __get_test_id(self):
|
||||
|
|
|
@ -23,6 +23,7 @@ By.PARTIAL_LINK_TEXT # "partial link text"
|
|||
import codecs
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
from selenium.common.exceptions import ElementNotInteractableException
|
||||
from selenium.common.exceptions import ElementNotVisibleException
|
||||
from selenium.common.exceptions import NoAlertPresentException
|
||||
|
@ -224,6 +225,7 @@ def hover_element(driver, element):
|
|||
|
||||
|
||||
def timeout_exception(exception, message):
|
||||
unittest.has_exception = True
|
||||
exc, msg = shared_utils.format_exc(exception, message)
|
||||
raise exc(msg)
|
||||
|
||||
|
|
6
setup.py
6
setup.py
|
@ -160,8 +160,8 @@ setup(
|
|||
'urllib3==1.26.15;python_version>="3.7"',
|
||||
'requests==2.27.1;python_version<"3.7"',
|
||||
'requests==2.29.0;python_version>="3.7"',
|
||||
'requests-toolbelt==0.10.1',
|
||||
"pynose==1.4.2",
|
||||
'requests-toolbelt==1.0.0',
|
||||
"pynose==1.4.3",
|
||||
'sniffio==1.3.0;python_version>="3.7"',
|
||||
'h11==0.14.0;python_version>="3.7"',
|
||||
'outcome==1.2.0;python_version>="3.7"',
|
||||
|
@ -241,7 +241,7 @@ setup(
|
|||
# Usage: coverage run -m pytest; coverage html; coverage report
|
||||
"coverage": [
|
||||
'coverage==6.2;python_version<"3.7"',
|
||||
'coverage==7.2.4;python_version>="3.7"',
|
||||
'coverage==7.2.5;python_version>="3.7"',
|
||||
"pytest-cov==4.0.0",
|
||||
],
|
||||
# pip install -e .[flake8]
|
||||
|
|
Loading…
Reference in New Issue