Skip to content

Commit 645c071

Browse files
committed
Expand the tool that generates "behave" tests
1 parent dcb9b7d commit 645c071

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

seleniumbase/behave/behave_helper.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ def generate_gherkin(srt_actions):
202202
sb_actions.append("Set content to default")
203203
elif action[0] == "sleep":
204204
sb_actions.append("Sleep for %s seconds" % action[1])
205+
elif action[0] == "wf_el":
206+
method = "Wait for element"
207+
if '"' not in action[1]:
208+
sb_actions.append('%s "%s"' % (method, action[1]))
209+
else:
210+
sb_actions.append("%s '%s'" % (method, action[1]))
205211
elif action[0] == "as_el":
206212
method = "Assert element"
207213
if '"' not in action[1]:
@@ -275,13 +281,22 @@ def generate_gherkin(srt_actions):
275281
'In \'%s\' assert attribute "%s"'
276282
% (action[1][0], action[1][1])
277283
)
278-
elif action[0] == "as_te" or action[0] == "as_et":
284+
elif (
285+
action[0] == "as_te"
286+
or action[0] == "as_et"
287+
or action[0] == "da_te"
288+
or action[0] == "da_et"
289+
):
279290
import unicodedata
280291

281292
action[1][0] = unicodedata.normalize("NFKC", action[1][0])
282293
method = "Assert text"
283294
if action[0] == "as_et":
284295
method = "Assert exact text"
296+
elif action[0] == "da_te":
297+
method = "Deferred assert text"
298+
elif action[0] == "da_et":
299+
method = "Deferred assert exact text"
285300
if action[1][1] != "html":
286301
if '"' not in action[1][0] and '"' not in action[1][1]:
287302
sb_actions.append(
@@ -312,10 +327,24 @@ def generate_gherkin(srt_actions):
312327
sb_actions.append(
313328
"%s '%s'" % (method, action[1][0])
314329
)
330+
elif action[0] == "da_el":
331+
method = "Deferred assert element"
332+
if '"' not in action[1]:
333+
sb_actions.append('%s "%s"' % (method, action[1]))
334+
else:
335+
sb_actions.append("%s '%s'" % (method, action[1]))
336+
elif action[0] == "da_ep":
337+
method = "Deferred assert element present"
338+
if '"' not in action[1]:
339+
sb_actions.append('%s "%s"' % (method, action[1]))
340+
else:
341+
sb_actions.append("%s '%s'" % (method, action[1]))
315342
elif action[0] == "ss_tl":
316343
sb_actions.append("Save screenshot to logs")
317344
elif action[0] == "sh_fc":
318345
sb_actions.append("Show file choosers")
346+
elif action[0] == "pr_da":
347+
sb_actions.append("Process deferred asserts")
319348
elif action[0] == "c_l_s":
320349
sb_actions.append("Clear Local Storage")
321350
elif action[0] == "c_s_s":

0 commit comments

Comments
 (0)