//require('@babel/register');

// http://nightwatchjs.org/getingstarted#settings-file

const vite = require('./vite.js');

const startViteServer = function() {
  return vite.start({
    configFile: './vite.config.js',
  });
}

let viteServer;

module.exports = {
  src_folders: ['test/e2e/specs'],
  output_folder: 'test/e2e/reports',
  custom_assertions_path: ['test/e2e/custom-assertions'],
  custom_commands_path: [
    './node_modules/nightwatch-axe/src/commands',
  ],

  test_settings: {
    default: {
      silent: true,
      globals: {
        devServerURL: `http://localhost:3000/#/`,
        asyncHookTimeout: 180000,
        async before() {
          viteServer = await startViteServer(); 
          const port = viteServer.config.server.port;
          this.launchUrl = `http://localhost:${port}`;
        },
        async after() {
          await viteServer.close();
        },
      },
      desiredCapabilities: {
        browserName : 'chrome'
      },
      webdriver: {
        start_process: true,
        server_path: "node_modules/.bin/chromedriver",
        port: 9515
      },
    },
  },
};
//require('@babel/register');

// http://nightwatchjs.org/getingstarted#settings-file

const vite = require('./vite.js');

const startViteServer = function() {
  return vite.start({
    configFile: './vite.config.mjs',
  });
}

let viteServer;

module.exports = {
  src_folders: ['test/e2e/specs'],
  output_folder: 'test/e2e/reports',
  custom_assertions_path: ['test/e2e/custom-assertions'],
  custom_commands_path: [
    './node_modules/nightwatch-axe/src/commands',
  ],

  test_settings: {
    default: {
      silent: true,
      globals: {
        devServerURL: `http://localhost:3000/#/`,
        asyncHookTimeout: 180000,
        async before() {
          viteServer = await startViteServer(); 
          const port = viteServer.config.server.port;
          this.launchUrl = `http://localhost:${port}`;
        },
        async after() {
          await viteServer.close();
        },
      },
      desiredCapabilities: {
        browserName : 'chrome'
      },
      webdriver: {
        start_process: true,
        server_path: "node_modules/.bin/chromedriver",
        port: 9515
      },
    },
  },
};
update extension in config