*No browser instance registered. Don’t import @wdio/globals outside of the WDIO testrunner context. Or you have two two different “@wdio/globals” packages installed.
Hi,
I believe this relates to a public MoT project. Which one? Can you share the repository URL?
Just looking at what you shared:
In the login.e2e.js you seem to import from ‘@widio/globals’
But the name of the library is ‘@wdio/globals’: Globals | WebdriverIO
However, this might not be the end of your issue. So I’d recommend fixing the require first and then feeding back what issues you might face afterwards (if you don’t then woohoo!)
Yes, it’s the mot-cert-support-app-js repo.
Thanks for the heads up with the typo and correct import. It looks like the second error is still occurring.
No browser instance registered. Don’t import @wdio/globals outside of the WDIO testrunner context. Or you have two two different “@wdio/globals” packages installed.
No browser instance registered. Don’t import @wdio/globals outside of the WDIO testrunner context. Or you have two two different “@wdio/globals” packages installed.
It’s hard to advise based on the small fragment of code you’ve shared. Would you be able to package your project up on GitHub and share the link for me to look at in more detail?
I did notice that I got a slightly different error if I didn’t run npm start first, but the error I’m seeing is…
[0-0] Error in "My Login application.should login with valid credentials"
Error: Can't call getText on element with selector ".card-title" because element wasn't found
at condition (file:///Users/kellykenyon/mot-cert-support-app-js-trunk/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:4:24)
at Object.executeCommand (file:///Users/kellykenyon/mot-cert-support-app-js-trunk/node_modules/expect-webdriverio/lib/util/executeCommand.js:19:22)
at file:///Users/kellykenyon/mot-cert-support-app-js-trunk/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:21:24
at waitUntil (file:///Users/kellykenyon/mot-cert-support-app-js-trunk/node_modules/expect-webdriverio/lib/utils.js:23:43)
at Object.toHaveText (file:///Users/kellykenyon/mot-cert-support-app-js-trunk/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:20:18)
at Context.<anonymous> (/Users/kellykenyon/mot-cert-support-app-js-trunk/src/__tests__/Login.e2e.js:13:8)
I got a dev at work to help me- it was to do with the way I was set up for work code- this is his explanation…
So your Java issue (running npm start) was caused by ASDF injecting it’s own Java version, other people won’t have that issue. We solved that one by removing ASDF from the $PATH variable which means your terminal won’t see it’s custom Java version anymore.
The other issue around WebDriver was down to using the wrong command. The README.md file said to run npm test but actually for the E2E tests you need to run npm run wdio instead