Skip to content

Commit fa02034

Browse files
committed
Refactoring and renaming
1 parent 420e845 commit fa02034

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def __init__(self, *args, **kwargs):
7171
self.env = None # Add a shortened version of self.environment
7272
self.__last_url_of_delayed_assert = "data:,"
7373
self.__last_page_load_url = "data:,"
74-
self.__page_check_count = 0
75-
self.__page_check_failures = []
74+
self.__delayed_assert_count = 0
75+
self.__delayed_assert_failures = []
7676
# Requires self._* instead of self.__* for external class use
7777
self._html_report_extra = [] # (Used by pytest_plugin.py)
7878
self._default_driver = None
@@ -2287,7 +2287,7 @@ def assert_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
22872287
return True
22882288

22892289
# For backwards compatibility, earlier method names of the next
2290-
# four methods have remained even though they do the same thing,
2290+
# three methods have remained even though they do the same thing,
22912291
# with the exception of assert_*, which won't return the element,
22922292
# but like the others, will raise an exception if the call fails.
22932293

@@ -2609,16 +2609,16 @@ def __add_delayed_assert_failure(self):
26092609
""" Add a delayed_assert failure into a list for future processing. """
26102610
current_url = self.driver.current_url
26112611
message = self.__get_exception_message()
2612-
self.__page_check_failures.append(
2612+
self.__delayed_assert_failures.append(
26132613
"CHECK #%s: (%s)\n %s" % (
2614-
self.__page_check_count, current_url, message))
2614+
self.__delayed_assert_count, current_url, message))
26152615

26162616
def delayed_assert_element(self, selector, by=By.CSS_SELECTOR,
26172617
timeout=settings.MINI_TIMEOUT):
26182618
""" A non-terminating assertion for an element on a page.
26192619
Failures will be saved until the process_delayed_asserts()
26202620
method is called from inside a test, likely at the end of it. """
2621-
self.__page_check_count += 1
2621+
self.__delayed_assert_count += 1
26222622
try:
26232623
url = self.get_current_url()
26242624
if url == self.__last_url_of_delayed_assert:
@@ -2639,7 +2639,7 @@ def delayed_assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
26392639
""" A non-terminating assertion for text from an element on a page.
26402640
Failures will be saved until the process_delayed_asserts()
26412641
method is called from inside a test, likely at the end of it. """
2642-
self.__page_check_count += 1
2642+
self.__delayed_assert_count += 1
26432643
try:
26442644
url = self.get_current_url()
26452645
if url == self.__last_url_of_delayed_assert:
@@ -2666,12 +2666,12 @@ def process_delayed_asserts(self, print_only=False):
26662666
the delayed asserts on a single html page so that the failure
26672667
screenshot matches the location of the delayed asserts.
26682668
If "print_only" is set to True, the exception won't get raised. """
2669-
if self.__page_check_failures:
2669+
if self.__delayed_assert_failures:
26702670
exception_output = ''
26712671
exception_output += "\n*** DELAYED ASSERTION FAILURES FOR: "
26722672
exception_output += "%s\n" % self.id()
2673-
all_failing_checks = self.__page_check_failures
2674-
self.__page_check_failures = []
2673+
all_failing_checks = self.__delayed_assert_failures
2674+
self.__delayed_assert_failures = []
26752675
for tb in all_failing_checks:
26762676
exception_output += "%s\n" % tb
26772677
if print_only:
@@ -3017,7 +3017,7 @@ def tearDown(self):
30173017
has_exception = True
30183018
else:
30193019
has_exception = sys.exc_info()[1] is not None
3020-
if self.__page_check_failures:
3020+
if self.__delayed_assert_failures:
30213021
print(
30223022
"\nWhen using self.delayed_assert_*() methods in your tests, "
30233023
"remember to call self.process_delayed_asserts() afterwards. "

0 commit comments

Comments
 (0)