What exactly should I do for writing helper functions? (Using Appium + WebDriverIO to test my Android App) #12048
Unanswered
kainbryanjones
asked this question in
Q&A
Replies: 1 comment 3 replies
-
@kainbryanjones you can import the browser any time at the top of the file, but you can only use it within a hook or test block. Mocha reads the test file synchronously and doesn't allow for asynchronous executions. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to write some helper functions to abstract repeated tasks (as programmers do), but I kept getting this error...
"My Spec file is not able to load ,getting error as Unable to load spec files quite likely because they rely on browser object that is not fully initialised."
When I moved my function definitions inside the test spec and didn't import them seperately then this worked.
My understanding is that doing this...
import {driver} from "@wdio/globals"
outside of a test spec will cause issues.
So what are my options here? Must I pass the driver instance to every helper method I write? Is there an alternative way to reference the driver without encountering this error?
Beta Was this translation helpful? Give feedback.
All reactions