I used webdriverIO and Mocha as e2e test tools.
types field in tsconfig.json configured like the below:
"types": ["node", "webdriverio", "@wdio/mocha-framework", "expect-webdriverio", "mocha"]
the code worked well several months ago, but there is an error occurs these days, and I did nothing changes
ts error:
Cannot find name 'browser'.ts(2304)
when I run test cases in terminal, also get error like the below:
[0-0] 2024-03-13T08:42:20.199Z WARN @wdio/mocha-framework: Unable to load spec files quite likely because they rely on browserobject that is not fully initialised.browserobject has onlycapabilitiesand some flags likeisMobile. Helper files that use other browsercommands have to be moved tobefore hook.
I googled the issue but seems like their solution doesn't work for me.
I want to fix the ts error and run test cases without error.
Can anybody give me some advice? thanks in advance. please let me know if any other info is needed.