webdriverio / appium-boilerplate

Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android
MIT License
452 stars 262 forks source link

node 17.6.0 fails - node 16.14.0 - works - ERROR webdriver: RequestError: connect ECONNREFUSED ::1:4723 - ERROR @wdio/runner: Error: Failed to create session. #122

Closed spencer1573 closed 2 years ago

spencer1573 commented 2 years ago

Environment (please complete the following information):

Describe the bug Super simple. node version 16.14.0 is compatibile with appium... 17.6.0 is not. I'm guessing this is a duplicate somewhere in the appium repo. Although this is more an issue with appium and less an issue with this repo i thought they were related so i would bring it up here.

To Reproduce pull down repo install appium using node 17.6.0

npm i -g appium

install an avd android device in the repo

npm i

hook up environment variables to your device and its info put the app apk in the apps folder (Android-NativeDemoApp-0.4.0.apk then run

npm run android.app

the reason i suspect node is the issue is because i did all the steps except with node 16.14.0 and everything worked fine.

don't expect the bug to be fixed by this repo... just wanted to report it to help out the next person that may have struggled with this.

Expected behavior passing a test.. with proper session startup

Screenshots If applicable, add screenshots to help explain your problem.

➜ npm run android.app

> appium-boilerplate@5.3.1 android.app
> logLevel=debug wdio config/wdio.android.app.conf.ts

config  {
  path: '/wd/hub',
  runner: 'local',
  specs: [],
  capabilities: [],
  logLevel: 'debug',
  bail: 0,
  baseUrl: 'http://the-internet.herokuapp.com',
  waitforTimeout: 45000,
  connectionRetryTimeout: 120000,
  connectionRetryCount: 3,
  services: [ [ 'appium', [Object] ] ],
  framework: 'mocha',
  reporters: [ 'spec' ],
  mochaOpts: { ui: 'bdd', timeout: 180000 },
  host: 'localhost',
  port: 4723
}
config services  [ [ 'appium', { command: 'appium', args: [Object] } ] ]
config capabilities  [
  {
    platformName: 'Android',
    maxInstances: 1,
    'appium:deviceName': 'emulator-5554',
    'appium:platformVersion': '10',
    'appium:orientation': 'PORTRAIT',
    'appium:automationName': 'UiAutomator2',
    'appium:app': '/Users/user/appium-boilerplate/apps/Android-NativeDemoApp-0.4.0.apk',
    'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
    'appium:noReset': true,
    'appium:newCommandTimeout': 240
  }
]

Execution of 1 workers started at 2022-03-03T18:36:34.564Z

2022-03-03T18:36:34.564Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
2022-03-03T18:36:34.569Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-03-03T18:36:34.569Z DEBUG @wdio/appium-service: Will spawn Appium process: appium --base-path / --relaxed-security
2022-03-03T18:36:35.010Z DEBUG @wdio/appium-service: Appium started with ID: 6097
2022-03-03T18:36:35.011Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 442ms
2022-03-03T18:36:35.011Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-03-03T18:36:35.012Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2022-03-03T18:36:35.012Z INFO @wdio/local-runner: Start worker 0-0 with arg: config/wdio.android.app.conf.ts
[0-0] 2022-03-03T18:36:35.170Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2022-03-03T18:36:35.243Z DEBUG @wdio/config:utils: Found 'ts-node' package, auto-compiling TypeScript files
[0-0] config  {
[0-0]   path: '/wd/hub',
[0-0]   runner: 'local',
[0-0]   specs: [],
[0-0]   capabilities: [],
[0-0]   logLevel: 'debug',
[0-0]   bail: 0,
[0-0]   baseUrl: 'http://the-internet.herokuapp.com',
[0-0]   waitforTimeout: 45000,
[0-0]   connectionRetryTimeout: 120000,
[0-0]   connectionRetryCount: 3,
[0-0]   services: [ [ 'appium', [Object] ] ],
[0-0]   framework: 'mocha',
[0-0]   reporters: [ 'spec' ],
[0-0]   mochaOpts: { ui: 'bdd', timeout: 180000 },
[0-0]   host: 'localhost',
[0-0]   port: 4723
[0-0] }
[0-0] config services  [ [ 'appium', { command: 'appium', args: [Object] } ] ]
[0-0] config capabilities  [
[0-0]   {
[0-0]     platformName: 'Android',
[0-0]     maxInstances: 1,
[0-0]     'appium:deviceName': 'emulator-5554',
[0-0]     'appium:platformVersion': '10',
[0-0]     'appium:orientation': 'PORTRAIT',
[0-0]     'appium:automationName': 'UiAutomator2',
[0-0]     'appium:app': '/Users/user/appium-boilerplate/apps/Android-NativeDemoApp-0.4.0.apk',
[0-0]     'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
[0-0]     'appium:noReset': true,
[0-0]     'appium:newCommandTimeout': 240
[0-0]   }
[0-0] ]
[0-0] 2022-03-03T18:36:35.294Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-03-03T18:36:35.296Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
[0-0] RUNNING in Android - /tests/specs/app.login.spec.ts
[0-0] 2022-03-03T18:36:35.427Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-03-03T18:36:35.427Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2022-03-03T18:36:35.450Z INFO webdriver: [POST] http://localhost:4723/session
[0-0] 2022-03-03T18:36:35.450Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       platformName: 'Android',
[0-0]       'appium:deviceName': 'emulator-5554',
[0-0]       'appium:platformVersion': '10',
[0-0]       'appium:orientation': 'PORTRAIT',
[0-0]       'appium:automationName': 'UiAutomator2',
[0-0]       'appium:app': '/Users/user/appium-boilerplate/apps/Android-NativeDemoApp-0.4.0.apk',
[0-0]       'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
[0-0]       'appium:noReset': true,
[0-0]       'appium:newCommandTimeout': 240
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     platformName: 'Android',
[0-0]     'appium:deviceName': 'emulator-5554',
[0-0]     'appium:platformVersion': '10',
[0-0]     'appium:orientation': 'PORTRAIT',
[0-0]     'appium:automationName': 'UiAutomator2',
[0-0]     'appium:app': '/Users/user/appium-boilerplate/apps/Android-NativeDemoApp-0.4.0.apk',
[0-0]     'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
[0-0]     'appium:noReset': true,
[0-0]     'appium:newCommandTimeout': 240
[0-0]   }
[0-0] }
[0-0] 2022-03-03T18:36:35.460Z ERROR webdriver: RequestError: connect ECONNREFUSED ::1:4723
[0-0]     at ClientRequest.<anonymous> (/Users/user/appium-boilerplate/node_modules/got/dist/source/core/index.js:962:111)
[0-0]     at Object.onceWrapper (node:events:642:26)
[0-0]     at ClientRequest.emit (node:events:539:35)
[0-0]     at ClientRequest.emit (node:domain:475:12)
[0-0]     at ClientRequest.origin.emit (/Users/user/appium-boilerplate/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
[0-0]     at Socket.socketErrorListener (node:_http_client:442:9)
[0-0]     at Socket.emit (node:events:527:28)
[0-0]     at Socket.emit (node:domain:475:12)
[0-0]     at emitErrorNT (node:internal/streams/destroy:164:8)
[0-0]     at emitErrorCloseNT (node:internal/streams/destroy:129:3)
[0-0]     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1158:16)
[0-0] 2022-03-03T18:36:35.460Z ERROR @wdio/runner: Error: Failed to create session.
[0-0] Unable to connect to "http://localhost:4723/", make sure browser driver is running on that address.
[0-0] If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.
[0-0]     at startWebDriverSession (/Users/user/appium-boilerplate/node_modules/webdriver/build/utils.js:72:15)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-0]     at async Function.newSession (/Users/user/appium-boilerplate/node_modules/webdriver/build/index.js:42:45)
[0-0]     at async remote (/Users/user/appium-boilerplate/node_modules/webdriverio/build/index.js:73:22)
[0-0]     at async Runner._startSession (/Users/user/appium-boilerplate/node_modules/@wdio/runner/build/index.js:223:56)
[0-0]     at async Runner._initSession (/Users/user/appium-boilerplate/node_modules/@wdio/runner/build/index.js:176:25)
[0-0]     at async Runner.run (/Users/user/appium-boilerplate/node_modules/@wdio/runner/build/index.js:88:19)
2022-03-03T18:36:35.575Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in Android - /tests/specs/app.login.spec.ts
2022-03-03T18:36:35.576Z INFO @wdio/cli:launcher: Run onComplete hook
2022-03-03T18:36:35.576Z DEBUG @wdio/appium-service: Appium (pid: 6097) killed
2022-03-03T18:36:35.576Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 0ms

Spec Files:  0 passed, 1 failed, 1 total (100% completed) in 00:00:01 

2022-03-03T18:36:35.577Z INFO @wdio/local-runner: Shutting down spawned worker
2022-03-03T18:36:35.834Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-03-03T18:36:35.835Z INFO @wdio/local-runner: shutting down

Additional context nope! thanks for all you maintainers do!

wswebcreation commented 2 years ago

Thanks for submitting the issue here for transparency. There is nothing this boilerplate can do about it so I'll be closing this issue here

spencer1573 commented 2 years ago

Thanks so much! Yeah it was mostly just for the next dev.

ansonliao commented 1 year ago

I am facing this problem with node version 18.15.0 now, and the @wdio/appium-service version is 8.10.2