I'm a beginner, so therefore do not judge strictly for extra information
This is package.json:
{
"name": "my-new-project",
"type": "module",
"devDependencies": {
"@wdio/appium-service": "^8.11.2",
"@wdio/cli": "^8.11.2",
"@wdio/local-runner": "^8.11.2",
"@wdio/mocha-framework": "^8.11.0",
"@wdio/spec-reporter": "^8.11.2",
"appium": "^2.0.0-rc.3",
"appium-uiautomator2-driver": "^2.29.0"
},
"scripts": {
"wdio": "wdio run ./wdio.conf.js"
}
}
This is wdio.conf.js:
export const config = {
runner: 'local',
port: 4724,
path: '/',
specs: [
'./local_test.js'
],
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{
"platformName": "Android",
"appium:platformVersion": "11",
"appium:deviceName": "Redmi Note 11",
"appium:automationName": "UIAutomator2",
"appium:app": "C:\\VisualSC\\i_g_3_YT\\WikipediaSample.apk",
"appium:udid": "my_udid",
}],
logLevel: 'error',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 20000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services: ['appium'],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
},
}
And I use the Appium GUI
I entered this into the terminal
PS C:\VisualSC\i_g_3_YT> npm run wdio
And It turns out that such an error occurs when running the code:
2023-06-25T23:43:13.006Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: Appium exited before timeout (exit code: 1)
at ChildProcess.<anonymous> (file:///C:/VisualSC/i_g_3_YT/node_modules/@wdio/appium-service/build/launcher.js:116:22)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:12)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Continue...
[0-0] Error: "ts-node/esm/transpile-only 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
[0-0] at new NodeError (node:internal/errors:399:5)
[0-0] at ESMLoader.resolve (node:internal/modules/esm/loader:846:13)
[0-0] at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)
[0-0] FAILED
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:07
You have to install ts-node via
npm install ts-node --save-dev