Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run tests on a Remote Selenium Grid #2785

Open
HassHz opened this issue Aug 21, 2024 · 0 comments
Open

Cannot run tests on a Remote Selenium Grid #2785

HassHz opened this issue Aug 21, 2024 · 0 comments

Comments

@HassHz
Copy link

HassHz commented Aug 21, 2024

Hi, this was a similar issue I reported in the WebDriverIO project (which since has gotten resolved), and seems to occur in this project as well (reference: webdriverio/webdriverio#13206). Coming from Karma, I used to be able to launch my tests in a remote selenium grid running on a separate machine. However, when trying this with WTR I get the following error:

Stack Trace / Run Output:

chrome: |██████████████████████████████| 0/1 test files | 0 passed, 0 failed

Running tests...

Running 1 test files...

2024-08-21T18:01:27.234Z ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: chrome=127.0.6533.99)
dists/testFile.js:

 ❌ unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: chrome=127.0.6533.99) 
    unknown error: unknown error: net::ERR_CONNECTION_REFUSED
      (Session info: chrome=127.0.6533.99)
        at getErrorFromResponseBody (file://.../node_modules/webdriver/build/utils.js:195:12)
        at NodeJSRequest._request (file://.../node_modules/webdriver/build/request/index.js:193:23)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Browser.wrapCommandFn (file://.../node_modules/@wdio/utils/build/shim.js:90:29)
        at async IFrameManager._initialize (.../node_modules/@web/test-runner-webdriver/dist/IFrameManager.js:20:9)
        at async IFrameManager.queueStartSession (.../node_modules/@web/test-runner-webdriver/dist/IFrameManager.js:62:13)

Here is my config file:

const wd = require('@web/test-runner-webdriver')

module.exports = {
  files: 'dists/testFile.js',
  nodeResolve: true,
  browsers: [
    wd.webdriverLauncher({
      automationProtocol: 'webdriver',
      hostname: 'company.grid.com',
      port: 4444,
      protocol: 'http',
      path: '/',
      capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          args: [
            '--auto-open-devtools-for-tabs',
            '--use-fake-ui-for-media-stream',
            '--use-fake-device-for-media-stream',
            '--disable-infobars',
            '--disable-translate',
            '--ignore-certificate-errors',
            '--no-sandbox'
          ]
        }
      }
    })
  ],
  testFramework: {
    config: {
      ui: 'bdd',
      timeout: '120000'
    }
  }
}

The above config works when I don't specify the hostname, port, protocol, and path.

In WDIO case, it was a matter of the Vite config not taking in the user's specified server options for hosting the served test files. I didn't see anything in the WTR which would allow me to serve the test files on a non-localhost ip. Since we are launching the test in a remote selenium grid, it would need to access an https+IP and not localhost.

I tried using the following which I see specified here, but it didn't work:

  // configuration for the server
  protocol?: string;
  hostname?: string;
  port?: number;

Maybe it's something I can do with this configuration? server?: Server;. Although, not sure what Server entails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant