Skip to content

Commit 536e989

Browse files
committed
Add "assert_text_not_visible" to recorded actions
1 parent d525aaa commit 536e989

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

seleniumbase/behave/behave_helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def generate_gherkin(srt_actions):
284284
elif (
285285
action[0] == "as_te"
286286
or action[0] == "as_et"
287+
or action[0] == "astnv"
287288
or action[0] == "da_te"
288289
or action[0] == "da_et"
289290
):
@@ -293,6 +294,8 @@ def generate_gherkin(srt_actions):
293294
method = "Assert text"
294295
if action[0] == "as_et":
295296
method = "Assert exact text"
297+
elif action[0] == "astnv":
298+
method = "Assert text not visible"
296299
elif action[0] == "da_te":
297300
method = "Deferred assert text"
298301
elif action[0] == "da_et":

seleniumbase/fixtures/base_case.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,6 +3766,7 @@ def __process_recorded_actions(self):
37663766
ext_actions.append("do_fi")
37673767
ext_actions.append("as_at")
37683768
ext_actions.append("as_te")
3769+
ext_actions.append("astnv")
37693770
ext_actions.append("as_et")
37703771
ext_actions.append("wf_el")
37713772
ext_actions.append("sw_fr")
@@ -4116,6 +4117,7 @@ def __process_recorded_actions(self):
41164117
elif (
41174118
action[0] == "as_te"
41184119
or action[0] == "as_et"
4120+
or action[0] == "astnv"
41194121
or action[0] == "da_te"
41204122
or action[0] == "da_et"
41214123
):
@@ -4125,6 +4127,8 @@ def __process_recorded_actions(self):
41254127
method = "assert_text"
41264128
if action[0] == "as_et":
41274129
method = "assert_exact_text"
4130+
elif action[0] == "astnv":
4131+
method = "assert_text_not_visible"
41284132
elif action[0] == "da_te":
41294133
method = "deferred_assert_text"
41304134
elif action[0] == "da_et":
@@ -10303,16 +10307,12 @@ def assert_element_not_visible(
1030310307
timeout = settings.SMALL_TIMEOUT
1030410308
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
1030510309
timeout = self.__get_new_timeout(timeout)
10306-
original_selector = selector
10307-
selector, by = self.__recalculate_selector(selector, by)
1030810310
self.wait_for_element_not_visible(selector, by=by, timeout=timeout)
1030910311
if self.recorder_mode:
1031010312
url = self.get_current_url()
1031110313
if url and len(url) > 0:
1031210314
if ("http:") in url or ("https:") in url or ("file:") in url:
1031310315
if self.get_session_storage_item("pause_recorder") == "no":
10314-
if by == By.XPATH:
10315-
selector = original_selector
1031610316
time_stamp = self.execute_script("return Date.now();")
1031710317
origin = self.get_origin()
1031810318
action = ["asenv", selector, origin, time_stamp]
@@ -10345,9 +10345,20 @@ def assert_text_not_visible(
1034510345
timeout = settings.SMALL_TIMEOUT
1034610346
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
1034710347
timeout = self.__get_new_timeout(timeout)
10348-
return self.wait_for_text_not_visible(
10348+
self.wait_for_text_not_visible(
1034910349
text, selector, by=by, timeout=timeout
1035010350
)
10351+
if self.recorder_mode:
10352+
url = self.get_current_url()
10353+
if url and len(url) > 0:
10354+
if ("http:") in url or ("https:") in url or ("file:") in url:
10355+
if self.get_session_storage_item("pause_recorder") == "no":
10356+
time_stamp = self.execute_script("return Date.now();")
10357+
origin = self.get_origin()
10358+
text_selector = [text, selector]
10359+
action = ["astnv", text_selector, origin, time_stamp]
10360+
self.__extra_actions.append(action)
10361+
return True
1035110362

1035210363
############
1035310364

0 commit comments

Comments
 (0)