I know there is condition-based timeout like this:
wait 1m until exist "css: span.error"
I have several of those included in my
.test file to wait for certain elements to load before doing a
checkis there a way to
not run a test or set of tests — from within a
.spec file
— if an element does not exist at all on a page?
for instance, I have the code below mixed in with a bunch of other
.spec tests:
@objects
task-block css .TaskBlock
= Section 3. Task block =
@on *
task-block:
css margin-top is "${correction(80)}"
I'm running my test across a wide variety of web pages, but the "task-block" element only exists on a limited number of those pages, so I frequently get
errors like the following when I run my tests via gulp in command line (or in my HTML reports):
-> : "task-block" is absent on page
what I would like is if I could do a quick check whether "task-block" exists from within the
.spec file. if it does, continue with that particular test (css margin-top, in this example). if not, then skip that test.
I imagine creating a variable for "task-block" and passing that to an external JS script that determines whether to run that particular test in the
.spec file, but I'm not sure how the round trip back to the
.spec file would work, wrapping in the
.spec test in question in {} marks, for instance. the reason I think of externalizing it into an external JS file is so that I don't have to include the IF/THEN a hundred times throughout my
.spec tests, it would just be a variable for each element in question passed that would trigger some sort of IF/THEN function.
even more so, I'm hoping there's something already built into Galen (with indentation or something) to pull this off.
thank you.