Skip to content

Commit

Permalink
Add "assert_text_not_visible" to recorded actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Jun 17, 2022
1 parent d525aaa commit 536e989
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions seleniumbase/behave/behave_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def generate_gherkin(srt_actions):
elif (
action[0] == "as_te"
or action[0] == "as_et"
or action[0] == "astnv"
or action[0] == "da_te"
or action[0] == "da_et"
):
Expand All @@ -293,6 +294,8 @@ def generate_gherkin(srt_actions):
method = "Assert text"
if action[0] == "as_et":
method = "Assert exact text"
elif action[0] == "astnv":
method = "Assert text not visible"
elif action[0] == "da_te":
method = "Deferred assert text"
elif action[0] == "da_et":
Expand Down
21 changes: 16 additions & 5 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -3766,6 +3766,7 @@ def __process_recorded_actions(self):
ext_actions.append("do_fi")
ext_actions.append("as_at")
ext_actions.append("as_te")
ext_actions.append("astnv")
ext_actions.append("as_et")
ext_actions.append("wf_el")
ext_actions.append("sw_fr")
Expand Down Expand Up @@ -4116,6 +4117,7 @@ def __process_recorded_actions(self):
elif (
action[0] == "as_te"
or action[0] == "as_et"
or action[0] == "astnv"
or action[0] == "da_te"
or action[0] == "da_et"
):
Expand All @@ -4125,6 +4127,8 @@ def __process_recorded_actions(self):
method = "assert_text"
if action[0] == "as_et":
method = "assert_exact_text"
elif action[0] == "astnv":
method = "assert_text_not_visible"
elif action[0] == "da_te":
method = "deferred_assert_text"
elif action[0] == "da_et":
Expand Down Expand Up @@ -10303,16 +10307,12 @@ def assert_element_not_visible(
timeout = settings.SMALL_TIMEOUT
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
original_selector = selector
selector, by = self.__recalculate_selector(selector, by)
self.wait_for_element_not_visible(selector, by=by, timeout=timeout)
if self.recorder_mode:
url = self.get_current_url()
if url and len(url) > 0:
if ("http:") in url or ("https:") in url or ("file:") in url:
if self.get_session_storage_item("pause_recorder") == "no":
if by == By.XPATH:
selector = original_selector
time_stamp = self.execute_script("return Date.now();")
origin = self.get_origin()
action = ["asenv", selector, origin, time_stamp]
Expand Down Expand Up @@ -10345,9 +10345,20 @@ def assert_text_not_visible(
timeout = settings.SMALL_TIMEOUT
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return self.wait_for_text_not_visible(
self.wait_for_text_not_visible(
text, selector, by=by, timeout=timeout
)
if self.recorder_mode:
url = self.get_current_url()
if url and len(url) > 0:
if ("http:") in url or ("https:") in url or ("file:") in url:
if self.get_session_storage_item("pause_recorder") == "no":
time_stamp = self.execute_script("return Date.now();")
origin = self.get_origin()
text_selector = [text, selector]
action = ["astnv", text_selector, origin, time_stamp]
self.__extra_actions.append(action)
return True

############

Expand Down

0 comments on commit 536e989

Please sign in to comment.