nightwatchjs/vite-plugin-nightwatch

launchURL should not be hardcoded to 'localhost'

Opened this issue · 1 comments

tjad commented

The launch url is hardcoded to 'localhost'. I am wanting to do remote testing - via docker. This blocks me from being able to allow my test docker environment from using a custom url to the container hosting the vite server.

I initially logged an issue here, but I see that it is actually in the vite-plugin-nightwatch

nightwatchjs/nightwatch-plugin-react#7

I am using a vite_dev_server setup.

return this.api.navigateTo(`${launchUrl}/_nightwatch/`);

@tjad if I'm not mistaken, you can customize what goes on this launchUrl variable via the nightwatch.conf.cjs file... for example:

test_settings: {
    default: {
      disable_error_log: false,
      launch_url: `http://127.0.0.1:${process.env.CI ? '4173' : '5173'}`,

      screenshots: {
        enabled: false,
        path: 'screens',
        on_failure: true
      },

      desiredCapabilities: {
        browserName: 'firefox'
      },

      webdriver: {
        start_process: true,
        server_path: ''
      }
    },

I'm using 127.0.0.1 with a ternary operator for port definition depending on the environment.
Just pass what you need there and you should be fine.