view core/tests/Drupal/Nightwatch/Commands/drupalLogAndEnd.js @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
line wrap: on
line source
/**
 * Ends the browser session and logs the console log if there were any errors.
 * See globals.js.
 *
 * @param {Object}
 *   (optional) Settings object
 *   @param onlyOnError
 *     (optional) Only writes out the console log file if the test failed.
 * @param {function} callback
 *   A callback which will be called.
 * @return {object}
 *   The 'browser' object.
 */
exports.command = function drupalLogAndEnd({ onlyOnError = true }, callback) {
  const self = this;
  this.drupalLogConsole = true;
  this.drupalLogConsoleOnlyOnError = onlyOnError;

  // Nightwatch doesn't like it when no actions are added in a command file.
  // https://github.com/nightwatchjs/nightwatch/issues/1792
  this.pause(1);

  if (typeof callback === 'function') {
    callback.call(self);
  }
  return this;
};