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

Issue with configuring proxy for cloud services #2409

Closed irondev84 closed 4 years ago

irondev84 commented 4 years ago

in my company we need to use saucelab but we cannot connect behind our corporate proxy, optional proxy from https://nightwatchjs.org/gettingstarted/configuration/ won't work :(

so we cannot use saucelabs with nightwatch beacause of proxy problem...

beatfactor commented 4 years ago

@ironeo can you please explain what doesn't work exactly?

irondev84 commented 4 years ago

ok, thanks Andrei for answering ... I am in a hurry to explain. We use nighwtatch in the bank for banking testing, which makes thr security very important and when we decided to start integrating with SauceLabs, problems began. First of all it's about proxy configuration. I believe that the documentation page describes how to use a proxy, it took me a long time to come to the conclusion that in nightwatch.conf.js it should be in the form:
proxy: { host: 'localhost', port: '3128', protocol: 'http' }, I think the info on the site: https://stackoverflow.com/questions/30384818/set-proxy-in-nightwatch-js is wrong because such form: "proxy": { "proxyType": "manual", "httpProxy": "your_proxy:8080" }. it just doesn't work for me. however the problem is the lack of support for specifying the proxy configuration using the form: login:pass@proxy.com:port means that we need to use cntlm with an additional proxy. That is, in nightwatch we have localhost:port, running in the background CNTLM and already in it NTLM set to proxy with authorization. Wouldn't it be possible to do native support in nightwatch?

beatfactor commented 4 years ago

From: https://nightwatchjs.org/gettingstarted/configuration/#webdriver-settings

Proxy requests to the Webdriver (or Selenium) service. http, https, socks(v5), socks5, sock4, and pac are accepted. Uses node-proxy-agent.

Example: http://user:pass@host:port

irondev84 commented 4 years ago

ok, so what should I change ? where is my mistake: ? `'chrome-sauce': { test_settings: { selenium: { start_process: false, port: 443, host: 'ondemand.eu-central-1.saucelabs.com',

    webdriver: {
      host: 'ondemand.eu-central-1.saucelabs.com',
      port: 443,
      username: username,
      access_key: accessKey,
      proxy: 'http://user:password@proxy.com:8080'
    }
  },

  use_ssl: true,
  username: username,
  accessKey: accessKey,
  silent: true,
  globals: {
    environment: 'DMZ',
  },
  screenshots: {
    enabled: true,
    path: 'tests/screenshots/uat/',
    on_failure: true,
    on_error: true
  },

  desiredCapabilities: {
    browserName: 'chrome',
    platform: 'Windows 10',
    version: 'latest',
    'sauce:options': {
    },
    marionette: true,
    javascriptEnabled: true,
    acceptSslCerts: true,
    chromeOptions: {

      args: ['--ignore-certificate-errors']
    }
  }
}

}`

beatfactor commented 4 years ago

The whole config file seems wrong. The selenium block should be on level up.

beatfactor commented 4 years ago

Better remove the selenium block, unless you're using a v0.9 version. https://nightwatchjs.org/gettingstarted/configuration/#nightwatch-json

irondev84 commented 4 years ago

we are after migration, now we are using 1.3.5, thanks for your patience, I will try change this config but believe me I spend over 2 days on it and try many variants an only this: proxy: { host: 'localhost', port: '3128', protocol: 'http' }, seems to work correct, the problem is that I cant find any other advise on the internet such as a stack or github :(

anyway If you cant look at my old isuue #2368

irondev84 commented 4 years ago

here is my project: https://github.com/ironeo/sauceLabs/blob/master/nightwatch.conf.js please look at the config and teach me how to use From: https://nightwatchjs.org/gettingstarted/configuration/#webdriver-settings

Proxy requests to the Webdriver (or Selenium) service. http, https, socks(v5), socks5, sock4, and pac are accepted. Uses node-proxy-agent.

Example: http://user:pass@host:port

in the right way...

beatfactor commented 4 years ago

Are you sure this is a bug? Have you tried posting a message on the Mailing List?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.