view core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.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
/**
 * Concatenate a DRUPAL_TEST_BASE_URL variable and a pathname.
 *
 * This provides a custom command, .relativeURL()
 *
 * @param {string} pathname
 *   The relative path to append to DRUPAL_TEST_BASE_URL
 * @param {function} callback
 *   A callback which will be called.
 * @return {object}
 *   The 'browser' object.
 */
exports.command = function drupalRelativeURL(pathname, callback) {
  const self = this;
  this.url(`${process.env.DRUPAL_TEST_BASE_URL}${pathname}`);

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