-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
8.35.1
Node.js Version
v18.19.0
Mode
WDIO Testrunner
Which capabilities are you using?
{
maxInstances: 1,
platformName: 'windows',
hostname: '127.0.0.1',
'appium:automationName': 'windows',
'appium:deviceName': 'WindowsPC',
'appium:appTopLevelWindow': nativeWindowHandle,
},What happened?
Background I'm running E2E testing with WebdriverIO/Appium on Windows.
When I run the WebDriverIO test runner in my cmd, my testing passes successfully. However, I notice at the end of the run, I get the following error:
ERROR @wdio/appium-service: Appium exited before timeout (exit code: null)
This is the only error I get - the actual tests all pass successfully.
Then, using the same command prompt instance, I'll run the same exact tests again, changing nothing. This time, I get errors as WebDriverIO attempts to launch Appium:
2024-07-01T22:39:19.725Z ERROR @wdio/appium-service: Appium exited before timeout (exit code: 1) [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
After seeing this, I checked my task manager. I found that there is a lingering node process after the first test run. I checked the command line that spawned this node process to be extra sure, and I can confirm that the command line that spawned it is:
"C:\Program Files\nodejs\node.exe" C:\my_local_project_path\node_modules\appium\index.js --base-path /.
This is the exact command that @wdio/appium-service uses to initially launch appium. I found this in the _startAppium(command, args) function in launcher.ts file (packages\wdio-appium-service\src\launcher.ts).
So, it looks like this process isn't being shutdown correctly by WebDriverIO. We see something is going wrong on the initial test execution as mentioned above: ERROR @wdio/appium-service: Appium exited before timeout (exit code: null).
I take it something is going wrong when trying to shutdown this process.
What is your expected behavior?
No response
How to reproduce the bug.
In a cmd, run WebDriverIO's test runner with the Appium plugin. Run it multiple times to see the subsequent test failures. You can also open up task manager to see the extra node process after testing as finished.
Relevant log output
2024-07-01T22:39:17.194Z INFO @wdio/appium-service: Will spawn Appium process: cmd /c node E:\local_path\node_modules\appium\index.js --base-path /
2024-07-01T22:39:19.725Z ERROR @wdio/appium-service: Appium exited before timeout (exit code: 1)
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
2024-07-01T22:39:19.728Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: Appium exited before timeout (exit code: 1)
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
at ChildProcess.<anonymous> (file:///E:/local_path/node_modules/@wdio/appium-service/build/launcher.js:154:24)
at Object.onceWrapper (node:events:632:26)
at ChildProcess.emit (node:events:517:28)
at ChildProcess.emit (node:domain:489:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:292:12)Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues