nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

Selenium Host Ignored #2803

Closed dmcmullen closed 3 years ago

dmcmullen commented 3 years ago

Selenium Host Ignored

When setting selenium_host it is ignored and localhost is used instead.

{
  "test_settings" : {
    "default" : {
      "launch_url" : "https://nightwatchjs.org",
      "selenium_port" : 443,
      "selenium_host" : "ondemand.saucelabs.com",
      ...
    }
  }
}

This occurs during test setup. image

Expected behavior looks as follows image

This is occurring because here in NightwatchClient is the first time the selenium_host is used if the webdriver.host is undefined. An update occurred in 1.7 that sets a default value for webdriver.host making it impossible to set the value to anything else. That code is here

Changing https://github.com/nightwatchjs/nightwatch/blob/main/lib/settings/settings.js#L151 to const {port, host = 'localhost'} = this.settings.webdriver; and deleting the setting of the default should correct this bug.

beatfactor commented 3 years ago

Thanks for reporting this, it will be fixed soon.

vaibhavsingh97 commented 3 years ago

Hi @dmcmullen 👋 Thanks for reporting the issue, I looked into the code, and on debugging further, I found that we had deprecated selenium_host and selenium_port. For more information about it, please look at the documentation here.

you can use the below settings to make it work in v1.7

default: {
  launch_url: 'https://nightwatchjs.org',

  selenium: {
    start_process: false,
    port: 443,
    host: 'ondemand.saucelabs.com'
  }
},

Let me know if you still have an issue

dmcmullen commented 3 years ago

Thank you for the update. That worked for me.

vaibhavsingh97 commented 3 years ago

I am closing the issue then, please feel free to reopen if it occurs again