How to use the nightwatch.initClient function in nightwatch

To help you get started, we’ve selected a few nightwatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nkbt / component-router / scripts / e2e.js View on Github external
const run = async ({cwd}) => {
  const server = await createServer({cwd});
  const finish = () => new Promise(resolve => server.close(() => process.nextTick(resolve)));
  const die = async err => {
    console.error(err.message);
    console.log(err.stack);
    await finish();
    process.exit(1);
  };


  process.on('uncaughtException', die);
  process.on('unhandledRejection', die);


  const client = nightwatch.initClient({
    selenium_port: 4444,
    selenium_host: 'localhost',
    silent: true,
    output: true,
    detailed_output: true
  });


  const browser = client.api();

  browser
    .url(`http://${DOCKER_IP}:${server.port}`)
    .waitForElementVisible('body', 1000)
    .assert.containsText('body', require(`${cwd}/package.json`).name)
    .end();
github nkbt / react-collapse / scripts / e2e.js View on Github external
const run = async ({cwd}) => {
  const server = await createServer({cwd});
  const finish = () => new Promise(resolve => server.close(() => process.nextTick(resolve)));
  const die = async err => {
    console.error(err.message);
    console.log(err.stack);
    await finish();
    process.exit(1);
  };


  process.on('uncaughtException', die);
  process.on('unhandledRejection', die);


  const client = nightwatch.initClient({
    selenium_port: 4444,
    selenium_host: 'localhost',
    silent: true,
    output: true,
    detailed_output: true
  });


  const browser = client.api();

  browser
    .url(`http://${DOCKER_IP}:${server.port}`)
    .waitForElementVisible('body', 1000)
    .assert.containsText('body', require(`${cwd}/package.json`).name)
    .end();
github Garethp / cucumber-nightwatch / features / support / world.js View on Github external
function World() {
    //Initiate our client and get it back from the Manager
    var client = nightwatch.initClient(config.test_settings.default)['@client'];
    client.api.silent = true;

    //Set the client and api to a scope for all features and hooks
    this.client = client;
    this.browser = client.api;
}

nightwatch

Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.

MIT
Latest version published 16 days ago

Package Health Score

92 / 100
Full package analysis