I get the localhost running and start the script (which always fails) and i get the following error:
[0-0] Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialized.
`browser` object has only `capabilities` and some flags like `isMobile`.
Helper files that use other `browser` commands have to be moved to `before` hook.
Spec file(s): file:///Users/maxsadler/Documents/MOT_cert_GIT/MOT_cert/test/specs/Login.e2e.js
Error: /Users/maxsadler/Documents/MOT_cert_GIT/MOT_cert/test/specs/Login.e2e.js:2
await $('input[name="email"]').setValue('admin@test.com')
Please help i followed the instructions but it still fails
Still getting the same error. gone over the tutorial page several times. cannot get this automated test to pass.
[0-0] Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialized.
`browser` object has only `capabilities` and some flags like `isMobile`.
Helper files that use other `browser` commands have to be moved to `before` hook.
Spec file(s): file:///Users/maxsadler/Documents/MOT_cert_GIT/MOT_cert/test/specs/Login.e2e.js
Error: /Users/maxsadler/Documents/MOT_cert_GIT/MOT_cert/test/specs/Login.e2e.js:1
const element = await $('.card-title');
The error is not quite the same, as the failing command is now const element = await $('.card-title');. It seems like you only removed the first three lines and this one is now the first command. Try removing this line as well, so your file should be:
From what the error is saying, you are trying to use a function that relies on the browser having been initialised. This is done in the line const { expect, browser, $ } = require('@wdio/globals') so that needs to be the first line in the file.
Thanks for this andrew i made the two changes. first added the browser to the config and then changed the code as you recommended. i think i got confused with this practical demo but i really appreciate the support.